forked from angular/protractor
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexitCodes.js
More file actions
46 lines (38 loc) · 1.54 KB
/
exitCodes.js
File metadata and controls
46 lines (38 loc) · 1.54 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
#!/usr/bin/env node
'use strict';
var spawn = require('child_process').spawnSync;
var exitCodes = require('../built/exitCodes');
var runProtractor, output, messages;
var checkLogs = function(output, messages) {
for (var pos in messages) {
var message = messages[pos];
if (output.indexOf(message) === -1) {
throw new Error('does not exist in logs: ' + message);
}
}
};
/******************************
*Below are exit failure tests*
******************************/
// assert authentication error for sauce labs
runProtractor = spawn('node',
['bin/protractor', 'spec/errorTest/sauceLabsAuthentication.js']);
output = runProtractor.stdout.toString();
messages = ['WebDriverError: Sauce Labs Authentication Error.',
'Process exited with error code ' + exitCodes.BrowserError.CODE];
checkLogs(output, messages);
// assert authentication error for browser stack
runProtractor = spawn('node',
['bin/protractor', 'spec/errorTest/browserStackAuthentication.js']);
output = runProtractor.stdout.toString();
messages = ['WebDriverError: Invalid username or password',
'Process exited with error code ' + exitCodes.BrowserError.CODE];
checkLogs(output, messages);
// assert there is no capabilities in the config
runProtractor = spawn('node',
['bin/protractor', 'spec/errorTest/debugMultiCapabilities.js']);
output = runProtractor.stdout.toString();
messages = [
'Cannot run in debug mode with multiCapabilities, count > 1, or sharding',
'Process exited with error code ' + exitCodes.ConfigError.CODE];
checkLogs(output, messages);