Browse Source

Fix broken todomvc e2e test (#296)

* fix broken todomvc e2e test

* bump casperjs
katashin 8 years ago
parent
commit
2e62705d4b
2 changed files with 9 additions and 2 deletions
  1. 1 1
      package.json
  2. 8 1
      test/e2e/todomvc.js

+ 1 - 1
package.json

@@ -47,7 +47,7 @@
     "babel-preset-es2015-rollup": "^1.1.1",
     "babel-preset-es2015-rollup": "^1.1.1",
     "babel-preset-stage-2": "^6.1.18",
     "babel-preset-stage-2": "^6.1.18",
     "babel-runtime": "^6.0.0",
     "babel-runtime": "^6.0.0",
-    "casperjs": "^1.1.0-beta5",
+    "casperjs": "^1.1.3",
     "chai": "^3.4.1",
     "chai": "^3.4.1",
     "css-loader": "^0.23.1",
     "css-loader": "^0.23.1",
     "eslint": "^2.2.0",
     "eslint": "^2.2.0",

+ 8 - 1
test/e2e/todomvc.js

@@ -2,6 +2,7 @@ casper.test.begin('todomvc', 57, function (test) {
   casper
   casper
   .start('examples/todomvc/index.html')
   .start('examples/todomvc/index.html')
   .then(function () {
   .then(function () {
+    this.viewport(1000, 1000) // for appearing destroy button by mouse hover
     test.assertNotVisible('.main', '.main should be hidden')
     test.assertNotVisible('.main', '.main should be hidden')
     test.assertNotVisible('.footer', '.footer should be hidden')
     test.assertNotVisible('.footer', '.footer should be hidden')
     test.assertElementCount('.filters .selected', 1, 'should have one filter selected')
     test.assertElementCount('.filters .selected', 1, 'should have one filter selected')
@@ -29,7 +30,7 @@ casper.test.begin('todomvc', 57, function (test) {
     test.assertVisible('.main', '.main should now be visible')
     test.assertVisible('.main', '.main should now be visible')
     test.assertVisible('.footer', '.footer should now be visible')
     test.assertVisible('.footer', '.footer should now be visible')
     test.assertNotVisible('.clear-completed', '.clear-completed should be hidden')
     test.assertNotVisible('.clear-completed', '.clear-completed should be hidden')
-    test.assertField({type: 'css', path: '.new-todo'}, '', 'new todo input should be reset')
+    test.assertField({ type: 'css', path: '.new-todo' }, '', 'new todo input should be reset')
   })
   })
 
 
   // add another item ---------------------------------------------------
   // add another item ---------------------------------------------------
@@ -88,6 +89,9 @@ casper.test.begin('todomvc', 57, function (test) {
 
 
   // remove a completed item --------------------------------------------
   // remove a completed item --------------------------------------------
 
 
+  .then(function () {
+    this.mouse.move('.todo:nth-child(1)')
+  })
   .thenClick('.todo:nth-child(1) .destroy', function () {
   .thenClick('.todo:nth-child(1) .destroy', function () {
     test.assertElementCount('.todo', 4, 'should have 4 items now')
     test.assertElementCount('.todo', 4, 'should have 4 items now')
     test.assertElementCount('.todo.completed', 2, 'should have 2 item completed')
     test.assertElementCount('.todo.completed', 2, 'should have 2 item completed')
@@ -96,6 +100,9 @@ casper.test.begin('todomvc', 57, function (test) {
 
 
   // remove a incompleted item ------------------------------------------
   // remove a incompleted item ------------------------------------------
 
 
+  .then(function () {
+    this.mouse.move('.todo:nth-child(2)')
+  })
   .thenClick('.todo:nth-child(2) .destroy', function () {
   .thenClick('.todo:nth-child(2) .destroy', function () {
     test.assertElementCount('.todo', 3, 'should have 3 items now')
     test.assertElementCount('.todo', 3, 'should have 3 items now')
     test.assertElementCount('.todo.completed', 2, 'should have 2 item completed')
     test.assertElementCount('.todo.completed', 2, 'should have 2 item completed')