Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

migrated xpath tests

  • Loading branch information...
commit 2bcc009ff54e0a8a525df98b07873b22d7b8dbd3 1 parent c61f0f1
@n1k0 authored
Showing with 26 additions and 26 deletions.
  1. +26 −26 tests/suites/casper/xpath.js
View
52 tests/suites/casper/xpath.js
@@ -2,33 +2,33 @@
/*jshint strict:false*/
var x = require('casper').selectXPath;
-casper.test.comment('XPath');
-
-casper.start('tests/site/index.html', function() {
- this.test.assertExists({
- type: 'xpath',
- path: '/html/body/ul/li[2]'
- }, 'XPath selector can find an element');
- this.test.assertDoesntExist({
- type: 'xpath',
- path: '/html/body/ol/li[2]'
- }, 'XPath selector does not retrieve an unexistent element');
- this.test.assertExists(x('/html/body/ul/li[2]'), 'selectXPath() shortcut can find an element as well');
- this.test.assertEvalEquals(function() {
- return __utils__.findAll({type: 'xpath', path: '/html/body/ul/li'}).length;
- }, 3, 'Correct number of elements are found');
-});
+casper.test.begin('XPath tests', 6, function(test) {
+ casper.start('tests/site/index.html', function() {
+ test.assertExists({
+ type: 'xpath',
+ path: '/html/body/ul/li[2]'
+ }, 'XPath selector can find an element');
+ test.assertDoesntExist({
+ type: 'xpath',
+ path: '/html/body/ol/li[2]'
+ }, 'XPath selector does not retrieve an unexistent element');
+ test.assertExists(x('/html/body/ul/li[2]'), 'selectXPath() shortcut can find an element as well');
+ test.assertEvalEquals(function() {
+ return __utils__.findAll({type: 'xpath', path: '/html/body/ul/li'}).length;
+ }, 3, 'Correct number of elements are found');
+ });
-casper.thenClick(x('/html/body/a[2]'), function() {
- this.test.assertTitle('CasperJS test form', 'Clicking XPath works as expected');
- this.fill(x('/html/body/form'), {
- email: 'chuck@norris.com'
+ casper.thenClick(x('/html/body/a[2]'), function() {
+ test.assertTitle('CasperJS test form', 'Clicking XPath works as expected');
+ this.fill(x('/html/body/form'), {
+ email: 'chuck@norris.com'
+ });
+ test.assertEvalEquals(function() {
+ return document.querySelector('input[name="email"]').value;
+ }, 'chuck@norris.com', 'Casper.fill() can fill an input[type=text] form field');
});
- this.test.assertEvalEquals(function() {
- return document.querySelector('input[name="email"]').value;
- }, 'chuck@norris.com', 'Casper.fill() can fill an input[type=text] form field');
-});
-casper.run(function() {
- this.test.done(6);
+ casper.run(function() {
+ test.done();
+ });
});
Please sign in to comment.
Something went wrong with that request. Please try again.