webship-js 1.0.1 → 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.
- package/.bitbucket-pipelines.yml +36 -0
- package/.circleci/config.yml +102 -0
- package/.github/workflows/github-actions.yml +28 -0
- package/.gitlab-ci.yml +51 -0
- package/.travis-ci.yml +27 -0
- package/README.md +68 -1
- package/nightwatch.conf.js +40 -18
- package/package.json +9 -5
- package/tests/reports/cucumber-report.html +48 -0
- package/tests/reports/cucumber-report.json +66 -0
|
@@ -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
|
+
|
|
@@ -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
|
package/README.md
CHANGED
|
@@ -1,7 +1,74 @@
|
|
|
1
1
|
# Webship JS
|
|
2
2
|
|
|
3
|
+
[](https://github.com/webship/webship-js/actions)
|
|
4
|
+
[](https://circleci.com/gh/webship/webship-js/tree/1.0.x) CircleCI
|
|
5
|
+
[](https://gitlab.com/webship/webship-js/-/pipelines)
|
|
6
|
+
|
|
3
7
|
Webship JS has a ready step definitions for automated functional testing.
|
|
4
8
|
|
|
5
9
|
### Using:
|
|
6
10
|
* Nightwatch.js
|
|
7
|
-
* Cucumber-js
|
|
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
|
+
|
package/nightwatch.conf.js
CHANGED
|
@@ -39,26 +39,48 @@ module.exports = {
|
|
|
39
39
|
},
|
|
40
40
|
|
|
41
41
|
test_settings: {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
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
|
+
}
|
|
54
82
|
},
|
|
55
83
|
|
|
56
|
-
webdriver: {
|
|
57
|
-
start_process: true,
|
|
58
|
-
server_path: ''
|
|
59
|
-
}
|
|
60
|
-
},
|
|
61
|
-
|
|
62
84
|
safari: {
|
|
63
85
|
desiredCapabilities: {
|
|
64
86
|
browserName: 'safari',
|
package/package.json
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "webship-js",
|
|
3
|
-
"version": "1.0.
|
|
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
|
-
|
|
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",
|
|
@@ -20,10 +22,12 @@
|
|
|
20
22
|
},
|
|
21
23
|
"homepage": "https://github.com/webship/webship-js",
|
|
22
24
|
"dependencies": {
|
|
23
|
-
"nightwatch": "~2",
|
|
24
25
|
"@cucumber/cucumber": "*",
|
|
25
26
|
"chromedriver": "*",
|
|
26
|
-
"cucumber-
|
|
27
|
-
"
|
|
27
|
+
"@cucumber/pretty-formatter": "^1.0.0-alpha.2",
|
|
28
|
+
"eslint": "^7.32.0",
|
|
29
|
+
"mocha": "^9.1.3",
|
|
30
|
+
"geckodriver": "*",
|
|
31
|
+
"nightwatch": "^2.1.7"
|
|
28
32
|
}
|
|
29
33
|
}
|