Commit 0fe43bab authored by Sam Saccone's avatar Sam Saccone

wip

parent 9f5e3f03
...@@ -87,11 +87,17 @@ module.exports = function Page(browser) { ...@@ -87,11 +87,17 @@ module.exports = function Page(browser) {
}; };
this.getItemElements = function () { this.getItemElements = function () {
return this.tryFindByXpath(this.getTodoListXpath() + '/li'); return this.getTodoListXpath()
.then(function (xpath) {
return this.tryFindByXpath(xpath + '/li');
}.bind(this));
}; };
this.getNonCompletedItemElements = function () { this.getNonCompletedItemElements = function () {
return this.tryFindByXpath(this.getTodoListXpath() + '/li[not(contains(@class,"completed"))]'); return this.getTodoListXpath()
.then(function (xpath) {
return this.tryFindByXpath(xpath + '/li[not(contains(@class,"completed"))]');
}.bind(this));
}; };
this.getItemsCountElement = function () { this.getItemsCountElement = function () {
...@@ -107,8 +113,10 @@ module.exports = function Page(browser) { ...@@ -107,8 +113,10 @@ module.exports = function Page(browser) {
}; };
this.getItemLabels = function () { this.getItemLabels = function () {
var xpath = this.getTodoListXpath() + '/li//label'; return this.getTodoListXpath()
return this.tryFindByXpath(xpath); .then(function (xpath) {
return this.tryFindByXpath(xpath + '/li//label');
}.bind(this));
}; };
this.findFirstExisting = function () { this.findFirstExisting = function () {
...@@ -150,9 +158,13 @@ module.exports = function Page(browser) { ...@@ -150,9 +158,13 @@ module.exports = function Page(browser) {
}; };
this.enterItem = function (itemText) { this.enterItem = function (itemText) {
var textField = this.getItemInputField(); return this.getItemInputField()
textField.sendKeys(itemText); .then(function (textField) {
textField.sendKeys(webdriver.Key.ENTER); return textField.sendKeys(itemText)
.then(function () {
return textField.sendKeys(webdriver.Key.ENTER);
});
});
}; };
this.toggleItemAtIndex = function (index) { this.toggleItemAtIndex = function (index) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment