forked from box/box-annotations
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcodecept.conf.js
More file actions
84 lines (78 loc) · 2.29 KB
/
codecept.conf.js
File metadata and controls
84 lines (78 loc) · 2.29 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
const {
SAUCE_USERNAME,
SAUCE_ACCESS_KEY,
TRAVIS_JOB_NUMBER,
CI,
BROWSER_NAME = 'chrome',
BROWSER_VERSION = 'latest',
BROWSER_PLATFORM,
PLATFORM_VERSION,
DEVICE_NAME,
DEFAULT_WAIT_TIME = 90000,
RUN_LOCALLY=false
} = process.env;
const MOBILE_PLATFORMS = ['iOS', 'Android'];
const { cleanupAnnotations } = require('./functional-tests/helpers/cleanup');
// Local selenium config
const commonConfigObj = {
browser: BROWSER_NAME,
url: 'http://localhost:8080',
restart: true,
waitForTimeout: DEFAULT_WAIT_TIME
};
const helperObj = {};
const isLocalBuild = typeof SAUCE_USERNAME === 'undefined' || RUN_LOCALLY;
if (isLocalBuild) {
helperObj.WebDriverIO = commonConfigObj;
} else {
// Common saucelab config
const sauceObj = {
host: 'ondemand.saucelabs.com',
port: 80,
user: SAUCE_USERNAME,
key: SAUCE_ACCESS_KEY,
desiredCapabilities: {
name: CI ? 'Travis cron' : require('os').userInfo().username, // eslint-disable-line global-require
build: TRAVIS_JOB_NUMBER,
'tunnel-identifier': TRAVIS_JOB_NUMBER,
browserName: BROWSER_NAME,
platform: BROWSER_PLATFORM
}
};
const mixedInSauceObj = Object.assign({}, commonConfigObj, sauceObj);
if (MOBILE_PLATFORMS.indexOf(BROWSER_PLATFORM) === -1) {
// webdriver (desktop)
Object.assign(sauceObj.desiredCapabilities, {
version: BROWSER_VERSION
});
helperObj.WebDriverIO = mixedInSauceObj;
} else {
// appium (mobile)
Object.assign(sauceObj.desiredCapabilities, {
platformVersion: PLATFORM_VERSION,
deviceName: DEVICE_NAME,
deviceOrientation: 'portrait',
appiumVersion: '1.7.2',
platformName: BROWSER_PLATFORM
});
helperObj.Appium = mixedInSauceObj;
}
}
/**
* @return {void}
*/
function cleanup() {
cleanupAnnotations() ;
}
exports.config = {
tests: './functional-tests/tests/*.js',
timeout: DEFAULT_WAIT_TIME,
output: './functional-tests/output',
helpers: helperObj,
include: {},
bootstrap: cleanup,
teardown: cleanup,
mocha: {},
name: 'box-annotations',
hooks: isLocalBuild ? [] : ['./functional-tests/helpers/eventHooks.js']
};