forked from juice-shop/juice-shop
-
Notifications
You must be signed in to change notification settings - Fork 1
/
protractor.conf.js
74 lines (60 loc) · 1.82 KB
/
protractor.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
/*
* Copyright (c) 2014-2022 Bjoern Kimminich & the OWASP Juice Shop contributors.
* SPDX-License-Identifier: MIT
*/
const url = require('url')
let proxy = {
proxyType: 'autodetect'
}
if (process.env.HTTP_PROXY !== undefined && process.env.HTTP_PROXY !== null) {
proxy = {
proxyType: 'manual',
httpProxy: process.env.HTTP_PROXY
}
}
exports.config = {
directConnect: true,
allScriptsTimeout: 80000,
specs: [
'test/e2e/*.ts'
],
capabilities: {
browserName: 'chrome',
proxy: proxy,
chromeOptions: {
args: ['--window-size=1024,768', '--disable-features=SameSiteByDefaultCookies']
}
},
baseUrl: 'http://localhost:3000',
framework: 'jasmine2',
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 90000
},
beforeLaunch: function () {
require('ts-node').register({
project: 'tsconfig.json'
})
},
onPrepare: function () {
const jasmineReporters = require('jasmine-reporters')
jasmine.getEnv().addReporter(new jasmineReporters.JUnitXmlReporter({
consolidateAll: true,
savePath: 'build/reports/e2e_results'
}))
let basePath = (new url.URL(browser.baseUrl)).pathname
if (basePath === '/') basePath = ''
// Get all banners out of the way
browser.get(basePath + '/#')
browser.manage().addCookie({ name: 'cookieconsent_status', value: 'dismiss' })
browser.manage().addCookie({ name: 'welcomebanner_status', value: 'dismiss' })
// Ensure score board shows all challenges (by default only 1-star challenges are shown)
browser.get(basePath + '/#/score-board')
element(by.id('btnToggleAllDifficulties')).click()
}
}
if (process.env.CI) {
exports.config.capabilities.chromeOptions = {
args: ['--headless', '--disable-gpu', '--window-size=1024,768', '--disable-features=SameSiteByDefaultCookies']
}
}