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() { ...@@ -25,23 +25,30 @@ casper.thenOpen('tests/site/index.html', function() {
25 t.comment('Tester.assertTextExists()'); 25 t.comment('Tester.assertTextExists()');
26 t.assertTextExists('form', 'Tester.assertTextExists() checks that page body contains text'); 26 t.assertTextExists('form', 'Tester.assertTextExists() checks that page body contains text');
27 27
28 t.comment('Tester.assertTextExist()');
29 t.assertTextExist('form', 'Tester.assertTextExist() checks that page body contains text [alias]');
30
28 t.comment('Tester.assertSelectorHasText()'); 31 t.comment('Tester.assertSelectorHasText()');
29 t.assertSelectorHasText('h1', 'Title', 'Tester.assertSelectorHasText() works as expected'); 32 t.assertSelectorHasText('h1', 'Title', 'Tester.assertSelectorHasText() works as expected');
30 33
31 t.comment('Tester.assertSelectorDoesntHaveText()'); 34 t.comment('Tester.assertSelectorDoesntHaveText()');
32 t.assertSelectorDoesntHaveText('h1', 'Subtitle', 'Tester.assertSelectorDoesntHaveText() works as expected'); 35 t.assertSelectorDoesntHaveText('h1', 'Subtitle', 'Tester.assertSelectorDoesntHaveText() works as expected');
33 });
34 36
35 casper.then(function() {
36 t.comment('Tester.assert()'); 37 t.comment('Tester.assert()');
37 t.assert(true, 'Tester.assert() works as expected'); 38 t.assert(true, 'Tester.assert() works as expected');
38 39
40 t.comment('Tester.assertTrue()');
41 t.assertTrue(true, 'Tester.assertTrue() works as expected [alias]');
42
39 t.comment('Tester.assertNot()'); 43 t.comment('Tester.assertNot()');
40 t.assertNot(false, 'Tester.assertNot() works as expected'); 44 t.assertNot(false, 'Tester.assertNot() works as expected');
41 45
42 t.comment('Tester.assertEquals()'); 46 t.comment('Tester.assertEquals()');
43 t.assertEquals(true, true, 'Tester.assertEquals() works as expected'); 47 t.assertEquals(true, true, 'Tester.assertEquals() works as expected');
44 48
49 t.comment('Tester.assertEqual()');
50 t.assertEqual(true, true, 'Tester.assertEqual() works as expected [alias]');
51
45 t.comment('Tester.assertNotEquals()'); 52 t.comment('Tester.assertNotEquals()');
46 t.assertNotEquals(true, false, 'Tester.assertNotEquals() works as expected'); 53 t.assertNotEquals(true, false, 'Tester.assertNotEquals() works as expected');
47 54
...@@ -50,26 +57,39 @@ casper.then(function() { ...@@ -50,26 +57,39 @@ casper.then(function() {
50 return true; 57 return true;
51 }, 'Tester.assertEval() works as expected'); 58 }, 'Tester.assertEval() works as expected');
52 59
60 t.comment('Tester.assertEvaluate()');
61 t.assertEvaluate(function() {
62 return true;
63 }, 'Tester.assertEvaluate() works as expected [alias]');
64
53 t.comment('Tester.assertEvalEquals()'); 65 t.comment('Tester.assertEvalEquals()');
54 t.assertEvalEquals(function() { 66 t.assertEvalEquals(function() {
55 return 42; 67 return 42;
56 }, 42, 'Tester.assertEvalEquals() works as expected'); 68 }, 42, 'Tester.assertEvalEquals() works as expected');
57 69
70 t.comment('Tester.assertEvalEqual()');
71 t.assertEvalEqual(function() {
72 return 42;
73 }, 42, 'Tester.assertEvalEqual() works as expected [alias]');
74
58 t.comment('Tester.assertExists()'); 75 t.comment('Tester.assertExists()');
59 t.assertExists('body', 'Tester.assertExists() works as expected'); 76 t.assertExists('body', 'Tester.assertExists() works as expected');
60 77
61 t.comment('Tester.assertExist()'); 78 t.comment('Tester.assertExist()');
62 t.assertExist('body', 'Tester.assertExist() [alias of assertExists()] works as expected'); 79 t.assertExist('body', 'Tester.assertExist() works as expected [alias]');
63 80
64 t.comment('Tester.assertSelectorExists()'); 81 t.comment('Tester.assertSelectorExists()');
65 t.assertSelectorExists('body', 'Tester.assertSelectorExists() [alias of assertExists()] works as expected'); 82 t.assertSelectorExists('body', 'Tester.assertSelectorExists() works as expected [alias]');
66 83
67 t.comment('Tester.assertSelectorExists()'); 84 t.comment('Tester.assertSelectorExists()');
68 t.assertSelectorExist('body', 'Tester.assertSelectorExist() [alias of assertExists()] works as expected'); 85 t.assertSelectorExist('body', 'Tester.assertSelectorExist() works as expected [alias]');
69 86
70 t.comment('Tester.assertDoesntExist()'); 87 t.comment('Tester.assertDoesntExist()');
71 t.assertDoesntExist('foobar', 'Tester.assertDoesntExist() works as expected'); 88 t.assertDoesntExist('foobar', 'Tester.assertDoesntExist() works as expected');
72 89
90 t.comment('Tester.assertNotExist()');
91 t.assertDoesntExist('foobar', 'Tester.assertNotExist() works as expected [alias]');
92
73 t.comment('Tester.assertHttpStatus()'); 93 t.comment('Tester.assertHttpStatus()');
74 // using file:// protocol, HTTP status is always null 94 // using file:// protocol, HTTP status is always null
75 t.assertHttpStatus(200, 'Tester.assertHttpStatus() works as expected'); 95 t.assertHttpStatus(200, 'Tester.assertHttpStatus() works as expected');
...@@ -77,31 +97,56 @@ casper.then(function() { ...@@ -77,31 +97,56 @@ casper.then(function() {
77 t.comment('Tester.assertMatch()'); 97 t.comment('Tester.assertMatch()');
78 t.assertMatch("the lazy dog", /lazy/, 'Tester.assertMatch() works as expected'); 98 t.assertMatch("the lazy dog", /lazy/, 'Tester.assertMatch() works as expected');
79 99
100 t.comment('Tester.assertMatches()');
101 t.assertMatches("the lazy dog", /lazy/, 'Tester.assertMatches() works as expected [alias]');
102
80 t.comment('Tester.assertRaises()'); 103 t.comment('Tester.assertRaises()');
81 t.assertRaises(function() { 104 t.assertRaises(function() {
82 throw new Error('plop'); 105 throw new Error('plop');
83 }, [], 'Tester.assertRaises() works as expected'); 106 }, [], 'Tester.assertRaises() works as expected');
84 107
108 t.comment('Tester.assertRaise()');
109 t.assertRaise(function() {
110 throw new Error('plop');
111 }, [], 'Tester.assertRaise() works as expected [alias]');
112
113 t.comment('Tester.assertThrows()');
114 t.assertThrows(function() {
115 throw new Error('plop');
116 }, [], 'Tester.assertThrows() works as expected [alias]');
117
85 t.comment('Tester.assertResourceExists()'); 118 t.comment('Tester.assertResourceExists()');
86 t.assertResourceExists(/index\.html/, 'Tester.assertResourceExists() works as expected'); 119 t.assertResourceExists(/index\.html/, 'Tester.assertResourceExists() works as expected');
87 120
121 t.comment('Tester.assertResourceExist()');
122 t.assertResourceExist(/index\.html/, 'Tester.assertResourceExist() works as expected [alias]');
123
88 t.comment('Tester.assertTitle()'); 124 t.comment('Tester.assertTitle()');
89 t.assertTitle('CasperJS test index', 'Tester.assertTitle() works as expected'); 125 t.assertTitle('CasperJS test index', 'Tester.assertTitle() works as expected');
90 126
91 t.comment('Tester.assertTitleMatch()'); 127 t.comment('Tester.assertTitleMatch()');
92 t.assertTitleMatch(/test index/, 'Tester.assertTitleMatch() works as expected'); 128 t.assertTitleMatch(/test index/, 'Tester.assertTitleMatch() works as expected');
93 129
130 t.comment('Tester.assertTitleMatches()');
131 t.assertTitleMatches(/test index/, 'Tester.assertTitleMatches() works as expected [alias]');
132
94 t.comment('Tester.assertType()'); 133 t.comment('Tester.assertType()');
95 t.assertType("plop", "string", "Tester.assertType() works as expected"); 134 t.assertType("plop", "string", "Tester.assertType() works as expected");
96 135
97 t.comment('Tester.assertUrlMatch()'); 136 t.comment('Tester.assertUrlMatch()');
98 t.assertUrlMatch(/index\.html$/, "Tester.assertUrlMatch() works as expected"); 137 t.assertUrlMatch(/index\.html$/, "Tester.assertUrlMatch() works as expected");
99 138
139 t.comment('Tester.assertUrlMatches()');
140 t.assertUrlMatches(/index\.html$/, "Tester.assertUrlMatches() works as expected [alias]");
141
100 t.comment('Tester.assertVisible()'); 142 t.comment('Tester.assertVisible()');
101 t.assertVisible('img', 'Tester.assertVisible() works as expected'); 143 t.assertVisible('img', 'Tester.assertVisible() works as expected');
102 144
103 t.comment('Tester.assertNotVisible()'); 145 t.comment('Tester.assertNotVisible()');
104 t.assertNotVisible('p#hidden', 'Tester.assertNotVisible() works as expected'); 146 t.assertNotVisible('p#hidden', 'Tester.assertNotVisible() works as expected');
147
148 t.comment('Tester.assertInvisible()');
149 t.assertInvisible('p#hidden', 'Tester.assertInvisible() works as expected [alias]');
105 }); 150 });
106 151
107 casper.thenOpen('tests/site/form.html', function() { 152 casper.thenOpen('tests/site/form.html', function() {
......