Commit 40d0141b 40d0141bab6452abde5fbb90f81e5dfd2c6f2c2f by Victor Yap

Added the rest of Tester's aliases to the selftest

1 parent 15b191c3
......@@ -25,23 +25,30 @@ casper.thenOpen('tests/site/index.html', function() {
t.comment('Tester.assertTextExists()');
t.assertTextExists('form', 'Tester.assertTextExists() checks that page body contains text');
t.comment('Tester.assertTextExist()');
t.assertTextExist('form', 'Tester.assertTextExist() checks that page body contains text [alias]');
t.comment('Tester.assertSelectorHasText()');
t.assertSelectorHasText('h1', 'Title', 'Tester.assertSelectorHasText() works as expected');
t.comment('Tester.assertSelectorDoesntHaveText()');
t.assertSelectorDoesntHaveText('h1', 'Subtitle', 'Tester.assertSelectorDoesntHaveText() works as expected');
});
casper.then(function() {
t.comment('Tester.assert()');
t.assert(true, 'Tester.assert() works as expected');
t.comment('Tester.assertTrue()');
t.assertTrue(true, 'Tester.assertTrue() works as expected [alias]');
t.comment('Tester.assertNot()');
t.assertNot(false, 'Tester.assertNot() works as expected');
t.comment('Tester.assertEquals()');
t.assertEquals(true, true, 'Tester.assertEquals() works as expected');
t.comment('Tester.assertEqual()');
t.assertEqual(true, true, 'Tester.assertEqual() works as expected [alias]');
t.comment('Tester.assertNotEquals()');
t.assertNotEquals(true, false, 'Tester.assertNotEquals() works as expected');
......@@ -50,26 +57,39 @@ casper.then(function() {
return true;
}, 'Tester.assertEval() works as expected');
t.comment('Tester.assertEvaluate()');
t.assertEvaluate(function() {
return true;
}, 'Tester.assertEvaluate() works as expected [alias]');
t.comment('Tester.assertEvalEquals()');
t.assertEvalEquals(function() {
return 42;
}, 42, 'Tester.assertEvalEquals() works as expected');
t.comment('Tester.assertEvalEqual()');
t.assertEvalEqual(function() {
return 42;
}, 42, 'Tester.assertEvalEqual() works as expected [alias]');
t.comment('Tester.assertExists()');
t.assertExists('body', 'Tester.assertExists() works as expected');
t.comment('Tester.assertExist()');
t.assertExist('body', 'Tester.assertExist() [alias of assertExists()] works as expected');
t.assertExist('body', 'Tester.assertExist() works as expected [alias]');
t.comment('Tester.assertSelectorExists()');
t.assertSelectorExists('body', 'Tester.assertSelectorExists() [alias of assertExists()] works as expected');
t.assertSelectorExists('body', 'Tester.assertSelectorExists() works as expected [alias]');
t.comment('Tester.assertSelectorExists()');
t.assertSelectorExist('body', 'Tester.assertSelectorExist() [alias of assertExists()] works as expected');
t.assertSelectorExist('body', 'Tester.assertSelectorExist() works as expected [alias]');
t.comment('Tester.assertDoesntExist()');
t.assertDoesntExist('foobar', 'Tester.assertDoesntExist() works as expected');
t.comment('Tester.assertNotExist()');
t.assertDoesntExist('foobar', 'Tester.assertNotExist() works as expected [alias]');
t.comment('Tester.assertHttpStatus()');
// using file:// protocol, HTTP status is always null
t.assertHttpStatus(200, 'Tester.assertHttpStatus() works as expected');
......@@ -77,31 +97,56 @@ casper.then(function() {
t.comment('Tester.assertMatch()');
t.assertMatch("the lazy dog", /lazy/, 'Tester.assertMatch() works as expected');
t.comment('Tester.assertMatches()');
t.assertMatches("the lazy dog", /lazy/, 'Tester.assertMatches() works as expected [alias]');
t.comment('Tester.assertRaises()');
t.assertRaises(function() {
throw new Error('plop');
}, [], 'Tester.assertRaises() works as expected');
t.comment('Tester.assertRaise()');
t.assertRaise(function() {
throw new Error('plop');
}, [], 'Tester.assertRaise() works as expected [alias]');
t.comment('Tester.assertThrows()');
t.assertThrows(function() {
throw new Error('plop');
}, [], 'Tester.assertThrows() works as expected [alias]');
t.comment('Tester.assertResourceExists()');
t.assertResourceExists(/index\.html/, 'Tester.assertResourceExists() works as expected');
t.comment('Tester.assertResourceExist()');
t.assertResourceExist(/index\.html/, 'Tester.assertResourceExist() works as expected [alias]');
t.comment('Tester.assertTitle()');
t.assertTitle('CasperJS test index', 'Tester.assertTitle() works as expected');
t.comment('Tester.assertTitleMatch()');
t.assertTitleMatch(/test index/, 'Tester.assertTitleMatch() works as expected');
t.comment('Tester.assertTitleMatches()');
t.assertTitleMatches(/test index/, 'Tester.assertTitleMatches() works as expected [alias]');
t.comment('Tester.assertType()');
t.assertType("plop", "string", "Tester.assertType() works as expected");
t.comment('Tester.assertUrlMatch()');
t.assertUrlMatch(/index\.html$/, "Tester.assertUrlMatch() works as expected");
t.comment('Tester.assertUrlMatches()');
t.assertUrlMatches(/index\.html$/, "Tester.assertUrlMatches() works as expected [alias]");
t.comment('Tester.assertVisible()');
t.assertVisible('img', 'Tester.assertVisible() works as expected');
t.comment('Tester.assertNotVisible()');
t.assertNotVisible('p#hidden', 'Tester.assertNotVisible() works as expected');
t.comment('Tester.assertInvisible()');
t.assertInvisible('p#hidden', 'Tester.assertInvisible() works as expected [alias]');
});
casper.thenOpen('tests/site/form.html', function() {
......