waitFor_timeout.js
3.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
/*global casper*/
/*jshint strict:false*/
casper.options.waitTimeout = 500;
casper.test.begin('waitForSelector fails with expected message', 1, function(test) {
casper.start('../site/waitFor.html');
casper.waitForSelector('p.nonexistent', function() {
throw new Error('waitForSelector found something it should not have');
});
casper.run(function() {
test.done();
});
});
casper.test.begin('waitWhileSelector fails with expected message', 1, function(test) {
casper.start('../site/waitFor.html');
casper.waitForSelector('#encoded');
casper.waitWhileSelector('#encoded', function() {
throw new Error('waitWhileSelector thought something got removed when it did not');
});
casper.run(function() {
test.done();
});
});
casper.test.begin('waitForSelectorTextChange fails with expected message', 1, function(test) {
casper.start('../site/waitFor.html');
casper.waitForSelectorTextChange('#encoded', function() {
throw new Error('waitForSelectorTextChange thought text changed when it did not');
});
casper.run(function() {
test.done();
});
});
casper.test.begin('waitUntilVisible fails with expected message', 1, function(test) {
casper.start('../site/waitFor.html');
casper.waitUntilVisible('p[style]', function() {
throw new Error('waitUntilVisible falsely identified a hidden paragraph');
});
casper.run(function() {
test.done();
});
});
casper.test.begin('waitWhileVisible fails with expected message', 1, function(test) {
casper.start('../site/waitFor.html');
casper.waitWhileVisible('img', function() {
throw new Error('waitWhileVisible thought something disappeared when it did not');
});
casper.run(function() {
test.done();
});
});
casper.test.begin('waitForUrl fails with expected message', 1, function(test) {
casper.start('../site/waitFor.html');
casper.waitForUrl(/github\.com/, function() {
throw new Error('waitForUrl thought we actually navigated to GitHub');
});
casper.run(function() {
test.done();
});
});
casper.test.begin('waitForPopup fails with expected message', 1, function(test) {
casper.start('../site/waitFor.html');
casper.waitForPopup(/foobar/, function() {
throw new Error('waitForPopup found something it should not have');
});
casper.run(function() {
test.done();
});
});
casper.test.begin('waitForText fails with expected message', 1, function(test) {
casper.start('../site/waitFor.html');
casper.waitForText("Lorem ipsum", function() {
throw new Error('waitForText found something it should not have');
});
casper.run(function() {
test.done();
});
});
casper.test.begin('waitFor fails with expected message', 1, function(test) {
casper.start('../site/waitFor.html');
casper.waitFor(function() {
return false
}, function() {
throw new Error('waitFor fasely succeeded');
});
casper.run(function() {
test.done();
});
});