webship-js 1.0.3 → 1.0.4-1.1

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.
Files changed (99) hide show
  1. package/.circleci/config.yml +110 -0
  2. package/.eslintignore +3 -0
  3. package/.eslintrc.json +34 -0
  4. package/.github/workflows/github-actions.yml +52 -16
  5. package/.gitlab-ci.yml +48 -26
  6. package/.travis-ci.yml +27 -0
  7. package/CNAME +1 -0
  8. package/README.md +26 -5
  9. package/assets/config_templates/circleci-linux-chrome.conf.js +118 -0
  10. package/assets/config_templates/github-linux-chrome.conf.js +124 -0
  11. package/bitbucket-pipelines.yml +26 -0
  12. package/examples/about-us.html +11 -0
  13. package/examples/contact-us.html +10 -0
  14. package/examples/example-api.json +28 -0
  15. package/examples/existing-page.html +11 -0
  16. package/examples/index.html +31 -0
  17. package/examples/main.js +17 -0
  18. package/examples/test--then--i-should--not--see-text-in-element.html +48 -0
  19. package/examples/test--then--i-should--see-text-in-element.html +48 -0
  20. package/examples/test--then--i-should--see-text-matching-pattern.html +31 -0
  21. package/examples/test--then--the-checkbox-checked.html +68 -0
  22. package/examples/test--then--the-element-should_not-contain-cssproperty.html +47 -0
  23. package/examples/test--then--the-link-should-contain.html +21 -0
  24. package/examples/test--when--i-attach-file-to-feild.html +50 -0
  25. package/examples/test--when--i-check-uncheck-checkbox.html +47 -0
  26. package/examples/test--when--i-click-link.html +18 -0
  27. package/examples/test--when--i-fill-in.html +48 -0
  28. package/examples/test--when--i-press-button.html +31 -0
  29. package/examples/test--when--i-reload-page.html +27 -0
  30. package/examples/test--when--i-scroll-functionality.html +176 -0
  31. package/examples/test--when--i-select-option-from-dropdownlist.html +35 -0
  32. package/examples/test--when-i-wait-max-of-time.html +39 -0
  33. package/examples/test--when-i-wait-page-until-is-loaded.html +47 -0
  34. package/examples/test--when-i-wait-specific-time.html +39 -0
  35. package/examples/test-acceptable-url-path.html +11 -0
  36. package/generate-reports.js +22 -0
  37. package/lib/custom-assertions/checkboxChecked.js +87 -0
  38. package/lib/custom-assertions/elementContainsCss.js +94 -0
  39. package/lib/custom-assertions/elementContainsText.js +86 -0
  40. package/lib/custom-assertions/responseStatus.js +31 -0
  41. package/lib/custom-assertions/shouldVisible.js +8 -0
  42. package/lib/custom-assertions/textMatching.js +44 -0
  43. package/lib/custom-commands/checkItem.js +4 -0
  44. package/lib/custom-commands/clickLink.js +23 -0
  45. package/lib/custom-commands/fileUpload.js +37 -0
  46. package/lib/custom-commands/fillTextInput.js +56 -0
  47. package/lib/custom-commands/press.js +3 -0
  48. package/lib/custom-commands/selectOption.js +11 -0
  49. package/lib/custom-commands/uncheckItem.js +4 -0
  50. package/lib/custom-commands/wait.js +12 -0
  51. package/nightwatch.conf.js +71 -287
  52. package/package.json +27 -8
  53. package/src/index.js +10 -0
  54. package/steplist.js +245 -0
  55. package/tests/assets/webshipco.png +0 -0
  56. package/tests/features/test--given--i-am-on-homepage.feature +16 -0
  57. package/tests/features/test--then--i-should--not--see-text-in-element.feature +13 -0
  58. package/tests/features/test--then--i-should--see-text-in-element-by-attr.feature +10 -0
  59. package/tests/features/test--then--i-should--see-text-in-element.feature +10 -0
  60. package/tests/features/test--then--i-should--see-text-matching-pattern-in-element.feature +13 -0
  61. package/tests/features/test--then--i-should--see-text-matching-pattern.feature +18 -0
  62. package/tests/features/test--then--i-should-be-on-page.feature +10 -0
  63. package/tests/features/test--then--i-should-be-on-the-homepage.feature +10 -0
  64. package/tests/features/test--then--i-should-not-see-an-element-by-attr.feature +8 -0
  65. package/tests/features/test--then--i-should-not-see-an-element.feature +8 -0
  66. package/tests/features/test--then--i-should-see-an-element-by-attr.feature +8 -0
  67. package/tests/features/test--then--i-should-see-an-element.feature +8 -0
  68. package/tests/features/test--then--the-checkbox-is-checked.feature +18 -0
  69. package/tests/features/test--then--the-checkbox-should-be-checked.feature +16 -0
  70. package/tests/features/test--then--the-element-should-contain-cssproperty.feature +9 -0
  71. package/tests/features/test--then--the-element-should-not-contain-cssproperty.feature +10 -0
  72. package/tests/features/test--then--the-field-should-contain-value.feature +11 -0
  73. package/tests/features/test--then--the-response-should-contain.feature +11 -0
  74. package/tests/features/test--then--the-response-status-code-should-be.feature +31 -0
  75. package/tests/features/test--then--the-url-should-match.feature +7 -0
  76. package/tests/features/test--then-the-link-should-contain-by-attribute.feature +18 -0
  77. package/tests/features/test--then-the-link-should-contain.feature +7 -0
  78. package/tests/features/test--when--i-attach-file-to-feild.feature +9 -0
  79. package/tests/features/test--when--i-check-checkbox.feature +21 -0
  80. package/tests/features/test--when--i-click-link-by-attribute.feature +21 -0
  81. package/tests/features/test--when--i-click-link.feature +9 -0
  82. package/tests/features/test--when--i-fill-in-by-attr.feature +31 -0
  83. package/tests/features/test--when--i-fill-in-table-by-attr.feature +19 -0
  84. package/tests/features/test--when--i-fill-in.feature +32 -0
  85. package/tests/features/test--when--i-go-to-homepage.feature +9 -0
  86. package/tests/features/test--when--i-move-forward-backward-one-page.feature +14 -0
  87. package/tests/features/test--when--i-press-button-by-attribute.feature +18 -0
  88. package/tests/features/test--when--i-press-button.feature +13 -0
  89. package/tests/features/test--when--i-reload-page.feature +11 -0
  90. package/tests/features/test--when--i-scroll.feature +48 -0
  91. package/tests/features/test--when--i-select-option-from-dropdownlist.feature +21 -0
  92. package/tests/features/test--when--i-wait-page-is-loaded.feature +8 -0
  93. package/tests/features/test--when--i-wait-time.feature +21 -0
  94. package/tests/step-definitions/webship.js +1363 -9
  95. package/webpack.config.js +17 -0
  96. package/webship-init.js +75 -0
  97. package/tests/features/check-webshipco-site.feature +0 -8
  98. package/tests/reports/cucumber-report.html +0 -48
  99. package/tests/reports/cucumber-report.json +0 -66
@@ -0,0 +1,110 @@
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_18.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 install libu2f-udev
44
+ sudo apt-get install libgbm1 libvulkan1 libnss3 libgconf-2-4 libxss1 fonts-liberation libappindicator3-1 libatk-bridge2.0-0 xdg-utils libgtk2.0-0 libgtk-3-0 libgbm-dev libnotify-dev libnss3 libxss1 libasound2 libxtst6 xauth
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
+ sudo apt-get install -f
48
+ rm google-chrome-stable_current_amd64.deb
49
+ sudo chmod +x /usr/bin/google-chrome
50
+ /usr/bin/google-chrome --version
51
+ google-chrome --version
52
+ - run:
53
+ name: Install/Update Chrome Driver
54
+ command: |
55
+ CHROME_VERSION=$(google-chrome --product-version);
56
+ echo $CHROME_VERSION;
57
+ wget https://storage.googleapis.com/chrome-for-testing-public/$CHROME_VERSION/linux64/chromedriver-linux64.zip
58
+ unzip chromedriver-linux64.zip
59
+ sudo chmod +x chromedriver-linux64/chromedriver
60
+ sudo mv -f chromedriver-linux64/chromedriver /usr/bin/
61
+ rm -rf chromedriver-linux64.zip chromedriver-linux64
62
+ chromedriver --version
63
+ - run:
64
+ name: Install Java
65
+ command: |
66
+ sudo apt update
67
+ sudo apt install -y openjdk-11-jre openjdk-11-jre-headless openjdk-11-jdk openjdk-11-jdk-headless
68
+ - run:
69
+ name: Run Selenium Standalone server
70
+ command: |
71
+ export DISPLAY=:99
72
+ if [[ ! -f /home/circleci/selenium-server-4.4.0.jar ]]; then wget -O /home/circleci/selenium-server-4.4.0.jar https://github.com/SeleniumHQ/selenium/releases/download/selenium-4.4.0/selenium-server-4.4.0.jar; fi
73
+ cd /home/circleci/
74
+ java -jar selenium-server-4.4.0.jar standalone --port 4444
75
+ background: true
76
+
77
+ jobs:
78
+ webship-js-testing:
79
+ <<: *defaults
80
+ steps:
81
+ - webship-js-build
82
+ ## Automated Functional Acceptance Testing
83
+ - run:
84
+ name: Install yarn
85
+ command: |
86
+ yarn install
87
+ - run:
88
+ name: Configure nightwatch.conf.js for Circle CI
89
+ command: |
90
+ node webship-init -ci circleci -os linux -b chrome
91
+ - run:
92
+ name: Start virtual server
93
+ command: |
94
+ export NODE_OPTIONS=--openssl-legacy-provider
95
+ yarn start
96
+ background: true
97
+ - run:
98
+ name: Test
99
+ command: |
100
+ yarn test
101
+ workflows:
102
+ version: 2
103
+ webship-js-workflow:
104
+ jobs:
105
+ - webship-js-testing:
106
+ filters:
107
+ tags:
108
+ only: /^1.0.*/
109
+ branches:
110
+ 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
+ }
@@ -1,28 +1,64 @@
1
- name: Webship-js CI
1
+ name: Github Actions
2
2
 
3
3
  on: [push]
4
4
 
5
5
  jobs:
6
6
  build:
7
-
8
7
  runs-on: ubuntu-latest
9
8
 
10
9
  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
10
+ TEST_BASE_URL: http://localhost:8080
11
+ SELENIUM_HOST: http://localhost:4444/wd/hub
20
12
 
21
13
  steps:
22
- - uses: actions/checkout@v3
23
- - name: Use Node.js
14
+ - name: Install/Update Google Chrome browser
15
+ run: |
16
+ sudo apt install libu2f-udev
17
+ sudo apt-get install libappindicator3-1 fonts-liberation libgbm1 libgtk-3-0 xdg-utils
18
+ export CHROME_BIN=/usr/bin/google-chrome
19
+ wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
20
+ sudo dpkg -i google-chrome-stable_current_amd64.deb
21
+ rm google-chrome-stable_current_amd64.deb
22
+
23
+ - name: Install/Update Chrome Driver
24
+ run: |
25
+ CHROME_VERSION=$(google-chrome --product-version);
26
+ echo $CHROME_VERSION;
27
+ wget https://storage.googleapis.com/chrome-for-testing-public/$CHROME_VERSION/linux64/chromedriver-linux64.zip
28
+ unzip chromedriver-linux64.zip
29
+ sudo chmod +x chromedriver-linux64/chromedriver
30
+ sudo mv -f chromedriver-linux64/chromedriver /usr/bin/
31
+ rm -rf chromedriver-linux64.zip chromedriver-linux64
32
+
33
+ - name: Checkout repository
34
+ uses: actions/checkout@v3
35
+
36
+ - name: Set up Node.js
24
37
  uses: actions/setup-node@v3
25
38
  with:
26
- node-version: '16.x'
27
- - run: yarn install
28
- - run: yarn test
39
+ node-version: '18.x'
40
+
41
+ - name: Install Java
42
+ run: |
43
+ sudo apt update
44
+ sudo apt install -y openjdk-11-jre openjdk-11-jre-headless openjdk-11-jdk openjdk-11-jdk-headless
45
+
46
+ - name: Run Selenium Standalone server
47
+ run: |
48
+ wget https://github.com/SeleniumHQ/selenium/releases/download/selenium-4.4.0/selenium-server-4.4.0.jar
49
+ nohup java -jar selenium-server-4.4.0.jar standalone > selenium.log 2>&1 &
50
+
51
+
52
+ - name: Install dependencies
53
+ run: yarn install
54
+
55
+ - name: Configure nightwatch.conf.js for GitHub
56
+ run: node webship-init -ci circleci -os linux -b chrome
57
+
58
+ - name: Start virtual server
59
+ run: |
60
+ export NODE_OPTIONS=--openssl-legacy-provider
61
+ yarn start &
62
+
63
+ - name: Run tests
64
+ run: yarn test
package/.gitlab-ci.yml CHANGED
@@ -1,28 +1,50 @@
1
- image: node:8.10
1
+ image: cimg/base:stable-20.04
2
+
3
+ services:
4
+ - name: selenium/standalone-chrome
5
+ alias: selenium
6
+
7
+ variables:
8
+ NODE_OPTIONS: "--openssl-legacy-provider"
9
+
10
+ before_script:
11
+ - sudo apt-get update -qq
12
+ - sudo apt-get upgrade -qqy
13
+ - sudo apt-get install -yqq 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
14
+ - sudo apt-get install -yqq 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
15
+ - curl -sL https://deb.nodesource.com/setup_18.x | sudo bash -
16
+ - sudo apt-get install -y nodejs
17
+ - sudo npm install -g yarn
18
+ - sudo apt-get update
19
+ - sudo apt-get install -y openjdk-11-jre openjdk-11-jre-headless openjdk-11-jdk openjdk-11-jdk-headless
20
+ - sudo apt-get install -y libu2f-udev
21
+ - sudo apt-get install -y libappindicator1 fonts-liberation libgbm1 libgtk-3-0 xdg-utils
22
+ - wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
23
+ - sudo dpkg -i google-chrome-stable_current_amd64.deb
24
+ - rm google-chrome-stable_current_amd64.deb
25
+ - CHROME_VERSION=$(google-chrome --product-version)
26
+ - wget https://storage.googleapis.com/chrome-for-testing-public/$CHROME_VERSION/linux64/chromedriver-linux64.zip
27
+ - unzip chromedriver-linux64.zip
28
+ - sudo chmod +x chromedriver-linux64/chromedriver
29
+ - sudo mv -f chromedriver-linux64/chromedriver /usr/bin/
30
+ - rm -rf chromedriver-linux64.zip chromedriver-linux64
31
+
2
32
  stages:
3
- - deploy
4
- - confidence-check
5
- deploy_terraform:
6
- stage: deploy
33
+ - build
34
+ - test
35
+
36
+ webship-js-build:
37
+ stage: build
7
38
  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
39
+ - wget https://github.com/SeleniumHQ/selenium/releases/download/selenium-4.4.0/selenium-server-4.4.0.jar
40
+ - nohup java -jar selenium-server-4.4.0.jar standalone > selenium.log 2>&1 &
41
+ - yarn install
42
+ - node webship-init -ci circleci -os linux -b chrome
43
+ - export NODE_OPTIONS=--openssl-legacy-provider
44
+ - yarn start &
45
+ - yarn test
46
+
47
+ only:
48
+ refs:
49
+ - tags
50
+ - branches
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.4.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/CNAME ADDED
@@ -0,0 +1 @@
1
+ webship.co
package/README.md CHANGED
@@ -1,10 +1,31 @@
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)
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
+ [![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
+ [![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)
6
+ [![Bitbucket Pipelines](https://img.shields.io/bitbucket/pipelines/webshipco/webship-js/1.0.x)](https://bitbucket.org/webshipco/webship-js/pipelines)
4
7
 
5
8
 
6
- Webship JS has a ready step definitions for automated functional testing.
9
+ Webship-js is an Automated Functional Acceptance Testing tool. Helps to ease and speed the work with the End-to-end testing features in web apps or projects. Utilizing [Nightwatch.js](https://github.com/nightwatchjs/nightwatch) and [Cucumber-js](https://github.com/cucumber/cucumber-js). Having custom and advanced general step definitions.
7
10
 
8
- ### Using:
9
- * Nightwatch.js
10
- * Cucumber-js
11
+ ### Webship-js Documentations
12
+ All you need to know is at [webship-js Docs](https://webship.co/docs/webship-js/1.0.x).
13
+
14
+
15
+ ## Install webship-js using Yarn
16
+
17
+ ```
18
+ yarn add webship-js
19
+ ```
20
+
21
+ ## Install files required by the webship-js tool
22
+
23
+ ```
24
+ bash <(wget -O - https://raw.githubusercontent.com/webship/wbash/v1/webship-js/v1/template.sh)
25
+ ```
26
+
27
+ ## Automated Functional Acceptance Testing
28
+
29
+ ```
30
+ yarn test
31
+ ```
@@ -0,0 +1,118 @@
1
+ const Services = {}; loadServices();
2
+
3
+ module.exports = {
4
+ // An array of folders (excluding subfolders) where your tests are located;
5
+ // if this is not specified, the test source must be passed as the second argument to the test runner.
6
+ src_folders: ['tests/step-definitions'],
7
+
8
+ // See https://nightwatchjs.org/guide/extending-nightwatch/adding-custom-commands.html
9
+ custom_commands_path: './lib/custom-commands',
10
+
11
+ // See https://nightwatchjs.org/guide/extending-nightwatch/adding-custom-assertions.html
12
+ custom_assertions_path: './lib/custom-assertions',
13
+
14
+ test_runner: {
15
+ type: 'cucumber',
16
+ options: {
17
+ feature_path: 'tests/features/*.feature',
18
+ additional_config: '',
19
+ parallel: 2,
20
+ },
21
+ },
22
+ globals: {
23
+ assets_folder : "/test/assets/",
24
+ minimum_wait_time: {
25
+ page: 3000,
26
+ before_scenario: 0,
27
+ after_scenario: 0,
28
+ before_step: 0,
29
+ after_step: 1000
30
+ }
31
+ },
32
+ test_settings: {
33
+ default: {
34
+ launch_url: 'http://localhost:8080/',
35
+ start_process: true,
36
+ selenium_port: 4444,
37
+ selenium_host: '127.0.0.1',
38
+ silent: true,
39
+ output: false,
40
+ screenshots: {
41
+ enabled: false,
42
+ path: './reports/screenshots',
43
+ },
44
+
45
+ desiredCapabilities: {
46
+ browserName: 'chrome',
47
+ 'goog:chromeOptions': {
48
+ // More info on Chromedriver: https://sites.google.com/a/chromium.org/chromedriver/
49
+ //
50
+ // w3c:false tells Chromedriver to run using the legacy JSONWire protocol (not required in Chrome 78)
51
+ w3c: true,
52
+ args: [
53
+ '--headless',
54
+ '--start-maximized',
55
+ '--disable-gpu',
56
+ '--window-size=1600,1200',
57
+ '--no-sandbox',
58
+ '--disable-dev-shm-usage',
59
+ '--disable-setuid-sandbox',
60
+ '--disable-web-security',
61
+ '--DNS-prefetch-disable',
62
+ '--disable-translate',
63
+ '--ignore-certificate-errors',
64
+ '--test-type',
65
+ '--disable-extensions',
66
+ '--incognito',
67
+ '--disable-infobars',
68
+ '--remote-debugging-port=9222',
69
+ '--allowed-ips=*',
70
+ '--whitelisted-ips=*',
71
+ '--allow-insecure-localhost',
72
+ ],
73
+ },
74
+ },
75
+ },
76
+ },
77
+
78
+ selenium_server: {
79
+ // Selenium Server is running locally and is managed by Nightwatch
80
+ selenium: {
81
+ start_process: true,
82
+ port: 4444,
83
+ server_path: (Services.seleniumServer ? Services.seleniumServer.path : ''),
84
+ cli_args: {
85
+ 'webdriver.gecko.driver': (Services.geckodriver ? Services.geckodriver.path : ''),
86
+ 'webdriver.chrome.driver': (Services.chromedriver ? Services.chromedriver.path : ''),
87
+ },
88
+ },
89
+
90
+ webdriver: {
91
+ start_process: false
92
+ },
93
+ },
94
+
95
+ 'selenium.chrome': {
96
+ extends: 'selenium',
97
+ desiredCapabilities: {
98
+ browserName: 'chrome',
99
+ chromeOptions: {
100
+ w3c: false,
101
+ },
102
+ },
103
+ }
104
+ };
105
+
106
+ function loadServices() {
107
+ try {
108
+ Services.seleniumServer = require('selenium-server');
109
+ } catch (err) {}
110
+
111
+ try {
112
+ Services.chromedriver = require('chromedriver');
113
+ } catch (err) {}
114
+
115
+ try {
116
+ Services.geckodriver = require('geckodriver');
117
+ } catch (err) {}
118
+ }
@@ -0,0 +1,124 @@
1
+ const Services = {}; loadServices();
2
+
3
+ module.exports = {
4
+ // An array of folders (excluding subfolders) where your tests are located;
5
+ // if this is not specified, the test source must be passed as the second argument to the test runner.
6
+ src_folders: ['tests/step-definitions'],
7
+
8
+ // See https://nightwatchjs.org/guide/extending-nightwatch/adding-custom-commands.html
9
+ custom_commands_path: './lib/custom-commands',
10
+
11
+ // See https://nightwatchjs.org/guide/extending-nightwatch/adding-custom-assertions.html
12
+ custom_assertions_path: './lib/custom-assertions',
13
+
14
+ webdriver: {
15
+ start_process: true,
16
+ port: 4444,
17
+ server_path: require('chromedriver').path,
18
+ cli_args: [
19
+ // very verbose geckodriver logs
20
+ // '-vv'
21
+ ]
22
+ },
23
+
24
+ test_runner: {
25
+ type: 'cucumber',
26
+ options: {
27
+ feature_path: 'tests/features/*.feature',
28
+ additional_config: '',
29
+ parallel: 2,
30
+ },
31
+
32
+ },
33
+ globals: {
34
+ assets_folder : "/test/assets/",
35
+ minimum_wait_time: {
36
+ page: 3000,
37
+ before_scenario: 0,
38
+ after_scenario: 0,
39
+ before_step: 0,
40
+ after_step: 1000
41
+ }
42
+ },
43
+ test_settings: {
44
+ default: {
45
+ launch_url: 'http://localhost:8080/',
46
+ selenium_port: 4444,
47
+ selenium_host: '127.0.0.1',
48
+ silent: true,
49
+ output: false,
50
+ screenshots: {
51
+ enabled: true,
52
+ path: './reports/screenshots',
53
+ },
54
+
55
+ desiredCapabilities: {
56
+ browserName: 'chrome',
57
+ 'goog:chromeOptions': {
58
+ // More info on Chromedriver: https://sites.google.com/a/chromium.org/chromedriver/
59
+ //
60
+ // w3c:false tells Chromedriver to run using the legacy JSONWire protocol (not required in Chrome 78)
61
+ w3c: true,
62
+ args: [
63
+ '--headless',
64
+ '--start-maximized',
65
+ '--disable-gpu',
66
+ '--window-size=1600,1200',
67
+ '--no-sandbox',
68
+ '--disable-dev-shm-usage',
69
+ '--disable-setuid-sandbox',
70
+ '--disable-web-security',
71
+ '--DNS-prefetch-disable',
72
+ '--disable-translate',
73
+ '--ignore-certificate-errors',
74
+ '--test-type',
75
+ '--disable-extensions',
76
+ '--incognito',
77
+ '--disable-infobars',
78
+ '--remote-debugging-port=9222',
79
+ '--allowed-ips=*',
80
+ '--whitelisted-ips=*',
81
+ '--allow-insecure-localhost',
82
+ ],
83
+ },
84
+ },
85
+ },
86
+ },
87
+
88
+ selenium_server: {
89
+ // Selenium Server is running locally and is managed by Nightwatch
90
+ selenium: {
91
+ start_process: true,
92
+ port: 4444,
93
+ server_path: (Services.seleniumServer ? Services.seleniumServer.path : ''),
94
+ cli_args: {
95
+ 'webdriver.gecko.driver': (Services.geckodriver ? Services.geckodriver.path : ''),
96
+ 'webdriver.chrome.driver': (Services.chromedriver ? Services.chromedriver.path : ''),
97
+ },
98
+ },
99
+ },
100
+
101
+ 'selenium.chrome': {
102
+ extends: 'selenium_server',
103
+ desiredCapabilities: {
104
+ browserName: 'chrome',
105
+ chromeOptions: {
106
+ w3c: true,
107
+ },
108
+ },
109
+ }
110
+ };
111
+
112
+ function loadServices() {
113
+ try {
114
+ Services.seleniumServer = require('selenium-server');
115
+ } catch (err) { }
116
+
117
+ try {
118
+ Services.chromedriver = require('chromedriver');
119
+ } catch (err) { }
120
+
121
+ try {
122
+ Services.geckodriver = require('geckodriver');
123
+ } catch (err) { }
124
+ }
@@ -0,0 +1,26 @@
1
+ image: node:18 # Choose an appropriate Node.js version
2
+
3
+ pipelines:
4
+ default:
5
+ - step:
6
+ name: Install and Test
7
+ caches:
8
+ - node
9
+ script:
10
+ - npm install # Install your Node.js dependencies
11
+ - npm install selenium-webdriver --save # Install the Selenium WebDriver
12
+ - npm install chromedriver --save # Install ChromeDriver (for running tests in Chrome)
13
+ # Add other dependencies as needed
14
+
15
+ # Set up your test environment here (e.g., starting a server, configuring the application)
16
+ # For example, if you have a start script defined in your package.json:
17
+ # - npm run start & # Start your server in the background
18
+
19
+ # Run your tests here, assuming you have a test script defined in your package.json:
20
+ - yarn install
21
+ - yarn test
22
+
23
+
24
+
25
+
26
+
@@ -0,0 +1,11 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset='utf-8'>
5
+ <title>About Us</title>
6
+ </head>
7
+ <body>
8
+ <h1>About Us</h1>
9
+ <p id="paragraphid">Paragraph example</p>
10
+ </body>
11
+ </html>
@@ -0,0 +1,10 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset='utf-8'>
5
+ <title>Contact Us</title>
6
+ </head>
7
+ <body>
8
+ <h1>Contact Us</h1>
9
+ </body>
10
+ </html>