webship-js 1.0.3 → 1.0.4

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,36 @@
1
+ image: node:16
2
+ pipelines:
3
+ branches:
4
+ 1.0.x:
5
+ - step:
6
+ name: "Webship-js CI"
7
+ caches:
8
+ - node
9
+ script:
10
+ - npm install
11
+ - npm run http://selenium:4444/wd/hub --host=selenium__standalone-chrome
12
+ - yarn install
13
+ - yarn test
14
+ - parallel:
15
+ - step:
16
+ name: "Selenium Tests"
17
+ caches:
18
+ - node
19
+ services:
20
+ - hub
21
+ - chrome
22
+ script:
23
+ - ./vendor/bin/phpunit --testsuite=selenium --cache-result-file=app/cache/.phpunit.result.cache
24
+ definitions:
25
+ caches:
26
+ - node
27
+ services:
28
+ hub:
29
+ image: selenium/hub
30
+ environment:
31
+ BROWSER: chrome
32
+ chrome:
33
+ image: selenium/node-chrome:3.141.5
34
+ environment:
35
+ HUB_PORT_4444_TCP_ADDR: 127.0.0.1
36
+ HUB_PORT_4444_TCP_PORT: "4444"
@@ -0,0 +1,102 @@
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
+
21
+ ## Configure and run the virtual display.
22
+ - run:
23
+ name: Configure and run the virtual display.
24
+ command: Xvfb -ac :99 -screen 0 1600x1200x24 > /dev/null 2>&1
25
+ background: true
26
+
27
+ ## Install node js, npm, yarn, and gulp
28
+ - run:
29
+ name: Install node js
30
+ command: |
31
+ curl -sL https://deb.nodesource.com/setup_16.x | sudo bash -
32
+ sudo apt install -y nodejs
33
+ sudo npm install -g yarn
34
+
35
+ ## Install Java.
36
+ - run:
37
+ name: Install Java
38
+ command: |
39
+ sudo apt update
40
+ sudo apt install -y openjdk-11-jre openjdk-11-jre-headless openjdk-11-jdk openjdk-11-jdk-headless
41
+
42
+ ## Install/Update Google Chrome browser.
43
+ - run:
44
+ name: Install/Update Google Chrome browser
45
+ command: |
46
+ sudo apt-get install libappindicator1 fonts-liberation libgbm1 libgtk-3-0 xdg-utils
47
+ export CHROME_BIN=/usr/bin/google-chrome
48
+ wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
49
+ sudo dpkg -i google-chrome-stable_current_amd64.deb
50
+ rm google-chrome-stable_current_amd64.deb
51
+
52
+ ## Install/Update Chrome Driver.
53
+ - run:
54
+ name: Install/Update Chrome Driver
55
+ command: |
56
+ CHROME_DRIVER_VERSION=$(wget -qO- chromedriver.storage.googleapis.com/LATEST_RELEASE);
57
+ echo $CHROME_DRIVER_VERSION;
58
+ wget http://chromedriver.storage.googleapis.com/$CHROME_DRIVER_VERSION/chromedriver_linux64.zip
59
+ unzip chromedriver_linux64.zip
60
+ sudo chmod +x chromedriver
61
+ sudo mv -f chromedriver /usr/bin/
62
+ rm chromedriver_linux64.zip
63
+
64
+ ## Setup Apache2
65
+ - run:
66
+ name: Setup Apache2
67
+ command: |
68
+ sudo apt install -yqq apache2
69
+
70
+ ## Run Selenium Standalone server.
71
+ - run:
72
+ name: Run Selenium Standalone server
73
+ command: |
74
+ 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
75
+ cd /home/circleci/
76
+ java -jar selenium-server-standalone-3.141.59.jar -port 4444
77
+ background: true
78
+
79
+ jobs:
80
+ webship-js-testing:
81
+ <<: *defaults
82
+ steps:
83
+ - webship-js-build
84
+ ## Automated Functional Acceptance Testing
85
+ - run:
86
+ name: Automated Functional Acceptance Testing
87
+ no_output_timeout: 30m
88
+ command: |
89
+ yarn install
90
+ yarn test
91
+
92
+ workflows:
93
+ version: 2
94
+ webship-js-workflow:
95
+ jobs:
96
+ - webship-js-testing:
97
+ filters:
98
+ tags:
99
+ only: /^1.0.*/
100
+ branches:
101
+ only: /^1.0.x/
102
+
@@ -1,4 +1,4 @@
1
- name: Webship-js CI
1
+ name: Github Actions
2
2
 
3
3
  on: [push]
4
4
 
package/.gitlab-ci.yml CHANGED
@@ -1,28 +1,51 @@
1
- image: node:8.10
1
+ image: node:16
2
+
2
3
  stages:
3
- - deploy
4
- - confidence-check
5
- deploy_terraform:
6
- stage: deploy
4
+ - check
5
+
6
+ check:
7
+ stage: check
7
8
  script:
8
- # Your Review App deployment scripts - for a working example please check https://gitlab.com/Flockademic/Flockademic/blob/5a45f1c2412e93810fab50e2dab8949e2d0633c7/.gitlab-ci.yml#L315
9
- - echo
10
- e2e:firefox:
11
- stage: confidence-check
12
- services:
13
- - selenium/standalone-firefox
14
- script:
15
- - npm run confidence-check --host=selenium__standalone-firefox
16
- e2e:chrome:
17
- stage: confidence-check
18
- services:
19
- - selenium/standalone-chrome
20
- script:
21
- - npm run confidence-check --host=selenium__standalone-chrome
22
-
23
- test:
24
- stage: test
25
- dependencies:
26
- - npm
27
- script:
28
- - npm test
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
package/README.md CHANGED
@@ -1,10 +1,74 @@
1
1
  # Webship JS
2
2
 
3
- [![Webship-js CI](https://github.com/webship/webship-js/actions/workflows/github-actions.yml/badge.svg?branch=1.0.x)](https://github.com/webship/webship-js/actions)
4
-
3
+ [![Github Actions](https://github.com/webship/webship-js/actions/workflows/github-actions.yml/badge.svg?branch=1.0.x)](https://github.com/webship/webship-js/actions)
4
+ [![CircleCI](https://circleci.com/gh/webship/webship-js/tree/1.0.x.svg?style=svg)](https://circleci.com/gh/webship/webship-js/tree/1.0.x) CircleCI
5
+ [![Gitlab CI](https://gitlab.com/webship/webship-js/badges/1.0.x/pipeline.svg?job=karma&key_text=Gitlab+CI&key_width=60)](https://gitlab.com/webship/webship-js/-/pipelines)
5
6
 
6
7
  Webship JS has a ready step definitions for automated functional testing.
7
8
 
8
9
  ### Using:
9
10
  * Nightwatch.js
10
11
  * Cucumber-js
12
+
13
+
14
+ ### Webship-js Documentations
15
+ All you need to know about [webship-js Docs](https://webship.gitbook.io/webship-js-docs/).
16
+
17
+
18
+ ## How to install using NPM
19
+
20
+ ```
21
+ npm i webship-js
22
+ ```
23
+
24
+ ## How to install using Yarn
25
+
26
+ ```
27
+ yarn i webship-js
28
+ ```
29
+
30
+ ## How to configure your project to test using webship-js steps
31
+
32
+ ### Install node js and yarn
33
+
34
+ ```
35
+ sudo apt install nodejs
36
+ sudo npm install yarn
37
+ ```
38
+
39
+ ### Install Java
40
+
41
+ ```
42
+ sudo apt install java
43
+ ```
44
+
45
+ ### Download Latest Chrome Driver
46
+
47
+ ```
48
+ CHROME_DRIVER_VERSION=$(wget -qO- chromedriver.storage.googleapis.com/LATEST_RELEASE);
49
+ echo $CHROME_DRIVER_VERSION;
50
+ wget http://chromedriver.storage.googleapis.com/$CHROME_DRIVER_VERSION/chromedriver_linux64.zip
51
+ unzip chromedriver_linux64.zip
52
+ chmod +x chromedriver
53
+ mkdir -p $HOME/.composer/vendor/bin
54
+ mv -f chromedriver $HOME/.composer/vendor/bin/
55
+ rm chromedriver_linux64.zip
56
+ ```
57
+
58
+ ### Install/Update Chrome Driver
59
+
60
+ ```
61
+ export CHROME_BIN=/usr/bin/google-chrome
62
+ wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
63
+ sudo apt-get clean
64
+ sudo apt-get update
65
+ sudo apt-get install dpkg
66
+ sudo dpkg -i google-chrome-stable_current_amd64.deb
67
+ rm google-chrome-stable_current_amd64.deb
68
+ google-chrome --version
69
+ ```
70
+
71
+ ### Run selenium standalone server
72
+
73
+
74
+
@@ -40,7 +40,7 @@ module.exports = {
40
40
 
41
41
  test_settings: {
42
42
  default: {
43
- launch_url: "http://webshipjs.test",
43
+ launch_url: "http://webship.co",
44
44
  selenium_port: 4444,
45
45
  selenium_host: "127.0.0.1",
46
46
  silent: true,
@@ -57,6 +57,7 @@ module.exports = {
57
57
  // w3c:false tells Chromedriver to run using the legacy JSONWire protocol (not required in Chrome 78)
58
58
  w3c: false,
59
59
  args: [
60
+ '--headless',
60
61
  '--start-maximized',
61
62
  '--disable-gpu',
62
63
  '--window-size=1600,1200',
@@ -72,8 +73,8 @@ module.exports = {
72
73
  '--incognito',
73
74
  '--disable-infobars',
74
75
  '--remote-debugging-port=9222',
75
- '--allowed-ips=159.89.4.58',
76
- '--whitelisted-ips=159.89.4.58',
76
+ '--allowed-ips=*',
77
+ '--whitelisted-ips=*',
77
78
  '--allow-insecure-localhost'
78
79
  ]
79
80
  }
package/package.json CHANGED
@@ -1,13 +1,15 @@
1
1
  {
2
2
  "name": "webship-js",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "description": "Webship JS automated functional testing.",
5
5
  "main": "index.js",
6
6
  "directories": {
7
7
  "test": "test"
8
8
  },
9
9
  "scripts": {
10
- "test": "nightwatch --format @cucumber/pretty-formatter --format json:./tests/reports/cucumber-report-$( date '+%Y-%m-%d_%H-%M' ).json --format html:./tests/reports/cucumber-report-$( date '+%Y-%m-%d_%H-%M' ).html"
10
+
11
+ "test": "nightwatch --format @cucumber/pretty-formatter --format-options '{\"colorsEnabled\": true}' --format-options '{\"theme\": {\"feature keyword\":[\"bold\",\"blue\"],\"feature name\":[\"blue\",\"underline\"],\"feature description\":[\"blueBright\"],\"scenario keyword\":[\"bold\",\"magenta\"],\"scenario name\":[\"magenta\",\"underline\"],\"step keyword\":[\"bold\",\"green\"],\"step text\":[\"greenBright\",\"italic\"]}}' --format json:./tests/reports/cucumber-report-$( date '+%Y-%m-%d_%H-%M' ).json --format html:./tests/reports/cucumber-report-$( date '+%Y-%m-%d_%H-%M' ).html"
12
+
11
13
  },
12
14
  "repository": {
13
15
  "type": "git",