Check boxes

Check boxes can seem a little out of place as far as inputs are concerned. When you are getting text from a text input you are generally just looking for the value. However on a check box the DOM doesn't return a value but it does add an attribute checked.

Testing Scenario

As a user of the website I want to be able to click the Remember me check box and make sure it is selected.

describe('As a user of website', function() {
  it('should allow me to click Remember me checkbox', function() {
    browser.get('http://thisWebsite/');

    // Check the checkbox
    $('[id="remember"]').click();

    // Expect that the checkbox is checked.
    expect($('[id="remember"]').getAttribute('checked')).toBeTruthy();

    // Alternate way to check if checkbox is checked
    expect($('[id="remember"]').isSelected()).toBeTruthy();
  });
});

results matching ""

    No results matching ""