migrated casper/auth tests to new testing format
Showing
1 changed file
with
17 additions
and
15 deletions
1 | /*global casper*/ | 1 | /*global casper*/ |
2 | /*jshint strict:false maxstatements:99*/ | 2 | /*jshint strict:false maxstatements:99*/ |
3 | 3 | ||
4 | casper.start('tests/site/index.html'); | 4 | casper.test.begin('HTTP authentication tests', 8, function(test) { |
5 | casper.start('tests/site/index.html'); | ||
5 | 6 | ||
6 | casper.configureHttpAuth('http://localhost/'); | 7 | casper.configureHttpAuth('http://localhost/'); |
7 | casper.test.assertEquals(casper.page.settings.userName, undefined); | 8 | test.assertEquals(casper.page.settings.userName, undefined); |
8 | casper.test.assertEquals(casper.page.settings.password, undefined); | 9 | test.assertEquals(casper.page.settings.password, undefined); |
9 | 10 | ||
10 | casper.configureHttpAuth('http://niko:plop@localhost/'); | 11 | casper.configureHttpAuth('http://niko:plop@localhost/'); |
11 | casper.test.assertEquals(casper.page.settings.userName, 'niko'); | 12 | test.assertEquals(casper.page.settings.userName, 'niko'); |
12 | casper.test.assertEquals(casper.page.settings.password, 'plop'); | 13 | test.assertEquals(casper.page.settings.password, 'plop'); |
13 | 14 | ||
14 | casper.configureHttpAuth('http://localhost/', {username: 'john', password: 'doe'}); | 15 | casper.configureHttpAuth('http://localhost/', {username: 'john', password: 'doe'}); |
15 | casper.test.assertEquals(casper.page.settings.userName, 'john'); | 16 | test.assertEquals(casper.page.settings.userName, 'john'); |
16 | casper.test.assertEquals(casper.page.settings.password, 'doe'); | 17 | test.assertEquals(casper.page.settings.password, 'doe'); |
17 | 18 | ||
18 | casper.configureHttpAuth('http://niko:plop@localhost/', {username: 'john', password: 'doe'}); | 19 | casper.configureHttpAuth('http://niko:plop@localhost/', {username: 'john', password: 'doe'}); |
19 | casper.test.assertEquals(casper.page.settings.userName, 'niko'); | 20 | test.assertEquals(casper.page.settings.userName, 'niko'); |
20 | casper.test.assertEquals(casper.page.settings.password, 'plop'); | 21 | test.assertEquals(casper.page.settings.password, 'plop'); |
21 | 22 | ||
22 | casper.run(function() { | 23 | casper.run(function() { |
23 | this.test.done(8); | 24 | test.done(); |
25 | }); | ||
24 | }); | 26 | }); | ... | ... |
-
Please register or sign in to post a comment