Skip to content

Instantly share code, notes, and snippets.

@anil826
Created August 7, 2016 19:16
Show Gist options
  • Save anil826/003ceea2890b0c8272853275e5d3eb84 to your computer and use it in GitHub Desktop.
Save anil826/003ceea2890b0c8272853275e5d3eb84 to your computer and use it in GitHub Desktop.
The Page Object
'use strict';
var AngularPage = function () {
browser.get('http://www.angularjs.org');
};
AngularPage.prototype = Object.create({}, {
todoText: { get: function () { return element(by.model('todoText')); }},
addButton: { get: function () { return element(by.css('[value="add"]')); }},
yourName: { get: function () { return element(by.model('yourName')); }},
greeting: { get: function () { return element(by.binding('yourName')).getText(); }},
todoList: { get: function () { return element.all(by.repeater('todo in todos')); }},
typeName: { value: function (keys) { return this.yourName.sendKeys(keys); }},
todoAt: { value: function (idx) { return this.todoList.get(idx).getText(); }},
addTodo: { value: function (todo) {
this.todoText.sendKeys(todo);
this.addButton.click();
}}
});
module.exports = AngularPage;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment