-
Notifications
You must be signed in to change notification settings - Fork 3
/
google.conf.js
138 lines (119 loc) · 4.7 KB
/
google.conf.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
var config, env, fs;
fs = require('fs');
config = {
// ---------------------------------------------------------------------------
// ----- Browser Drivers -----------------------------------------------------
// ---------------------------------------------------------------------------
seleniumAddress: 'http://localhost:4444/wd/hub',
// ---------------------------------------------------------------------------
// ----- What tests to run ---------------------------------------------------
// ---------------------------------------------------------------------------
specs: [
'features/**/*.feature'
],
suites: {
google: 'features/google.feature',
googleNG: 'features/googleNG.feature',
//system suites
all: 'features/**/*.feature',
dragon: 'features/dragon/**/*.feature',
failure: 'features/dragon/failure.feature'
},
// ---------------------------------------------------------------------------
// ----- How to set up browsers ----------------------------------------------
// ---------------------------------------------------------------------------
capabilities: {
browserName: 'chrome'
},
multiCapabilities: [],
// ---------------------------------------------------------------------------
// ----- Global test information ---------------------------------------------
// ---------------------------------------------------------------------------
beforeLaunch: function() {
var resultPath = 'result', screenShotsPath = 'screenShots', failure = 'egg/failure.json';
if (!fs.existsSync(resultPath)) fs.mkdirSync(resultPath);
if (!fs.existsSync(screenShotsPath)) fs.mkdirSync(screenShotsPath);
if (env.clearResult == 'on') {
//unlink exist results
fs.readdirSync(resultPath).forEach(
function(result) {
var path = resultPath + '/' + result;
if (fs.lstatSync(path).isDirectory() || !fs.existsSync(path)) return;
fs.unlinkSync(path);
}
);
//unlink screenshots
fs.readdirSync(screenShotsPath).forEach(
function(result) {
var path = screenShotsPath + '/' + result;
if (fs.lstatSync(path).isDirectory() || !fs.existsSync(path)) return;
fs.unlinkSync(path);
}
);
//unlink failure
if (fs.existsSync(failure)) fs.unlinkSync(failure);
}//end if
},
onPrepare: function() {
var chai, chaiAsPromised;
browser.ignoreSynchronization = true;
chai = require('chai');
chaiAsPromised = require('chai-as-promised');
chai.use(chaiAsPromised);
global.__base = __dirname;
global.expect = chai.expect;
global.common = require(__base + '/lib/common.js');
global.constants = require(__base + '/lib/constants.js');
global.PageObject = require(__base + '/lib/pages/pageObject.js');
},
onComplete: function() {
},
onCleanUp: function() {
},
afterLaunch: function() {
},
params: {
loginId: '',
forceRefresh: false
},
resultJsonOutputFile: 'result/result.json',
// ---------------------------------------------------------------------------
// ----- The test framework --------------------------------------------------
// ---------------------------------------------------------------------------
framework: 'cucumber',
cucumberOpts: {
require: 'features/**/*.js',
tags: [
process.env.tags || '@E2E,@SMOKE,@REGRESSION,@FUNCTIONALITY',
'~@X'
],
format: 'summary'
}
};
// environment variables
env = {
browserName: process.env.browserName || 'chrome', // chrome || firefox || internet explorer
tags: process.env.tags || '@E2E,@SMOKE,@REGRESSION,@FUNCTIONALITY',
parallel: process.env.parallel || 'off',
report: process.env.report || 'result',
clearResult: process.env.clearResult || 'on',
excludeMode: process.env.excludeMode || 'off'
};
for (var i in env) env[i] = env[i].trim();
config.capabilities.browserName = env.browserName;
config.cucumberOpts.tags = [env.tags, '~@X'];
config.resultJsonOutputFile = 'result/' + env.report + '.json';
if (env.parallel == 'on') {
config.capabilities = {
browserName: env.browserName,
shardTestFiles: true,
maxInstances: 3
};
}//end if
if (env.excludeMode == 'on') {
//set exclude attribute
config.exclude = [
'features/dragon/**/*.feature'
];
}//end if
exports.config = config;