Skip to content
This repository
Browse code

migrated xpath tests

  • Loading branch information...
commit 2bcc009ff54e0a8a525df98b07873b22d7b8dbd3 1 parent c61f0f1
Nicolas Perriault authored

Showing 1 changed file with 26 additions and 26 deletions. Show diff stats Hide diff stats

  1. 52  tests/suites/casper/xpath.js
52  tests/suites/casper/xpath.js
@@ -2,33 +2,33 @@
2 2
 /*jshint strict:false*/
3 3
 var x = require('casper').selectXPath;
4 4
 
5  
-casper.test.comment('XPath');
6  
-
7  
-casper.start('tests/site/index.html', function() {
8  
-    this.test.assertExists({
9  
-        type: 'xpath',
10  
-        path: '/html/body/ul/li[2]'
11  
-    }, 'XPath selector can find an element');
12  
-    this.test.assertDoesntExist({
13  
-        type: 'xpath',
14  
-        path: '/html/body/ol/li[2]'
15  
-    }, 'XPath selector does not retrieve an unexistent element');
16  
-    this.test.assertExists(x('/html/body/ul/li[2]'), 'selectXPath() shortcut can find an element as well');
17  
-    this.test.assertEvalEquals(function() {
18  
-        return __utils__.findAll({type: 'xpath', path: '/html/body/ul/li'}).length;
19  
-    }, 3, 'Correct number of elements are found');
20  
-});
  5
+casper.test.begin('XPath tests', 6, function(test) {
  6
+    casper.start('tests/site/index.html', function() {
  7
+        test.assertExists({
  8
+            type: 'xpath',
  9
+            path: '/html/body/ul/li[2]'
  10
+        }, 'XPath selector can find an element');
  11
+        test.assertDoesntExist({
  12
+            type: 'xpath',
  13
+            path: '/html/body/ol/li[2]'
  14
+        }, 'XPath selector does not retrieve an unexistent element');
  15
+        test.assertExists(x('/html/body/ul/li[2]'), 'selectXPath() shortcut can find an element as well');
  16
+        test.assertEvalEquals(function() {
  17
+            return __utils__.findAll({type: 'xpath', path: '/html/body/ul/li'}).length;
  18
+        }, 3, 'Correct number of elements are found');
  19
+    });
21 20
 
22  
-casper.thenClick(x('/html/body/a[2]'), function() {
23  
-    this.test.assertTitle('CasperJS test form', 'Clicking XPath works as expected');
24  
-    this.fill(x('/html/body/form'), {
25  
-        email: 'chuck@norris.com'
  21
+    casper.thenClick(x('/html/body/a[2]'), function() {
  22
+        test.assertTitle('CasperJS test form', 'Clicking XPath works as expected');
  23
+        this.fill(x('/html/body/form'), {
  24
+            email: 'chuck@norris.com'
  25
+        });
  26
+        test.assertEvalEquals(function() {
  27
+            return document.querySelector('input[name="email"]').value;
  28
+        }, 'chuck@norris.com', 'Casper.fill() can fill an input[type=text] form field');
26 29
     });
27  
-    this.test.assertEvalEquals(function() {
28  
-        return document.querySelector('input[name="email"]').value;
29  
-    }, 'chuck@norris.com', 'Casper.fill() can fill an input[type=text] form field');
30  
-});
31 30
 
32  
-casper.run(function() {
33  
-    this.test.done(6);
  31
+    casper.run(function() {
  32
+        test.done();
  33
+    });
34 34
 });

0 notes on commit 2bcc009

Please sign in to comment.
Something went wrong with that request. Please try again.