forked from owncloud/web
-
Notifications
You must be signed in to change notification settings - Fork 0
/
nightwatch.conf.js
146 lines (140 loc) · 5.17 KB
/
nightwatch.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
139
140
141
142
143
144
145
146
const chromedriver = require('chromedriver')
const path = require('path')
const withHttp = url => (/^https?:\/\//i.test(url) ? url : `http://${url}`)
const RUN_WITH_LDAP = !!process.env.RUN_WITH_LDAP
const RUN_ON_OCIS = !!process.env.RUN_ON_OCIS
const LOCAL_LAUNCH_URL = withHttp(
process.env.SERVER_HOST || (RUN_ON_OCIS ? 'https://localhost:9200' : 'http://localhost:9100')
)
const LOCAL_BACKEND_URL = withHttp(
process.env.BACKEND_HOST || (RUN_ON_OCIS ? 'https://localhost:9200' : 'http://localhost:8080')
)
const REMOTE_BACKEND_URL = process.env.REMOTE_BACKEND_HOST
? withHttp(process.env.REMOTE_BACKEND_HOST || 'http://localhost:8080')
: undefined
const BACKEND_ADMIN_USERNAME = process.env.BACKEND_USERNAME || 'admin'
const BACKEND_ADMIN_PASSWORD = process.env.BACKEND_PASSWORD || 'admin'
const SELENIUM_HOST = process.env.SELENIUM_HOST || 'localhost'
const SELENIUM_PORT = process.env.SELENIUM_PORT || 4444
const REMOTE_UPLOAD_DIR =
process.env.REMOTE_UPLOAD_DIR ||
require('path').join(__dirname, '/tests/acceptance/filesForUpload/')
const SAUCE_USERNAME = process.env.SAUCE_USERNAME
const SAUCE_ACCESS_KEY = process.env.SAUCE_ACCESS_KEY
const BROWSER_NAME = process.env.BROWSER_NAME
const SAUCELABS_TUNNEL_NAME = process.env.SAUCELABS_TUNNEL_NAME
const LOCAL_UPLOAD_DIR = process.env.LOCAL_UPLOAD_DIR || '/uploads'
const OCIS_REVA_DATA_ROOT = process.env.OCIS_REVA_DATA_ROOT || '/var/tmp/ocis/storage/owncloud'
const LDAP_SERVER_URL = process.env.LDAP_SERVER_URL || 'ldap://127.0.0.1'
const LDAP_BASE_DN = process.env.LDAP_BASE_DN || 'cn=admin,dc=owncloud,dc=com'
const LDAP_ADMIN_PASSWORD = process.env.LDAP_ADMIN_PASSWORD || 'admin'
const OCIS_SKELETON_DIR = process.env.OCIS_SKELETON_DIR || './tests/testing-app/data/webUISkeleton/'
const OPENID_LOGIN = RUN_ON_OCIS || !!process.env.OPENID_LOGIN
const WEB_UI_CONFIG = process.env.WEB_UI_CONFIG || path.join(__dirname, 'dist/config.json')
const SCREENSHOTS = !!process.env.SCREENSHOTS
const VISUAL_TEST = !!process.env.VISUAL_TEST
const UPDATE_VRT_SCREENSHOTS = !!process.env.UPDATE_VRT_SCREENSHOTS
function generateScreenshotFilePath(nightwatchClient, basePath, imagePath) {
return path.join(process.cwd(), basePath, imagePath)
}
const config = {
page_objects_path: './tests/acceptance/pageObjects',
custom_commands_path: [
'./tests/acceptance/customCommands',
'node_modules/nightwatch-vrt/commands'
],
custom_assertions_path: ['node_modules/nightwatch-vrt/assertions'],
test_settings: {
default: {
launch_url: LOCAL_LAUNCH_URL,
globals: {
waitForConditionTimeout: 20000,
waitForNegativeConditionTimeout: 1000,
waitForConditionPollInterval: 10,
filesForUpload: REMOTE_UPLOAD_DIR,
mountedUploadDir: LOCAL_UPLOAD_DIR,
backend_url: LOCAL_BACKEND_URL,
remote_backend_url: REMOTE_BACKEND_URL,
backend_admin_username: BACKEND_ADMIN_USERNAME,
backend_admin_password: BACKEND_ADMIN_PASSWORD,
default_backend: 'LOCAL',
ocis: RUN_ON_OCIS,
ldap: RUN_WITH_LDAP,
openid_login: OPENID_LOGIN,
ldap_url: LDAP_SERVER_URL,
ocis_data_dir: OCIS_REVA_DATA_ROOT,
ldap_base_dn: LDAP_BASE_DN,
ocis_skeleton_dir: OCIS_SKELETON_DIR,
ldap_password: LDAP_ADMIN_PASSWORD,
webUIConfig: WEB_UI_CONFIG,
visual_test: VISUAL_TEST,
visual_regression_settings: {
generate_screenshot_path: generateScreenshotFilePath,
latest_screenshots_path: 'tests/vrt/latest',
latest_suffix: '',
baseline_screenshots_path: 'tests/vrt/baseline',
baseline_suffix: '',
diff_screenshots_path: 'tests/vrt/diff',
diff_suffix: '',
threshold: 0.002,
prompt: false,
always_save_diff_screenshot: UPDATE_VRT_SCREENSHOTS
}
},
selenium_host: SELENIUM_HOST,
desiredCapabilities: {
browserName: BROWSER_NAME || 'chrome',
javascriptEnabled: true,
acceptSslCerts: true,
chromeOptions: {
args: ['disable-gpu', 'ignore-certificate-errors'],
w3c: false
},
loggingPrefs: { browser: 'ALL' }
},
webdriver: {
start_process: false,
port: SELENIUM_PORT,
use_legacy_jsonwire: false
}
},
local: {
globals: {
waitForConditionTimeout: 10000
},
webdriver: {
start_process: false,
server_path: chromedriver.path,
cli_args: ['--port=' + SELENIUM_PORT]
}
},
drone: {
selenium_host: 'selenium',
desiredCapabilities: {
chromeOptions: {
args: ['disable-gpu', 'disable-dev-shm-usage', 'ignore-certificate-errors'],
w3c: false
},
idleTimeout: 180
},
screenshots: {
enabled: SCREENSHOTS,
path: 'tests/reports/screenshots',
on_failure: true
}
},
saucelabs: {
desiredCapabilities: {
tunnelIdentifier: SAUCELABS_TUNNEL_NAME,
screenResolution: '1280x1024',
username: SAUCE_USERNAME,
access_key: SAUCE_ACCESS_KEY,
idleTimeout: 180
}
}
}
}
if (VISUAL_TEST) {
process.env.SCREEN_RESOLUTION = '1280x1024'
}
module.exports = config