This repository was archived by the owner on Jul 29, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
/
Copy pathtest.js
executable file
·157 lines (141 loc) · 6.31 KB
/
test.js
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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
#!/usr/bin/env node
var path = require('path');
var Executor = require('./test/test_util').Executor;
var passingTests = [
'node built/cli.js spec/basicConf.js',
'node built/cli.js spec/basicConf.js --useBlockingProxy',
'node built/cli.js spec/multiConf.js',
'node built/cli.js spec/altRootConf.js',
'node built/cli.js spec/inferRootConf.js',
'node built/cli.js spec/onCleanUpAsyncReturnValueConf.js',
'node built/cli.js spec/onCleanUpNoReturnValueConf.js',
'node built/cli.js spec/onCleanUpSyncReturnValueConf.js',
'node built/cli.js spec/onPrepareConf.js',
'node built/cli.js spec/onPrepareFileConf.js',
'node built/cli.js spec/onPreparePromiseConf.js',
'node built/cli.js spec/onPreparePromiseFileConf.js',
'node built/cli.js spec/mochaConf.js',
'node built/cli.js spec/withLoginConf.js',
'node built/cli.js spec/suitesConf.js --suite okmany',
'node built/cli.js spec/suitesConf.js --suite okspec',
'node built/cli.js spec/suitesConf.js --suite okmany,okspec',
'node built/cli.js spec/plugins/smokeConf.js',
'node built/cli.js spec/plugins/multiPluginConf.js',
'node built/cli.js spec/plugins/jasminePostTestConf.js',
'node built/cli.js spec/plugins/mochaPostTestConf.js',
'node built/cli.js spec/plugins/browserGetSyncedConf.js',
'node built/cli.js spec/plugins/browserGetUnsyncedConf.js',
'node built/cli.js spec/plugins/waitForAngularConf.js',
'node built/cli.js spec/interactionConf.js',
'node built/cli.js spec/directConnectConf.js',
'node built/cli.js spec/restartBrowserBetweenTestsConf.js',
'node built/cli.js spec/driverProviderLocalConf.js',
'node built/cli.js spec/driverProviderLocalConf.js --useBlockingProxy',
'node built/cli.js spec/getCapabilitiesConf.js',
'node built/cli.js spec/controlLockConf.js',
'node built/cli.js spec/customFramework.js',
'node built/cli.js spec/noGlobalsConf.js',
'node built/cli.js spec/angular2Conf.js',
'node built/cli.js spec/hybridConf.js',
'node built/cli.js spec/built/noCFBasicConf.js',
'node built/cli.js spec/built/noCFBasicConf.js --useBlockingProxy',
'node built/cli.js spec/built/noCFPluginConf.js',
//'node scripts/driverProviderAttachSession.js',
'node built/cli.js spec/driverProviderUseExistingWebDriver.js',
'node built/cli.js spec/driverProviderUseExistingWebDriver.js --useBlockingProxy',
'node scripts/errorTest.js',
// Unit tests
'node node_modules/jasmine/bin/jasmine.js JASMINE_CONFIG_PATH=scripts/unit_test.json',
// Dependency tests
'node node_modules/jasmine/bin/jasmine.js JASMINE_CONFIG_PATH=scripts/dependency_test.json',
// Typings tests
'node spec/install/test.js'
];
var executor = new Executor();
passingTests.forEach(function(passing_test) {
executor.addCommandlineTest(passing_test)
.assertExitCodeOnly();
});
/*************************
*Below are failure tests*
*************************/
// assert stacktrace shows line of failure
executor.addCommandlineTest('node built/cli.js spec/errorTest/singleFailureConf.js')
.expectExitCode(1)
.expectErrors({
stackTrace: 'single_failure_spec1.js:5:32'
});
// assert timeout works
executor.addCommandlineTest('node built/cli.js spec/errorTest/timeoutConf.js')
.expectExitCode(1)
.expectErrors({
message: 'Timeout - Async callback was not invoked within timeout ' +
'specified by jasmine.DEFAULT_TIMEOUT_INTERVAL.'
})
.expectTestDuration(0, 1000);
executor.addCommandlineTest('node built/cli.js spec/errorTest/afterLaunchChangesExitCodeConf.js')
.expectExitCode(11)
.expectErrors({
message: 'Expected \'Hiya\' to equal \'INTENTIONALLY INCORRECT\'.'
});
executor.addCommandlineTest('node built/cli.js spec/errorTest/multiFailureConf.js')
.expectExitCode(1)
.expectErrors([{
message: 'Expected \'Hiya\' to equal \'INTENTIONALLY INCORRECT\'.',
stacktrace: 'single_failure_spec1.js:5:32'
}, {
message: 'Expected \'Hiya\' to equal \'INTENTIONALLY INCORRECT\'.',
stacktrace: 'single_failure_spec2.js:5:32'
}]);
executor.addCommandlineTest('node built/cli.js spec/errorTest/shardedFailureConf.js')
.expectExitCode(1)
.expectErrors([{
message: 'Expected \'Hiya\' to equal \'INTENTIONALLY INCORRECT\'.',
stacktrace: 'single_failure_spec1.js:5:32'
}, {
message: 'Expected \'Hiya\' to equal \'INTENTIONALLY INCORRECT\'.',
stacktrace: 'single_failure_spec2.js:5:32'
}]);
executor.addCommandlineTest('node built/cli.js spec/errorTest/mochaFailureConf.js')
.expectExitCode(1)
.expectErrors([{
message: 'expected \'My AngularJS App\' to equal \'INTENTIONALLY INCORRECT\'',
stacktrace: 'mocha_failure_spec.js:11:20'
}]);
// executor.addCommandlineTest('node built/cli.js spec/errorTest/pluginsFailingConf.js')
// .expectExitCode(1)
// .expectErrors([
// {message: 'Expected true to be false'},
// {message: 'from setup'},
// {message: 'from postTest passing'},
// {message: 'from postTest failing'},
// {message: 'from teardown'}
// ]);
// executor.addCommandlineTest('node built/cli.js spec/errorTest/slowHttpAndTimeoutConf.js')
// .expectExitCode(1)
// .expectErrors([
// {message: 'The following tasks were pending[\\s\\S]*\\$http: slowcall'},
// {message: 'The following tasks were pending:[\\s\\S]*' +
// '- \\$timeout: function\\(\\) {[\\s\\S]*' +
// '\\$scope\\.slowAngularTimeoutStatus = \'done\';[\\s\\S]' +
// '*}'}
// ]);
// executor.addCommandlineTest('node built/cli.js spec/errorTest/slowHttpAndTimeoutConf.js ' +
// '--untrackOutstandingTimeouts true')
// .expectExitCode(1)
// .expectErrors([
// {message: 'The following tasks were pending[\\s\\S]*\\$http: slowcall'},
// {message: 'While waiting for element with locator - ' +
// 'Locator: by.binding\\(\\"slowAngularTimeoutStatus\\"\\)$'}
// ]);
// executor.addCommandlineTest('node built/cli.js spec/angular2TimeoutConf.js')
// .expectExitCode(1)
// .expectErrors([
// {message: 'Timed out waiting for asynchronous Angular tasks to finish'},
// ]);
// If we're running on CircleCI, save stdout and stderr from the test run to a log file.
if (process.env['CIRCLE_ARTIFACTS']) {
executor.execute(path.join(process.env['CIRCLE_ARTIFACTS'], 'test_log.txt'));
} else {
executor.execute();
}