webship-js 1.0.6 → 1.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/.eslintignore CHANGED
@@ -1,4 +1,3 @@
1
1
  node_modules
2
- ./node_modules
3
- */node_modules
4
- nightwatch.conf.js
2
+ nightwatch.conf.js
3
+ tests_output
@@ -7,7 +7,7 @@ const conf = require('../nightwatch.conf.js');
7
7
  * Folders Path Array variable
8
8
  *
9
9
  * Set and Get folders path exist in (--config) tag and
10
- * (--src_folder) tag added in nodejs command line
10
+ * (--src_folder) tag added in nodejs command line.
11
11
  */
12
12
  let foldersPath = [];
13
13
  function setFoldersPath(value) {
@@ -20,7 +20,7 @@ function setFoldersPath(value) {
20
20
  * Output Format name variable
21
21
  *
22
22
  * Set and Get Output Format exist in (--format) tag added
23
- * in nodejs command line
23
+ * in nodejs command line.
24
24
  */
25
25
  let outputFormat = 'stdout-spaces';
26
26
  function setOutputFormat(value) { outputFormat = value; }
@@ -31,8 +31,8 @@ function setOutputFormat(value) { outputFormat = value; }
31
31
  * Return list of array items that start with
32
32
  * (Given, Then, When, /** ,* , *\).
33
33
  *
34
- * @param {array} stepsList The full step-definitions file lines list
35
- * @return {array} The array has only lines startsWith words chosen
34
+ * @param {array} stepsList The full step-definitions file lines list.
35
+ * @return {array} The array has only lines startsWith words chosen.
36
36
  */
37
37
  function startWith(stepsList) {
38
38
  return (stepsList.startsWith('Given') ||
@@ -47,8 +47,8 @@ function startWith(stepsList) {
47
47
  * Filter Step Definitions
48
48
  *
49
49
  * @param {array} stepsList The step definitions array is sent to filter
50
- * by startsWith words chosen
51
- * @return {array} Step definitions filtered array
50
+ * by startsWith words chosen.
51
+ * @return {array} Step definitions filtered array.
52
52
  */
53
53
  function callStartsWith(stepsList) {
54
54
  return stepsList.filter(startWith);
@@ -57,11 +57,11 @@ function callStartsWith(stepsList) {
57
57
  /**
58
58
  * Clean Steps List
59
59
  *
60
- * Return list of array items cleand from unreadable chars
60
+ * Return list of array items cleand from unreadable chars.
61
61
  *
62
- * @param {array} stepsList The step definitions array before clean
63
- * unreadable signs
64
- * @return {array} The step definitions cleaned array
62
+ * @param {array} stepsList The step definitions array before
63
+ * clean unreadable signs.
64
+ * @return {array} The step definitions cleaned array.
65
65
  */
66
66
  function stepsCleanList(stepsList) {
67
67
  let stepComment = '';
@@ -96,6 +96,13 @@ function srcFolderPaths(path) {
96
96
  setFoldersPath(paths);
97
97
  }
98
98
 
99
+ /**
100
+ * "foldersPath" array
101
+ *
102
+ * Fill "foldersPath" array process, that has paths of
103
+ * all folders contain step definitions js files.
104
+ */
105
+
99
106
  for (let i = 2; i < process.argv.length; i++) {
100
107
  if (process.argv[i].startsWith('--config')) {
101
108
  const splitConfig = process.argv[i].split('=');
@@ -115,6 +122,13 @@ for (let i = 2; i < process.argv.length; i++) {
115
122
 
116
123
  if (foldersPath.length === 0) foldersPath = conf.src_folders;
117
124
 
125
+ /**
126
+ * Step definitions list
127
+ *
128
+ * Get clear step definitions list from js
129
+ * step definitions files.
130
+ */
131
+
118
132
  foldersPath.forEach((folderPath) => {
119
133
  fs.readdir(folderPath, (err, files) => {
120
134
  if (err) {
@@ -7,7 +7,7 @@ const conf = require('../nightwatch.conf.js');
7
7
  * Folders Path Array variable
8
8
  *
9
9
  * Set and Get folders path exist in (--config) tag and
10
- * (--src_folder) tag added in nodejs command line
10
+ * (--src_folder) tag added in nodejs command line.
11
11
  */
12
12
  let foldersPath = [];
13
13
  function setFoldersPath(value) {
@@ -20,7 +20,7 @@ function setFoldersPath(value) {
20
20
  * Output Format name variable
21
21
  *
22
22
  * Set and Get Output Format exist in (--format) tag added
23
- * in nodejs command line
23
+ * in nodejs command line.
24
24
  */
25
25
  let outputFormat = 'stdout-spaces';
26
26
  function setOutputFormat(value) { outputFormat = value; }
@@ -30,8 +30,8 @@ function setOutputFormat(value) { outputFormat = value; }
30
30
  *
31
31
  * Return list of array items that start with (Given, Then, When).
32
32
  *
33
- * @param {array} stepsList The full step-definitions file lines list
34
- * @return {array} The array has only lines startsWith words chosen
33
+ * @param {array} stepsList The full step-definitions file lines list.
34
+ * @return {array} The array has only lines startsWith words chosen.
35
35
  */
36
36
  function startWith(stepsList) {
37
37
  return (stepsList.startsWith('Given') ||
@@ -43,8 +43,8 @@ function startWith(stepsList) {
43
43
  * Filter Step Definitions
44
44
  *
45
45
  * @param {array} stepsList The step definitions array is sent to filter
46
- * by startsWith words chosen
47
- * @return {array} Step definitions filtered array
46
+ * by startsWith words chosen.
47
+ * @return {array} Step definitions filtered array.
48
48
  */
49
49
  function callStartsWith(stepsList) {
50
50
  return stepsList.filter(startWith);
@@ -53,11 +53,11 @@ function callStartsWith(stepsList) {
53
53
  /**
54
54
  * Clean Steps List
55
55
  *
56
- * Return list of array items cleand from unreadable chars
56
+ * Return list of array items cleand from unreadable chars.
57
57
  *
58
58
  * @param {array} stepsList The step definitions array before clean
59
- * unreadable signs
60
- * @return {array} The step definitions cleaned array
59
+ * unreadable signs.
60
+ * @return {array} The step definitions cleaned array.
61
61
  */
62
62
  function stepsCleanList(stepsList) {
63
63
  const newStepsList = [];
@@ -79,6 +79,13 @@ function srcFolderPaths(path) {
79
79
  setFoldersPath(paths);
80
80
  }
81
81
 
82
+ /**
83
+ * "foldersPath" array
84
+ *
85
+ * Fill "foldersPath" array process, that has paths of
86
+ * all folders contain step definitions js files.
87
+ */
88
+
82
89
  for (let i = 2; i < process.argv.length; i++) {
83
90
  if (process.argv[i].startsWith('--config')) {
84
91
  const splitConfig = process.argv[i].split('=');
@@ -98,6 +105,13 @@ for (let i = 2; i < process.argv.length; i++) {
98
105
 
99
106
  if (foldersPath.length === 0) foldersPath = conf.src_folders;
100
107
 
108
+ /**
109
+ * Step definitions list
110
+ *
111
+ * Get clear step definitions list from js
112
+ * step definitions files.
113
+ */
114
+
101
115
  foldersPath.forEach((folderPath) => {
102
116
  fs.readdir(folderPath, (err, files) => {
103
117
  if (err) {
@@ -33,65 +33,65 @@ module.exports = {
33
33
  options: {
34
34
  feature_path: 'tests/features/*.feature',
35
35
  additional_config: '',
36
- parallel: 2
37
- }
38
-
36
+ parallel: 2,
37
+ },
38
+
39
39
  },
40
40
 
41
41
  test_settings: {
42
- default: {
43
- launch_url: "http://webship.co",
44
- selenium_port: 4444,
45
- selenium_host: "127.0.0.1",
46
- silent: true,
47
- screenshots: {
48
- enabled: true,
49
- path: "./reports/screenshots"
42
+ default: {
43
+ launch_url: 'http://webship.co',
44
+ selenium_port: 4444,
45
+ selenium_host: '127.0.0.1',
46
+ silent: true,
47
+ screenshots: {
48
+ enabled: true,
49
+ path: './reports/screenshots',
50
+ },
51
+
52
+ desiredCapabilities: {
53
+ browserName: 'chrome',
54
+ 'goog:chromeOptions': {
55
+ // More info on Chromedriver: https://sites.google.com/a/chromium.org/chromedriver/
56
+ //
57
+ // w3c:false tells Chromedriver to run using the legacy JSONWire protocol (not required in Chrome 78)
58
+ w3c: false,
59
+ args: [
60
+ '--headless',
61
+ '--start-maximized',
62
+ '--disable-gpu',
63
+ '--window-size=1600,1200',
64
+ '--no-sandbox',
65
+ '--disable-dev-shm-usage',
66
+ '--disable-setuid-sandbox',
67
+ '--disable-web-security',
68
+ '--DNS-prefetch-disable',
69
+ '--disable-translate',
70
+ '--ignore-certificate-errors',
71
+ '--test-type',
72
+ '--disable-extensions',
73
+ '--incognito',
74
+ '--disable-infobars',
75
+ '--remote-debugging-port=9222',
76
+ '--allowed-ips=*',
77
+ '--whitelisted-ips=*',
78
+ '--allow-insecure-localhost',
79
+ ],
50
80
  },
51
-
52
- desiredCapabilities: {
53
- browserName: 'chrome',
54
- 'goog:chromeOptions': {
55
- // More info on Chromedriver: https://sites.google.com/a/chromium.org/chromedriver/
56
- //
57
- // w3c:false tells Chromedriver to run using the legacy JSONWire protocol (not required in Chrome 78)
58
- w3c: false,
59
- args: [
60
- '--headless',
61
- '--start-maximized',
62
- '--disable-gpu',
63
- '--window-size=1600,1200',
64
- '--no-sandbox',
65
- '--disable-dev-shm-usage',
66
- '--disable-setuid-sandbox',
67
- '--disable-web-security',
68
- '--DNS-prefetch-disable',
69
- '--disable-translate',
70
- '--ignore-certificate-errors',
71
- '--test-type',
72
- '--disable-extensions',
73
- '--incognito',
74
- '--disable-infobars',
75
- '--remote-debugging-port=9222',
76
- '--allowed-ips=*',
77
- '--whitelisted-ips=*',
78
- '--allow-insecure-localhost'
79
- ]
80
- }
81
- }
82
81
  },
82
+ },
83
83
 
84
84
  safari: {
85
85
  desiredCapabilities: {
86
86
  browserName: 'safari',
87
87
  alwaysMatch: {
88
- acceptInsecureCerts: false
89
- }
88
+ acceptInsecureCerts: false,
89
+ },
90
90
  },
91
91
  webdriver: {
92
92
  start_process: true,
93
- server_path: ''
94
- }
93
+ server_path: '',
94
+ },
95
95
  },
96
96
 
97
97
  firefox: {
@@ -103,9 +103,9 @@ module.exports = {
103
103
  args: [
104
104
  // '-headless',
105
105
  // '-verbose'
106
- ]
107
- }
108
- }
106
+ ],
107
+ },
108
+ },
109
109
  },
110
110
  webdriver: {
111
111
  start_process: true,
@@ -113,8 +113,8 @@ module.exports = {
113
113
  cli_args: [
114
114
  // very verbose geckodriver logs
115
115
  // '-vv'
116
- ]
117
- }
116
+ ],
117
+ },
118
118
  },
119
119
 
120
120
  chrome: {
@@ -126,12 +126,12 @@ module.exports = {
126
126
  // w3c:false tells Chromedriver to run using the legacy JSONWire protocol (not required in Chrome 78)
127
127
  w3c: true,
128
128
  args: [
129
- //'--no-sandbox',
130
- //'--ignore-certificate-errors',
131
- //'--allow-insecure-localhost',
132
- //'--headless'
133
- ]
134
- }
129
+ // '--no-sandbox',
130
+ // '--ignore-certificate-errors',
131
+ // '--allow-insecure-localhost',
132
+ // '--headless'
133
+ ],
134
+ },
135
135
  },
136
136
 
137
137
  webdriver: {
@@ -139,8 +139,8 @@ module.exports = {
139
139
  server_path: '',
140
140
  cli_args: [
141
141
  // --verbose
142
- ]
143
- }
142
+ ],
143
+ },
144
144
  },
145
145
 
146
146
  edge: {
@@ -150,9 +150,9 @@ module.exports = {
150
150
  w3c: true,
151
151
  // More info on EdgeDriver: https://docs.microsoft.com/en-us/microsoft-edge/webdriver-chromium/capabilities-edge-options
152
152
  args: [
153
- //'--headless'
154
- ]
155
- }
153
+ // '--headless'
154
+ ],
155
+ },
156
156
  },
157
157
 
158
158
  webdriver: {
@@ -162,16 +162,16 @@ module.exports = {
162
162
  server_path: '',
163
163
  cli_args: [
164
164
  // --verbose
165
- ]
166
- }
165
+ ],
166
+ },
167
167
  },
168
168
 
169
- //////////////////////////////////////////////////////////////////////////////////
169
+ /// ///////////////////////////////////////////////////////////////////////////////
170
170
  // Configuration for when using cucumber-js (https://cucumber.io) |
171
171
  // |
172
172
  // It uses the bundled examples inside the nightwatch examples folder; feel free |
173
173
  // to adapt this to your own project needs |
174
- //////////////////////////////////////////////////////////////////////////////////
174
+ /// ///////////////////////////////////////////////////////////////////////////////
175
175
  'cucumber-js': {
176
176
  src_folders: ['examples/cucumber-js/features/step_definitions'],
177
177
 
@@ -181,56 +181,56 @@ module.exports = {
181
181
 
182
182
  // define cucumber specific options
183
183
  options: {
184
- //set the feature path
185
- feature_path: 'node_modules/nightwatch/examples/cucumber-js/*/*.feature'
184
+ // set the feature path
185
+ feature_path: 'node_modules/nightwatch/examples/cucumber-js/*/*.feature',
186
186
 
187
187
  // start the webdriver session automatically (enabled by default)
188
188
  // auto_start_session: true
189
189
 
190
190
  // use parallel execution in Cucumber
191
191
  // parallel: 2 // set number of workers to use (can also be defined in the cli as --parallel 2
192
- }
193
- }
192
+ },
193
+ },
194
194
  },
195
195
 
196
- //////////////////////////////////////////////////////////////////////////////////
196
+ /// ///////////////////////////////////////////////////////////////////////////////
197
197
  // Configuration for when using the browserstack.com cloud service |
198
198
  // |
199
199
  // Please set the username and access key by setting the environment variables: |
200
200
  // - BROWSERSTACK_USER |
201
201
  // - BROWSERSTACK_KEY |
202
202
  // .env files are supported |
203
- //////////////////////////////////////////////////////////////////////////////////
203
+ /// ///////////////////////////////////////////////////////////////////////////////
204
204
  browserstack: {
205
205
  selenium: {
206
206
  host: 'hub-cloud.browserstack.com',
207
- port: 443
207
+ port: 443,
208
208
  },
209
209
  // More info on configuring capabilities can be found on:
210
210
  // https://www.browserstack.com/automate/capabilities?tag=selenium-4
211
211
  desiredCapabilities: {
212
212
  'bstack:options': {
213
213
  userName: '${BROWSERSTACK_USER}',
214
- accessKey: '${BROWSERSTACK_KEY}'
215
- }
214
+ accessKey: '${BROWSERSTACK_KEY}',
215
+ },
216
216
  },
217
217
 
218
218
  disable_error_log: true,
219
219
  webdriver: {
220
220
  timeout_options: {
221
221
  timeout: 15000,
222
- retry_attempts: 3
222
+ retry_attempts: 3,
223
223
  },
224
224
  keep_alive: true,
225
- start_process: false
226
- }
225
+ start_process: false,
226
+ },
227
227
  },
228
228
 
229
229
  'browserstack.local': {
230
230
  extends: 'browserstack',
231
231
  desiredCapabilities: {
232
- 'browserstack.local': true
233
- }
232
+ 'browserstack.local': true,
233
+ },
234
234
  },
235
235
 
236
236
  'browserstack.chrome': {
@@ -238,50 +238,50 @@ module.exports = {
238
238
  desiredCapabilities: {
239
239
  browserName: 'chrome',
240
240
  chromeOptions: {
241
- w3c: true
242
- }
243
- }
241
+ w3c: true,
242
+ },
243
+ },
244
244
  },
245
245
 
246
246
  'browserstack.firefox': {
247
247
  extends: 'browserstack',
248
248
  desiredCapabilities: {
249
- browserName: 'firefox'
250
- }
249
+ browserName: 'firefox',
250
+ },
251
251
  },
252
252
 
253
253
  'browserstack.ie': {
254
254
  extends: 'browserstack',
255
255
  desiredCapabilities: {
256
256
  browserName: 'internet explorer',
257
- browserVersion: '11.0'
258
- }
257
+ browserVersion: '11.0',
258
+ },
259
259
  },
260
260
 
261
261
  'browserstack.safari': {
262
262
  extends: 'browserstack',
263
263
  desiredCapabilities: {
264
- browserName: 'safari'
265
- }
264
+ browserName: 'safari',
265
+ },
266
266
  },
267
267
 
268
268
  'browserstack.local_chrome': {
269
269
  extends: 'browserstack.local',
270
270
  desiredCapabilities: {
271
- browserName: 'chrome'
272
- }
271
+ browserName: 'chrome',
272
+ },
273
273
  },
274
274
 
275
275
  'browserstack.local_firefox': {
276
276
  extends: 'browserstack.local',
277
277
  desiredCapabilities: {
278
- browserName: 'firefox'
279
- }
278
+ browserName: 'firefox',
279
+ },
280
280
  },
281
- //////////////////////////////////////////////////////////////////////////////////
281
+ /// ///////////////////////////////////////////////////////////////////////////////
282
282
  // Configuration for when using the Selenium service, either locally or remote, |
283
283
  // like Selenium Grid |
284
- //////////////////////////////////////////////////////////////////////////////////
284
+ /// ///////////////////////////////////////////////////////////////////////////////
285
285
  selenium_server: {
286
286
  // Selenium Server is running locally and is managed by Nightwatch
287
287
  selenium: {
@@ -290,9 +290,9 @@ module.exports = {
290
290
  server_path: (Services.seleniumServer ? Services.seleniumServer.path : ''),
291
291
  cli_args: {
292
292
  'webdriver.gecko.driver': (Services.geckodriver ? Services.geckodriver.path : ''),
293
- 'webdriver.chrome.driver': (Services.chromedriver ? Services.chromedriver.path : '')
294
- }
295
- }
293
+ 'webdriver.chrome.driver': (Services.chromedriver ? Services.chromedriver.path : ''),
294
+ },
295
+ },
296
296
  },
297
297
 
298
298
  'selenium.chrome': {
@@ -300,9 +300,9 @@ module.exports = {
300
300
  desiredCapabilities: {
301
301
  browserName: 'chrome',
302
302
  chromeOptions: {
303
- w3c: true
304
- }
305
- }
303
+ w3c: true,
304
+ },
305
+ },
306
306
  },
307
307
 
308
308
  'selenium.firefox': {
@@ -313,11 +313,11 @@ module.exports = {
313
313
  args: [
314
314
  // '-headless',
315
315
  // '-verbose'
316
- ]
317
- }
318
- }
319
- }
320
- }
316
+ ],
317
+ },
318
+ },
319
+ },
320
+ },
321
321
  };
322
322
 
323
323
  function loadServices() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "webship-js",
3
- "version": "1.0.6",
3
+ "version": "1.0.7",
4
4
  "description": "Webship JS automated functional testing.",
5
5
  "main": "index.js",
6
6
  "directories": {