webship-js 1.0.8 → 1.0.10

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.
@@ -0,0 +1,95 @@
1
+ version: 2.1
2
+ defaults: &defaults
3
+ docker:
4
+ - image: cimg/base:stable-20.04
5
+ auth:
6
+ username: mydockerhub-user
7
+ password: $DOCKERHUB_PASSWORD # context / project UI env-var reference
8
+ commands:
9
+ webship-js-build:
10
+ steps:
11
+ - checkout
12
+ ## Usefull must have utils.
13
+ - run:
14
+ name: Usefull must have utils
15
+ command: |
16
+ sudo apt -qq update
17
+ sudo apt -qqy upgrade
18
+ sudo apt -yqq install vim links lynx git diffutils htop curl wget p7zip-full unzip zip sed gcc g++ make libfreetype6-dev libaio1 libaio-dev libonig-dev libpng-dev
19
+ sudo apt -yqq install xvfb libasound2 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 libnss3
20
+ ## Configure and run the virtual display.
21
+ - run:
22
+ name: Configure and run the virtual display.
23
+ command: Xvfb -ac :99 -screen 0 1600x1200x24 > /dev/null 2>&1
24
+ background: true
25
+
26
+ ## Install node js, npm, yarn, and gulp
27
+ - run:
28
+ name: Install node js
29
+ command: |
30
+ curl -sL https://deb.nodesource.com/setup_16.x | sudo bash -
31
+ sudo apt install -y nodejs
32
+ sudo npm install -g yarn
33
+ ## Install Java.
34
+ - run:
35
+ name: Install Java
36
+ command: |
37
+ sudo apt update
38
+ sudo apt install -y openjdk-11-jre openjdk-11-jre-headless openjdk-11-jdk openjdk-11-jdk-headless
39
+ ## Install/Update Google Chrome browser.
40
+ - run:
41
+ name: Install/Update Google Chrome browser
42
+ command: |
43
+ sudo apt-get install libappindicator1 fonts-liberation libgbm1 libgtk-3-0 xdg-utils
44
+ export CHROME_BIN=/usr/bin/google-chrome
45
+ wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
46
+ sudo dpkg -i google-chrome-stable_current_amd64.deb
47
+ rm google-chrome-stable_current_amd64.deb
48
+ ## Install/Update Chrome Driver.
49
+ - run:
50
+ name: Install/Update Chrome Driver
51
+ command: |
52
+ CHROME_DRIVER_VERSION=$(wget -qO- chromedriver.storage.googleapis.com/LATEST_RELEASE);
53
+ echo $CHROME_DRIVER_VERSION;
54
+ wget http://chromedriver.storage.googleapis.com/$CHROME_DRIVER_VERSION/chromedriver_linux64.zip
55
+ unzip chromedriver_linux64.zip
56
+ sudo chmod +x chromedriver
57
+ sudo mv -f chromedriver /usr/bin/
58
+ rm chromedriver_linux64.zip
59
+
60
+ ## Setup Apache2
61
+ - run:
62
+ name: Setup Apache2
63
+ command: |
64
+ sudo apt install -yqq apache2
65
+ ## Run Selenium Standalone server.
66
+ - run:
67
+ name: Run Selenium Standalone server
68
+ command: |
69
+ if [[ ! -f /home/circleci/selenium-server-standalone-3.141.59.jar ]]; then wget -O /home/circleci/selenium-server-standalone-3.141.59.jar https://github.com/SeleniumHQ/selenium/releases/download/selenium-3.141.59/selenium-server-standalone-3.141.59.jar; fi
70
+ cd /home/circleci/
71
+ java -jar selenium-server-standalone-3.141.59.jar -port 4444
72
+ background: true
73
+
74
+ jobs:
75
+ webship-js-testing:
76
+ <<: *defaults
77
+ steps:
78
+ - webship-js-build
79
+ ## Automated Functional Acceptance Testing
80
+ - run:
81
+ name: Automated Functional Acceptance Testing
82
+ no_output_timeout: 30m
83
+ command: |
84
+ yarn install
85
+ yarn test
86
+ workflows:
87
+ version: 2
88
+ webship-js-workflow:
89
+ jobs:
90
+ - webship-js-testing:
91
+ filters:
92
+ tags:
93
+ only: /^1.0.*/
94
+ branches:
95
+ only: /^1.0.x/
package/.eslintignore ADDED
@@ -0,0 +1,3 @@
1
+ node_modules
2
+ nightwatch.conf.js
3
+ tests_output
package/.eslintrc.json ADDED
@@ -0,0 +1,34 @@
1
+ {
2
+ "extends": [
3
+ "airbnb-base"
4
+ ],
5
+ "root": true,
6
+ "env": {
7
+ "browser": true,
8
+ "node": true
9
+ },
10
+ "globals": {
11
+ "loadjs": true
12
+ },
13
+ "rules": {
14
+ "consistent-return": ["off"],
15
+ "no-underscore-dangle": ["off"],
16
+ "max-nested-callbacks": ["warn", 5],
17
+ "import/no-mutable-exports": ["warn"],
18
+ "no-console": ["off"],
19
+ "no-plusplus": ["warn", {
20
+ "allowForLoopAfterthoughts": true
21
+ }],
22
+ "no-param-reassign": ["off"],
23
+ "no-prototype-builtins": ["off"],
24
+ "valid-jsdoc": ["warn", {
25
+ "prefer": {
26
+ "returns": "return",
27
+ "property": "prop"
28
+ },
29
+ "requireReturn": false
30
+ }],
31
+ "no-unused-vars": ["warn"],
32
+ "operator-linebreak": ["error", "after", { "overrides": { "?": "ignore", ":": "ignore" } }]
33
+ }
34
+ }
@@ -0,0 +1,28 @@
1
+ name: Github Actions
2
+
3
+ on: [push]
4
+
5
+ jobs:
6
+ build:
7
+
8
+ runs-on: ubuntu-latest
9
+
10
+ env:
11
+ TEST_BASE_URL: https://webship.co
12
+ SELENIUM_HOST: http://selenium:4444/wd/hub
13
+
14
+ services:
15
+ selenium:
16
+ image: selenium/standalone-chrome
17
+ # options: --health-cmd "curl http://selenium:4444" --health-interval=5s
18
+ ports:
19
+ - 4444:4444
20
+
21
+ steps:
22
+ - uses: actions/checkout@v3
23
+ - name: Use Node.js
24
+ uses: actions/setup-node@v3
25
+ with:
26
+ node-version: '16.x'
27
+ - run: yarn install
28
+ - run: yarn test
package/.gitlab-ci.yml ADDED
@@ -0,0 +1,51 @@
1
+ image: node:16
2
+
3
+ stages:
4
+ - check
5
+
6
+ check:
7
+ stage: check
8
+ script:
9
+ # Dependencies for chromedriver, https://gist.github.com/mikesmullin/2636776#gistcomment-1742414
10
+ # Otherwise we get this error: "error while loading shared libraries: libnss3.so: cannot open shared object file: No such file or directory"
11
+ - apt-get update -q -y
12
+ - apt-get --yes install libnss3
13
+ - apt-get --yes install libgconf-2-4
14
+
15
+ # Install chrome
16
+ # Based off of
17
+ # - https://gitlab.com/gitlab-org/gitlab-build-images/blob/9dadb28021f15913a49897126a0cd6ab0149e44f/scripts/install-chrome
18
+ # - https://askubuntu.com/a/510186/196148
19
+ #
20
+ # Add key
21
+ - curl -sS -L https://dl.google.com/linux/linux_signing_key.pub | apt-key add -
22
+ # Add repo
23
+ - echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" > /etc/apt/sources.list.d/google.list
24
+ - apt-get update -q -y
25
+ - apt-get install -y google-chrome-stable
26
+
27
+ - npm install chromedriver -g
28
+ - npm install nightwatch -g
29
+ - npm install https://gitlab.com/gitlab-org/gitlab-selenium-server.git -g
30
+ - which chromedriver
31
+ # The `&` at the end causes it to run in the background and not block the following commands
32
+ - nohup chromedriver --port=4444 --url-base=wd/hub &
33
+ - nohup gitlab-selenium-server &
34
+ # Install cucumber & pretty formatter .
35
+ - npm i @cucumber/cucumber
36
+ - npm i @cucumber/pretty-formatter
37
+
38
+ # Run your tests
39
+ - npm test
40
+
41
+ # Show the logs for the GitLab Selenium Server service
42
+ - mkdir -p selenium/ && curl -s http://localhost:4545/logs.tar.gz | tar -xvzf - -C selenium/
43
+ - mkdir -p selenium/ && curl http://localhost:4545/server-log --output selenium/server-log.txt
44
+ artifacts:
45
+ when: always
46
+ paths:
47
+ - selenium/
48
+ variables:
49
+ SELENIUM_REMOTE_URL: http://localhost:4545/wd/hub
50
+ GITLAB_TARGET_SELENIUM_REMOTE_URL: http://localhost:4444/wd/hub
51
+
package/.travis-ci.yml ADDED
@@ -0,0 +1,27 @@
1
+ dist: trusty
2
+ language: java
3
+
4
+ jdk:
5
+ - openjdk-11-jre
6
+
7
+ before_script:
8
+ - docker run -d -p 4444:4444 -v /dev/shm:/dev/shm selenium/standalone-firefox:4.0.0-rc-1-prerelease-20210618
9
+ - docker ps
10
+
11
+ script:
12
+ - mvn clean install -DsuiteXmlFile=testng.xml -Dbrowser=GRID_FIREFOX -DgridHubURL=http://localhost:4444/wd/hub
13
+
14
+ cache:
15
+ directories:
16
+ - .autoconf
17
+ - $HOME/.m2
18
+
19
+ deploy:
20
+ provider: releases
21
+ api_key: ${api_key}
22
+ skip_cleanup: true
23
+ file: [ "target/surefire-reports/emailable-report.html",
24
+ "target/surefire-reports/index.html" ]
25
+ on:
26
+ all_branches: true
27
+ tags: false
@@ -0,0 +1,34 @@
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
+ - pull selenium/hub:latest
15
+ - pull selenium/standalone-chrome
16
+ - run java -jar selenium-server-standalone-3.141.59.jar -port 4444
17
+ services:
18
+ - docker
19
+ caches:
20
+ - node
21
+ - step:
22
+ name: Build and Test
23
+ caches:
24
+ - node
25
+ script:
26
+ - npm install
27
+ - npm test
28
+ - step:
29
+ name: Code linting
30
+ script:
31
+ - npm install eslint
32
+ - npx eslint .
33
+ caches:
34
+ - node
@@ -0,0 +1,335 @@
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: 'https://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
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "webship-js",
3
- "version": "1.0.8",
3
+ "version": "1.0.10",
4
4
  "description": "Webship JS automated functional testing.",
5
5
  "main": "index.js",
6
6
  "directories": {
@@ -18,29 +18,26 @@
18
18
  "type": "git",
19
19
  "url": "git+https://github.com/webship/webship-js.git"
20
20
  },
21
- "author": "Webship.org",
21
+ "author": "Webship.co",
22
22
  "license": "MIT",
23
23
  "bugs": {
24
24
  "url": "https://github.com/webship/webship-js/issues"
25
25
  },
26
26
  "homepage": "https://github.com/webship/webship-js",
27
27
  "dependencies": {
28
+ "nightwatch": "~2.0",
28
29
  "@cucumber/cucumber": "*",
29
30
  "@cucumber/pretty-formatter": "^1.0.0-alpha.2",
30
- "args-parser": "^1.3.0",
31
+ "args-parser": "~1.0",
31
32
  "eslint": "~8.0",
32
- "eslint-config-airbnb-base": "^15.0.0",
33
- "eslint-plugin-import": "^2.25.4",
34
- "nightwatch": "^2.1.7"
33
+ "eslint-config-airbnb-base": "~15.0",
34
+ "eslint-plugin-import": "~2.25"
35
35
  },
36
36
  "devDependencies": {
37
37
  "chromedriver": "*",
38
38
  "geckodriver": "*"
39
39
  },
40
- "files": [
41
- "bin/"
42
- ],
43
40
  "bin": {
44
- "steplist": "./bin/steplist.js"
41
+ "steplist": "./steplist.js"
45
42
  }
46
43
  }