Skip to content

Instantly share code, notes, and snippets.

@rolaveric
Last active August 29, 2015 14:00
Show Gist options
  • Save rolaveric/11076098 to your computer and use it in GitHub Desktop.
Save rolaveric/11076098 to your computer and use it in GitHub Desktop.
Simple protractor test which find an element, clicks it, then checks it's text value.
describe('click to reverse', function () {
var btn;
it('Reverses the button label on click', function () {
// load the page
browser.get('http://localhost:63342/protractorDemo/index.html');
// Find the button
btn = element(by.binding('click.btnText'));
// Click it
btn.click();
// Test the label
expect(btn.getText()).toEqual('esrever ot kcilC');
});
it('Changes the label back on the next click', function () {
// Clicks it again
btn.click();
// Test the label
expect(btn.getText()).toEqual('Click to reverse');
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment