webship-js 1.0.6 → 1.0.8

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.
@@ -1,128 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- const fs = require('fs');
4
- const conf = require('../nightwatch.conf.js');
5
-
6
- /**
7
- * Folders Path Array variable
8
- *
9
- * Set and Get folders path exist in (--config) tag and
10
- * (--src_folder) tag added in nodejs command line
11
- */
12
- let foldersPath = [];
13
- function setFoldersPath(value) {
14
- value.forEach((element) => {
15
- foldersPath.push(element);
16
- });
17
- }
18
-
19
- /**
20
- * Output Format name variable
21
- *
22
- * Set and Get Output Format exist in (--format) tag added
23
- * in nodejs command line
24
- */
25
- let outputFormat = 'stdout-spaces';
26
- function setOutputFormat(value) { outputFormat = value; }
27
-
28
- /**
29
- * Start with Function.
30
- *
31
- * Return list of array items that start with (Given, Then, When).
32
- *
33
- * @param {array} stepsList The full step-definitions file lines list
34
- * @return {array} The array has only lines startsWith words chosen
35
- */
36
- function startWith(stepsList) {
37
- return (stepsList.startsWith('Given') ||
38
- stepsList.startsWith('Then') ||
39
- stepsList.startsWith('When'));
40
- }
41
-
42
- /**
43
- * Filter Step Definitions
44
- *
45
- * @param {array} stepsList The step definitions array is sent to filter
46
- * by startsWith words chosen
47
- * @return {array} Step definitions filtered array
48
- */
49
- function callStartsWith(stepsList) {
50
- return stepsList.filter(startWith);
51
- }
52
-
53
- /**
54
- * Clean Steps List
55
- *
56
- * Return list of array items cleand from unreadable chars
57
- *
58
- * @param {array} stepsList The step definitions array before clean
59
- * unreadable signs
60
- * @return {array} The step definitions cleaned array
61
- */
62
- function stepsCleanList(stepsList) {
63
- const newStepsList = [];
64
-
65
- stepsList.forEach((element) => {
66
- const filter1 = element.split('$/');
67
- const filter2 = filter1[0].replace('(/^', ' ');
68
-
69
- newStepsList.push(filter2);
70
- });
71
- return newStepsList;
72
- }
73
-
74
- function srcFolderPaths(path) {
75
- const splitConfig = path.split('=');
76
- const pathsLine = splitConfig[1];
77
- const paths = pathsLine.split(' ');
78
-
79
- setFoldersPath(paths);
80
- }
81
-
82
- for (let i = 2; i < process.argv.length; i++) {
83
- if (process.argv[i].startsWith('--config')) {
84
- const splitConfig = process.argv[i].split('=');
85
- const path = splitConfig[1];
86
- const configPath = require(path);
87
-
88
- let configPathsArray = [];
89
- configPathsArray = configPath.src_folders;
90
-
91
- setFoldersPath(configPathsArray);
92
- } else if (process.argv[i].startsWith('--src_folders')) {
93
- srcFolderPaths(process.argv[i]);
94
- } else if (process.argv[i].startsWith('--format')) {
95
- setOutputFormat(process.argv[i].split('=')[1]);
96
- }
97
- }
98
-
99
- if (foldersPath.length === 0) foldersPath = conf.src_folders;
100
-
101
- foldersPath.forEach((folderPath) => {
102
- fs.readdir(folderPath, (err, files) => {
103
- if (err) {
104
- return console.log(`Unable to scan directory: ${err}`);
105
- }
106
-
107
- files.forEach((file) => {
108
- fs.readFile(`./${folderPath}/${file}`, 'utf8', (err, data) => {
109
- if (err) {
110
- throw new Error(err);
111
- }
112
- const contentLines = data.split('\n');
113
- const contentTrimmed = contentLines.map((element) => element.trim());
114
-
115
- const stepsStartWith = callStartsWith(contentTrimmed);
116
- const stepsList = stepsCleanList(stepsStartWith);
117
-
118
- stepsList.forEach((element) => {
119
- if (outputFormat.startsWith('stdout')) {
120
- console.log(element);
121
- } else if (outputFormat.startsWith('html')) {
122
- console.log(`<div>${element}</div>`);
123
- } else { console.log(element); }
124
- });
125
- });
126
- });
127
- });
128
- });
@@ -1,37 +0,0 @@
1
- # Template NodeJS build
2
-
3
- # This template allows you to validate your NodeJS code.
4
- # The workflow allows running tests and code linting on the default branch.
5
-
6
- image: node:16
7
-
8
- pipelines:
9
- default:
10
- - parallel:
11
- - step:
12
- name: selenium linting
13
- script:
14
- - docker version
15
- - docker pull selenium/hub:latest
16
- - docker pull selenium/standalone-chrome
17
- - docker run -d -p 4444:4444 --name selenium-hub selenium/hub
18
- - docker run --link selenium-hub:hub selenium/node-chrome
19
- - chmod +x $DRIVERPATH
20
- - mvn compiler:compile test allure:report
21
- services:
22
- - docker
23
- caches:
24
- - node
25
- - step:
26
- name: Build and Test
27
- max-time: 3
28
- script:
29
- - sleep 1m
30
- - yarn install
31
- - yarn run test
32
- caches:
33
- - node
34
-
35
-
36
- options:
37
- docker: true
@@ -1,335 +0,0 @@
1
- const Services = {}; loadServices();
2
-
3
- // _ _ _ _ _ _ _
4
- // | \ | |(_) | | | | | | | |
5
- // | \| | _ __ _ | |__ | |_ __ __ __ _ | |_ ___ | |__
6
- // | . ` || | / _` || '_ \ | __|\ \ /\ / / / _` || __| / __|| '_ \
7
- // | |\ || || (_| || | | || |_ \ V V / | (_| || |_ | (__ | | | |
8
- // \_| \_/|_| \__, ||_| |_| \__| \_/\_/ \__,_| \__| \___||_| |_|
9
- // __/ |
10
- // |___/
11
-
12
- module.exports = {
13
- // An array of folders (excluding subfolders) where your tests are located;
14
- // if this is not specified, the test source must be passed as the second argument to the test runner.
15
- src_folders: ['tests/step-definitions'],
16
-
17
- // See https://nightwatchjs.org/guide/working-with-page-objects/
18
- page_objects_path: '',
19
-
20
- // See https://nightwatchjs.org/guide/extending-nightwatch/#writing-custom-commands
21
- custom_commands_path: '',
22
-
23
- // See https://nightwatchjs.org/guide/extending-nightwatch/#writing-custom-assertions
24
- custom_assertions_path: '',
25
-
26
- // See https://nightwatchjs.org/guide/#external-globals
27
- globals_path: '',
28
-
29
- webdriver: {},
30
-
31
- test_runner: {
32
- type: 'cucumber',
33
- options: {
34
- feature_path: 'tests/features/*.feature',
35
- additional_config: '',
36
- parallel: 2
37
- }
38
-
39
- },
40
-
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"
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
- ]
80
- }
81
- }
82
- },
83
-
84
- safari: {
85
- desiredCapabilities: {
86
- browserName: 'safari',
87
- alwaysMatch: {
88
- acceptInsecureCerts: false
89
- }
90
- },
91
- webdriver: {
92
- start_process: true,
93
- server_path: ''
94
- }
95
- },
96
-
97
- firefox: {
98
- desiredCapabilities: {
99
- browserName: 'firefox',
100
- alwaysMatch: {
101
- acceptInsecureCerts: true,
102
- 'moz:firefoxOptions': {
103
- args: [
104
- // '-headless',
105
- // '-verbose'
106
- ]
107
- }
108
- }
109
- },
110
- webdriver: {
111
- start_process: true,
112
- server_path: '',
113
- cli_args: [
114
- // very verbose geckodriver logs
115
- // '-vv'
116
- ]
117
- }
118
- },
119
-
120
- chrome: {
121
- desiredCapabilities: {
122
- browserName: 'chrome',
123
- 'goog:chromeOptions': {
124
- // More info on Chromedriver: https://sites.google.com/a/chromium.org/chromedriver/
125
- //
126
- // w3c:false tells Chromedriver to run using the legacy JSONWire protocol (not required in Chrome 78)
127
- w3c: true,
128
- args: [
129
- //'--no-sandbox',
130
- //'--ignore-certificate-errors',
131
- //'--allow-insecure-localhost',
132
- //'--headless'
133
- ]
134
- }
135
- },
136
-
137
- webdriver: {
138
- start_process: true,
139
- server_path: '',
140
- cli_args: [
141
- // --verbose
142
- ]
143
- }
144
- },
145
-
146
- edge: {
147
- desiredCapabilities: {
148
- browserName: 'MicrosoftEdge',
149
- 'ms:edgeOptions': {
150
- w3c: true,
151
- // More info on EdgeDriver: https://docs.microsoft.com/en-us/microsoft-edge/webdriver-chromium/capabilities-edge-options
152
- args: [
153
- //'--headless'
154
- ]
155
- }
156
- },
157
-
158
- webdriver: {
159
- start_process: true,
160
- // Download msedgedriver from https://docs.microsoft.com/en-us/microsoft-edge/webdriver-chromium/
161
- // and set the location below:
162
- server_path: '',
163
- cli_args: [
164
- // --verbose
165
- ]
166
- }
167
- },
168
-
169
- //////////////////////////////////////////////////////////////////////////////////
170
- // Configuration for when using cucumber-js (https://cucumber.io) |
171
- // |
172
- // It uses the bundled examples inside the nightwatch examples folder; feel free |
173
- // to adapt this to your own project needs |
174
- //////////////////////////////////////////////////////////////////////////////////
175
- 'cucumber-js': {
176
- src_folders: ['examples/cucumber-js/features/step_definitions'],
177
-
178
- test_runner: {
179
- // set cucumber as the runner
180
- type: 'cucumber',
181
-
182
- // define cucumber specific options
183
- options: {
184
- //set the feature path
185
- feature_path: 'node_modules/nightwatch/examples/cucumber-js/*/*.feature'
186
-
187
- // start the webdriver session automatically (enabled by default)
188
- // auto_start_session: true
189
-
190
- // use parallel execution in Cucumber
191
- // parallel: 2 // set number of workers to use (can also be defined in the cli as --parallel 2
192
- }
193
- }
194
- },
195
-
196
- //////////////////////////////////////////////////////////////////////////////////
197
- // Configuration for when using the browserstack.com cloud service |
198
- // |
199
- // Please set the username and access key by setting the environment variables: |
200
- // - BROWSERSTACK_USER |
201
- // - BROWSERSTACK_KEY |
202
- // .env files are supported |
203
- //////////////////////////////////////////////////////////////////////////////////
204
- browserstack: {
205
- selenium: {
206
- host: 'hub-cloud.browserstack.com',
207
- port: 443
208
- },
209
- // More info on configuring capabilities can be found on:
210
- // https://www.browserstack.com/automate/capabilities?tag=selenium-4
211
- desiredCapabilities: {
212
- 'bstack:options': {
213
- userName: '${BROWSERSTACK_USER}',
214
- accessKey: '${BROWSERSTACK_KEY}'
215
- }
216
- },
217
-
218
- disable_error_log: true,
219
- webdriver: {
220
- timeout_options: {
221
- timeout: 15000,
222
- retry_attempts: 3
223
- },
224
- keep_alive: true,
225
- start_process: false
226
- }
227
- },
228
-
229
- 'browserstack.local': {
230
- extends: 'browserstack',
231
- desiredCapabilities: {
232
- 'browserstack.local': true
233
- }
234
- },
235
-
236
- 'browserstack.chrome': {
237
- extends: 'browserstack',
238
- desiredCapabilities: {
239
- browserName: 'chrome',
240
- chromeOptions: {
241
- w3c: true
242
- }
243
- }
244
- },
245
-
246
- 'browserstack.firefox': {
247
- extends: 'browserstack',
248
- desiredCapabilities: {
249
- browserName: 'firefox'
250
- }
251
- },
252
-
253
- 'browserstack.ie': {
254
- extends: 'browserstack',
255
- desiredCapabilities: {
256
- browserName: 'internet explorer',
257
- browserVersion: '11.0'
258
- }
259
- },
260
-
261
- 'browserstack.safari': {
262
- extends: 'browserstack',
263
- desiredCapabilities: {
264
- browserName: 'safari'
265
- }
266
- },
267
-
268
- 'browserstack.local_chrome': {
269
- extends: 'browserstack.local',
270
- desiredCapabilities: {
271
- browserName: 'chrome'
272
- }
273
- },
274
-
275
- 'browserstack.local_firefox': {
276
- extends: 'browserstack.local',
277
- desiredCapabilities: {
278
- browserName: 'firefox'
279
- }
280
- },
281
- //////////////////////////////////////////////////////////////////////////////////
282
- // Configuration for when using the Selenium service, either locally or remote, |
283
- // like Selenium Grid |
284
- //////////////////////////////////////////////////////////////////////////////////
285
- selenium_server: {
286
- // Selenium Server is running locally and is managed by Nightwatch
287
- selenium: {
288
- start_process: true,
289
- port: 4444,
290
- server_path: (Services.seleniumServer ? Services.seleniumServer.path : ''),
291
- cli_args: {
292
- 'webdriver.gecko.driver': (Services.geckodriver ? Services.geckodriver.path : ''),
293
- 'webdriver.chrome.driver': (Services.chromedriver ? Services.chromedriver.path : '')
294
- }
295
- }
296
- },
297
-
298
- 'selenium.chrome': {
299
- extends: 'selenium_server',
300
- desiredCapabilities: {
301
- browserName: 'chrome',
302
- chromeOptions: {
303
- w3c: true
304
- }
305
- }
306
- },
307
-
308
- 'selenium.firefox': {
309
- extends: 'selenium_server',
310
- desiredCapabilities: {
311
- browserName: 'firefox',
312
- 'moz:firefoxOptions': {
313
- args: [
314
- // '-headless',
315
- // '-verbose'
316
- ]
317
- }
318
- }
319
- }
320
- }
321
- };
322
-
323
- function loadServices() {
324
- try {
325
- Services.seleniumServer = require('selenium-server');
326
- } catch (err) {}
327
-
328
- try {
329
- Services.chromedriver = require('chromedriver');
330
- } catch (err) {}
331
-
332
- try {
333
- Services.geckodriver = require('geckodriver');
334
- } catch (err) {}
335
- }
@@ -1,8 +0,0 @@
1
- Feature: Example test for webship-js
2
- As a tester
3
- I want to be able to test the webship.co site
4
- So that I know it is working
5
-
6
- Scenario: Check the webship.co site
7
- Given I go to "https://webship.co"
8
- Then I should see "Webship.co"