diff --git a/package.json b/package.json index 12889aca..03f99e02 100644 --- a/package.json +++ b/package.json @@ -75,7 +75,7 @@ "karma-webpack": "^1.7.0", "lodash": "^4.13.1", "nightwatch": "^0.9.0", - "nightwatch-helpers": "^1.0.0", + "nightwatch-helpers": "^1.2.0", "phantomjs-prebuilt": "^2.1.1", "rollup": "^0.33.0", "rollup-plugin-alias": "^1.2.0", diff --git a/test/e2e/specs/todomvc.js b/test/e2e/specs/todomvc.js index 8d3ca781..70f48c66 100644 --- a/test/e2e/specs/todomvc.js +++ b/test/e2e/specs/todomvc.js @@ -126,7 +126,7 @@ module.exports = { // editing triggered by enter browser .dblClick('.todo label') - enter('.todo:nth-child(1) .edit', 'edited again!') + .enterValue('.todo:nth-child(1) .edit', 'edited again!') .assert.count('.todo.editing', 0) .assert.containsText('.todo:nth-child(1) label', 'edited again!') @@ -135,14 +135,14 @@ module.exports = { .dblClick('.todo label') .clearValue('.todo:nth-child(1) .edit') .setValue('.todo:nth-child(1) .edit', 'edited!') - triggerKeyup('.todo:nth-child(1) .edit', 27) + .trigger('.todo:nth-child(1) .edit', 'keyup', 27) .assert.count('.todo.editing', 0) .assert.containsText('.todo:nth-child(1) label', 'edited again!') // empty value should remove browser .dblClick('.todo label') - enter('.todo:nth-child(1) .edit', ' ') + .enterValue('.todo:nth-child(1) .edit', ' ') .assert.count('.todo', 3) // toggle all @@ -154,23 +154,7 @@ module.exports = { .end() function createNewItem (text) { - return enter('.new-todo', text) - } - - function enter (selector, text) { - browser - .clearValue(selector) - .setValue(selector, text) - return triggerKeyup(selector, 13) - } - - function triggerKeyup (selector, code) { - return browser.execute(function (selector, code) { - var e = document.createEvent('HTMLEvents') - e.initEvent('keyup', true, true) - e.keyCode = code - document.querySelector(selector).dispatchEvent(e) - }, [selector, code]) + return browser.enterValue('.new-todo', text) } function removeItemAt (n) {