-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprotractor.config.ts
More file actions
117 lines (103 loc) · 3.7 KB
/
Copy pathprotractor.config.ts
File metadata and controls
117 lines (103 loc) · 3.7 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
117
import { Config, browser } from 'protractor';
import { CommonUtilities } from './Utilities/commonUtilities';
//import { join } from 'path';
//import { async } from 'q';
let ptor = require('protractor');
// let suites = require(join(process.cwd(), 'suite.json'));
// var allSuites = {};
// for (let suite in suites) {
// allSuites[suite] = suites[suite].split(',');
// }
export let config: Config = {
directConnect: true,
//seleniumAddress: 'http://localhost:4444/wd/hub',
/**
* if multiCapabilities is defined, the runner will ignore the capabilities configuration.
* disable-infobars : To prevent "Chrome is being controlled by automated test software". on browser
* --start-maximized : Starts the browser maximized, regardless of any previous settings
*/
capabilities: {
browserName: 'chrome',
chromeOptions: {
args: ['disable-web-security', 'disable-infobars=true', '--start-maximized']
}
},
// multiCapabilities: [
// {
// browserName: 'chrome',
// chromeOptions: {
// args: ['disable-web-security', 'disable-infobars=true', '--start-maximized']
// }
// },
// {
// 'browserName': 'firefox',
// 'moz:firefoxOptions': {
// 'args': ['--safe-mode']
// }
// }
// ],
framework: 'jasmine2',
jasmineNodeOpts: {
defaultTimeoutInterval: 60000,
},
allScriptsTimeout: 45000,
suites: {
testFile1: "./specs/spec1.js",
testFile2: "./specs/spec2.js",
testFile3: "./specs/spec3.js",
testFile4: "./specs/spec4.js",
testFile5: "./specs/spec5.js"
},
params: {
implicitWait: 10000,
pageLoadOutTime: 60000
},
beforeLaunch: async () => {
/*
*callback function run before any environment setup.
*/
},
onPrepare: async () => {
/**A callback function called once protractor is ready and available, and before the specs are executed.
* If multiple capabilities are being run, this will run once per capability.
* Browser will initialize here
* the global variable protractor object will be set up, and globals from the test framework will be available.
* called once per capability
*/
browser.manage().deleteAllCookies();
browser.manage().window().maximize();
browser.manage().timeouts().implicitlyWait(+ptor.browser.params.implicitWait);
browser.manage().timeouts().pageLoadTimeout(+ptor.browser.params.pageLoadOutTime);
await generateReport();
},
onComplete: async () => {
/**
* callback function called once tests are finished
* tests will be done but global objects will still be available
*/
ptor.browser.quit();
},
onCleanUp: async () => {
/**
* callback function called once the tests have finished running and the WebDriver instance has been shut down
* called once per capability
*/
},
afterLaunch: async () => {
/**
* This is called only once before the program exits (after onCleanUp).
*/
}
}
async function generateReport() {
let currentDateTime = new CommonUtilities().getCurrentDateTimeAsString();
var HtmlReporter = require('protractor-beautiful-reporter');
jasmine.getEnv().addReporter(new HtmlReporter({
baseDirectory: `Reports/${currentDateTime}`,
takeScreenShotsOnlyForFailedSpecs: true,
excludeSkippedSpecs: true,
screenshotsSubfolder: 'images',
docTitle: 'my reporter',
jsonsSubfolder: 'jsons'
}).getJasmine2Reporter());
}