webship-js 1.0.32 → 1.0.34

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 (45) hide show
  1. package/.circleci/config.yml +23 -18
  2. package/.github/workflows/github-actions.yml +12 -13
  3. package/.gitlab-ci.yml +9 -10
  4. package/examples/test--when-i-wait-max-of-time.html +1 -1
  5. package/examples/test--when-i-wait-page-until-is-loaded.html +47 -0
  6. package/examples/test--when-i-wait-specific-time.html +1 -1
  7. package/lib/custom-assertions/responseStatus.js +23 -5
  8. package/package.json +2 -2
  9. package/tests/features/test--given--i-am-on-homepage.feature +6 -6
  10. package/tests/features/test--then--i-should--not--see-text-in-element.feature +6 -5
  11. package/tests/features/test--then--i-should--see-text-in-element-by-attr.feature +8 -8
  12. package/tests/features/test--then--i-should--see-text-in-element.feature +8 -8
  13. package/tests/features/test--then--i-should--see-text-matching-pattern-in-element.feature +5 -5
  14. package/tests/features/test--then--i-should--see-text-matching-pattern.feature +6 -6
  15. package/tests/features/test--then--i-should-be-on-page.feature +8 -8
  16. package/tests/features/test--then--i-should-be-on-the-homepage.feature +8 -8
  17. package/tests/features/test--then--i-should-not-see-an-element-by-attr.feature +4 -4
  18. package/tests/features/test--then--i-should-not-see-an-element.feature +4 -4
  19. package/tests/features/test--then--i-should-see-an-element-by-attr.feature +4 -4
  20. package/tests/features/test--then--i-should-see-an-element.feature +3 -3
  21. package/tests/features/test--then--the-checkbox-is-checked.feature +4 -4
  22. package/tests/features/test--then--the-checkbox-should-be-checked.feature +12 -12
  23. package/tests/features/test--then--the-element-should-contain-cssproperty.feature +7 -7
  24. package/tests/features/test--then--the-element-should-not-contain-cssproperty.feature +8 -8
  25. package/tests/features/test--then--the-field-should-contain-value.feature +9 -9
  26. package/tests/features/test--then--the-response-should-contain.feature +5 -6
  27. package/tests/features/test--then--the-response-status-code-should-be.feature +7 -7
  28. package/tests/features/test--then--the-url-should-match.feature +4 -4
  29. package/tests/features/test--when--i-attach-file-to-feild.feature +4 -4
  30. package/tests/features/test--when--i-check-checkbox.feature +18 -18
  31. package/tests/features/test--when--i-click-link-by-attribute.feature +6 -6
  32. package/tests/features/test--when--i-click-link.feature +4 -4
  33. package/tests/features/test--when--i-fill-in-by-attr.feature +7 -7
  34. package/tests/features/test--when--i-fill-in-table-by-attr.feature +5 -5
  35. package/tests/features/test--when--i-fill-in.feature +7 -7
  36. package/tests/features/test--when--i-go-to-homepage.feature +6 -4
  37. package/tests/features/test--when--i-move-forward-backward-one-page.feature +3 -3
  38. package/tests/features/test--when--i-press-button-by-attribute.feature +4 -4
  39. package/tests/features/test--when--i-press-button.feature +4 -4
  40. package/tests/features/test--when--i-reload-page.feature +4 -4
  41. package/tests/features/test--when--i-select-option-from-dropdownlist-by-attr.feature +5 -5
  42. package/tests/features/test--when--i-select-option-from-dropdownlist.feature +4 -4
  43. package/tests/features/test--when--i-wait-page-is-loaded.feature +9 -0
  44. package/tests/features/test--when--i-wait-time.feature +6 -5
  45. package/tests/step-definitions/webship.js +40 -51
@@ -41,32 +41,37 @@ commands:
41
41
  name: Install/Update Google Chrome browser
42
42
  command: |
43
43
  sudo apt install libu2f-udev
44
- sudo apt-get install libappindicator1 fonts-liberation libgbm1 libgtk-3-0 xdg-utils
45
- export CHROME_BIN=/usr/bin/google-chrome
46
- CHROME_VERSION="115.0.5790.110-1"
47
- wget https://mirror.cs.uchicago.edu/google-chrome/pool/main/g/google-chrome-stable/google-chrome-stable_${CHROME_VERSION}_amd64.deb
48
- sudo dpkg -i google-chrome-stable_${CHROME_VERSION}_amd64.deb
49
- rm google-chrome-stable_${CHROME_VERSION}_amd64.deb
50
-
51
- ## Install/Update Chrome Driver.
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
52
  - run:
53
53
  name: Install/Update Chrome Driver
54
54
  command: |
55
- CHROME_DRIVER_VERSION=114.0.5735.90;
56
- echo $CHROME_DRIVER_VERSION;
57
- wget http://chromedriver.storage.googleapis.com/$CHROME_DRIVER_VERSION/chromedriver_linux64.zip
58
- unzip chromedriver_linux64.zip
59
- sudo chmod +x chromedriver
60
- sudo mv -f chromedriver /usr/bin/
61
- rm chromedriver_linux64.zip
62
-
63
- ## Run Selenium Standalone server.
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
64
68
  - run:
65
69
  name: Run Selenium Standalone server
66
70
  command: |
71
+ export DISPLAY=:99
67
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
68
73
  cd /home/circleci/
69
- java -jar selenium-server-4.4.0.jar standalone
74
+ java -jar selenium-server-4.4.0.jar standalone --port 4444
70
75
  background: true
71
76
 
72
77
  jobs:
@@ -14,22 +14,21 @@ jobs:
14
14
  - name: Install/Update Google Chrome browser
15
15
  run: |
16
16
  sudo apt install libu2f-udev
17
- sudo apt-get install libappindicator1 fonts-liberation libgbm1 libgtk-3-0 xdg-utils
18
- export CHROME_BIN=/usr/bin/google-chrome
19
- CHROME_VERSION="115.0.5790.110-1"
20
- wget https://mirror.cs.uchicago.edu/google-chrome/pool/main/g/google-chrome-stable/google-chrome-stable_${CHROME_VERSION}_amd64.deb
21
- sudo dpkg -i google-chrome-stable_${CHROME_VERSION}_amd64.deb
22
- rm google-chrome-stable_${CHROME_VERSION}_amd64.deb
17
+ sudo apt-get install libappindicator1 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
23
22
 
24
23
  - name: Install/Update Chrome Driver
25
24
  run: |
26
- CHROME_DRIVER_VERSION=114.0.5735.90;
27
- echo $CHROME_DRIVER_VERSION;
28
- wget http://chromedriver.storage.googleapis.com/$CHROME_DRIVER_VERSION/chromedriver_linux64.zip
29
- unzip chromedriver_linux64.zip
30
- sudo chmod +x chromedriver
31
- sudo mv -f chromedriver /usr/bin/
32
- rm chromedriver_linux64.zip
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
33
32
 
34
33
  - name: Checkout repository
35
34
  uses: actions/checkout@v3
package/.gitlab-ci.yml CHANGED
@@ -5,8 +5,6 @@ services:
5
5
  alias: selenium
6
6
 
7
7
  variables:
8
- CHROME_VERSION: "115.0.5790.110-1"
9
- CHROME_DRIVER_VERSION: "114.0.5735.90"
10
8
  NODE_OPTIONS: "--openssl-legacy-provider"
11
9
 
12
10
  before_script:
@@ -21,14 +19,15 @@ before_script:
21
19
  - sudo apt-get install -y openjdk-11-jre openjdk-11-jre-headless openjdk-11-jdk openjdk-11-jdk-headless
22
20
  - sudo apt-get install -y libu2f-udev
23
21
  - sudo apt-get install -y libappindicator1 fonts-liberation libgbm1 libgtk-3-0 xdg-utils
24
- - wget https://mirror.cs.uchicago.edu/google-chrome/pool/main/g/google-chrome-stable/google-chrome-stable_${CHROME_VERSION}_amd64.deb
25
- - sudo dpkg -i google-chrome-stable_${CHROME_VERSION}_amd64.deb
26
- - rm google-chrome-stable_${CHROME_VERSION}_amd64.deb
27
- - wget http://chromedriver.storage.googleapis.com/${CHROME_DRIVER_VERSION}/chromedriver_linux64.zip
28
- - unzip chromedriver_linux64.zip
29
- - sudo chmod +x chromedriver
30
- - sudo mv chromedriver /usr/bin/
31
- - rm chromedriver_linux64.zip
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
32
31
 
33
32
  stages:
34
33
  - build
@@ -24,7 +24,7 @@
24
24
 
25
25
  <div class="container">
26
26
  <b><div id="result" class="style">Waiting . . .</div></b>
27
-
27
+ </div>
28
28
  </body>
29
29
 
30
30
  <script>
@@ -0,0 +1,47 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+
4
+ <head>
5
+ <meta charset='utf-8'>
6
+ <title>I wait page until is loaded</title>
7
+ <style>
8
+ .container,
9
+ .container input,
10
+ .container button {
11
+ font-size: 26px;
12
+ }
13
+
14
+ .style {
15
+ font-size: 22px;
16
+ line-height: 30px;
17
+ }
18
+
19
+ #complete{
20
+ font-size: 32px;
21
+ line-height: 30px;
22
+ }
23
+
24
+ </style>
25
+
26
+ </head>
27
+
28
+ <body>
29
+ <h1>Waiting for the page to load</h1>
30
+ <div id="complete">
31
+
32
+ </div>
33
+
34
+ <div id="container">
35
+
36
+ </div>
37
+ </body>
38
+
39
+ <script>
40
+
41
+ for(var i=0; i<2000; i++){
42
+ document.getElementById("container").innerHTML += '<p class="style">' + i + '</p>';
43
+ }
44
+ document.getElementById("complete").innerHTML += "The waiting process was completed successfully.";
45
+
46
+ </script>
47
+ </html>
@@ -24,7 +24,7 @@
24
24
 
25
25
  <div class="container">
26
26
  <b><div id="result" class="style">Waiting . . .</div></b>
27
-
27
+ </div>
28
28
  </body>
29
29
 
30
30
  <script>
@@ -1,13 +1,31 @@
1
- const request = require("request");
1
+ const axios = require('axios');
2
2
 
3
3
  module.exports.assertion = function (negativeCase, expectedStatusCode) {
4
4
 
5
- return browser.url(function (currentURL) {
5
+ browser.url(function (currentURL) {
6
6
  request(currentURL.value, (error, response, body) => {
7
7
  if (negativeCase) {
8
- return browser.assert.not.equal(response.statusCode, expectedStatusCode).end();
8
+ return axios.get(currentURL.value)
9
+ .then(function (response) {
10
+ browser.assert.equal(response.status, expectedStatusCode);
11
+ })
12
+ .catch(function (error) {
13
+ browser.assert.equal(error.status, expectedStatusCode);
14
+ })
15
+ .finally(function () {
16
+ // always executed
17
+ });
9
18
  }
10
- return browser.assert.equal(response.statusCode, expectedStatusCode).end();
19
+ return axios.get(currentURL.value)
20
+ .then(function (response) {
21
+ browser.assert.equal(response.status, expectedStatusCode);
22
+ })
23
+ .catch(function (error) {
24
+ browser.assert.equal(error.status, expectedStatusCode);
25
+ })
26
+ .finally(function () {
27
+ // always executed
28
+ });
11
29
  });
12
30
  });
13
- }
31
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "webship-js",
3
- "version": "1.0.32",
3
+ "version": "1.0.34",
4
4
  "description": "Webship JS automated functional testing.",
5
5
  "main": "index.js",
6
6
  "directories": {
@@ -42,7 +42,7 @@
42
42
  "geckodriver": "*",
43
43
  "webpack-cli": "~5",
44
44
  "webpack-dev-server": "~4",
45
- "request": "~2"
45
+ "axios": "~1"
46
46
  },
47
47
  "bin": {
48
48
  "steplist": "./steplist.js"
@@ -1,16 +1,16 @@
1
- Feature: An example to test for being on the homepage
2
- As an anonymous user
1
+ Feature: An example of testing for being on the homepage.
2
+ As an anonymous user,
3
3
  I want to be able to navigate to the homepage
4
- So that I can check the welcome message at homepage
4
+ so that I can check the welcome message on the homepage.
5
5
 
6
- Scenario: Check to be on (the) homepage
6
+ Scenario: Ensure that you are on the homepage by using 'the' before the word 'homepage'.
7
7
  Given I am on the homepage
8
8
  Then I should see "Welcome to the homepage of the Webship-js Examples"
9
9
 
10
- Scenario: Check to be on homepage
10
+ Scenario: Ensure that you are on the homepage without using 'the' before the word 'homepage'.
11
11
  Given I am on homepage
12
12
  Then I should see "Welcome to the homepage of the Webship-js Examples"
13
13
 
14
- Scenario: Check to be on homepage (useing we)
14
+ Scenario: Ensure that you are on the homepage without using 'the' before the word 'homepage' and using 'we' instead of 'I'.
15
15
  Given we are on homepage
16
16
  Then we should see "Welcome to the homepage of the Webship-js Examples"
@@ -1,7 +1,8 @@
1
- Feature: An example to test whether the input text does not contain a specific value by its attribute
2
- As a tester
3
- I want to be able to check an input text does not contain a specific value by its attribute
4
- Scenario: Check an element if it does not contain a specific text
1
+ Feature: An example to ensure that the input text does not contain a specific value based on its attribute
2
+ As a tester,
3
+ I want to ensure that the textbox does not contain a specific value based on its attributes.
4
+
5
+ Scenario: Ensuring that a textbox does not contain a specific value based on its attributes.
5
6
  Given I am on "/test--then--i-should--not--see-text-in-element.html"
6
7
  When I fill in "Username" with "user1"
7
8
  And I fill in "Password" with "1234"
@@ -9,4 +10,4 @@ Feature: An example to test whether the input text does not contain a specific v
9
10
  When I fill in "uname" with: by attr
10
11
  And I fill in "Password" with:
11
12
  Then I should not see "user1" in the "Username" element
12
- Then I should not see "1234" in the "pword" element by attr
13
+ And I should not see "1234" in the "pword" element by attr
@@ -1,10 +1,10 @@
1
- Feature: An example to test whether an element contains a certain text or not
2
- As a tester
3
- I want to be able to check an element contains a certain text or not
1
+ Feature: An example to ensure that the input text contain a specific value based on its attribute
2
+ As a tester,
3
+ I want to ensure that the textbox contain a specific value based on its attributes.
4
4
 
5
- Scenario: Check an element if it contains a specific text
5
+ Scenario: Ensuring that a textbox contain a specific value based on its attributes.
6
6
  Given I am on "/test--then--i-should--not--see-text-in-element.html"
7
- When I fill in "Username" with "user1"
8
- And I fill in "Password" with "1234"
9
- Then I should see "user1" in the "uname" element by its "id" attr
10
- And I should see "1234" in the "pwordcss" element by attr
7
+ When I fill in "Username" with "user1"
8
+ And I fill in "Password" with "1234"
9
+ Then I should see "user1" in the "uname" element by its "id" attr
10
+ And I should see "1234" in the "pwordcss" element by attr
@@ -1,10 +1,10 @@
1
- Feature: An example to test whether an input text contains a certain text by its label
2
- As a tester
3
- I want to be able to check an element contains a certain text or not
1
+ Feature: An example to ensure that the input text contain a specific value based on its label
2
+ As a tester,
3
+ I want to ensure thlabelat the textbox does not contain a specific value based on its label
4
4
 
5
- Scenario: Check an element if it contains a specific text
5
+ Scenario: Ensuring that a textbox does not contain a specific value based on its label.
6
6
  Given I am on "/test--then--i-should--not--see-text-in-element.html"
7
- When I fill in "Username" with "user1"
8
- And I fill in "Password" with "1234"
9
- Then I should see "user1" in the "Username" element
10
- And I should see "1234" in the "Password" element
7
+ When I fill in "Username" with "user1"
8
+ And I fill in "Password" with "1234"
9
+ Then I should see "user1" in the "Username" element
10
+ And I should see "1234" in the "Password" element
@@ -1,13 +1,13 @@
1
- Feature: An example of testing match a pattern to text in a specific element
2
- As a developer
3
- I want to be able to check if I can see text matching the pattern I require in a specific element.
1
+ Feature: An example of ensuring that a pattern matches the text in a specific element
2
+ As a developer,
3
+ I want to ensure that a pattern matches the text in a specific element.
4
4
 
5
- Scenario: Check if text exist in an element has a pattern match with 12-hour time format
5
+ Scenario: Ensuring that the text in an element matches the 12-hour time format pattern
6
6
  Given I am on "/test--then--i-should--see-text-matching-pattern.html"
7
7
  And I wait max of 3 seconds
8
8
  Then I should see text matching "(((0[1-9])|(1[0-2])):([0-5])(0|5)\s(A|P|a|p)(M|m))" in the ".time" element
9
9
 
10
- Scenario: Check if text exist in an element has a pattern match with date DD/MM/YYYY or DD-MM-YYYY
10
+ Scenario: Ensuring that the text in an element matches the DD/MM/YYYY or DD-MM-YYYY date format pattern
11
11
  Given I am on "/test--then--i-should--see-text-matching-pattern.html"
12
12
  And I wait max of 3 seconds
13
13
  Then I should see text matching "(0?[1-9]|[12][0-9]|3[01])[\/\-](0?[1-9]|1[012])[\/\-]\d{4}" in the "#date" element
@@ -1,18 +1,18 @@
1
- Feature: An example of testing to match a pattern to text on a specific page
2
- As a developer
3
- I want to be able to check if I can see text matching the pattern I require.
1
+ Feature: An example of ensuring that a pattern matches the text on a specific page.
2
+ As a developer,
3
+ I want to ensure that a pattern matches the text in a specific page.
4
4
 
5
- Scenario: Check if exist a text has a pattern match with text start with "T"
5
+ Scenario: Ensure that there is a text matching the pattern of text starting with 'T' on a specific page
6
6
  Given I am on "/test--then--i-should--see-text-matching-pattern.html"
7
7
  And I wait max of 3 seconds
8
8
  Then I should see text matching "^T\w+"
9
9
 
10
- Scenario: Check if not exist a text has a pattern match with text start with "O"
10
+ Scenario: Ensure that there is no text matching the pattern of text starting with 'O' on a specific page
11
11
  Given I am on "/test--then--i-should--see-text-matching-pattern.html"
12
12
  And I wait max of 3 seconds
13
13
  Then I should not see text matching "^O\w+"
14
14
 
15
- Scenario: Check if exist a text has a pattern match with Email
15
+ Scenario: Ensure that there is text matching the email pattern on a specific page
16
16
  Given I am on "/test--then--i-should--see-text-matching-pattern.html"
17
17
  And I wait max of 3 seconds
18
18
  Then I should see text matching "[a-z0-9]+@[a-z]+\.[a-z]{2,3}"
@@ -1,10 +1,10 @@
1
- Feature: An example to test being on a specific page
2
- As an anonymous user
3
- I want to be sure I am on a specific page
1
+ Feature: An example to ensure that you are on a specific page
2
+ As an anonymous user,
3
+ I want to ensure that I am on a specific page
4
4
 
5
- Scenario: Check being on a specific page
5
+ Scenario: Ensure that you are on a specific page
6
6
  Given I am on the homepage
7
- When I go to "/about-us.html"
8
- Then I should be on "/about-us.html"
9
- When I move backward one page
10
- Then I should be on homepage
7
+ When I go to "/about-us.html"
8
+ Then I should be on "/about-us.html"
9
+ When I move backward one page
10
+ Then I should be on homepage
@@ -1,10 +1,10 @@
1
- Feature: An example to test being on the homepage
2
- As an anonymous user
3
- I want to be sure I am on the homepage
1
+ Feature: An example to ensure that you are on the homepage
2
+ As an anonymous user,
3
+ I want to ensure that I am on the homepage
4
4
 
5
- Scenario: Check being on the homepage
5
+ Scenario: Ensure that you are on the homepage
6
6
  Given I am on the homepage
7
- When I go to "/about-us.html"
8
- And I move backward one page
9
- And I wait max of 3 seconds
10
- Then I should be on the homepage
7
+ When I go to "/about-us.html"
8
+ And I move backward one page
9
+ And I wait max of 3 seconds
10
+ Then I should be on the homepage
@@ -1,8 +1,8 @@
1
- Feature: An example to test not seeing for a specific element on current page by its label
2
- As a user
3
- I want to make sure that when I'm on a particular page, I should not see a specific element by its label
1
+ Feature: An example to ensure that a specific element is not visible on the current page by its attribute
2
+ As a user,
3
+ I want to ensure that when I'm on a particular page, I do not see a specific element identified by its attribute
4
4
 
5
- Scenario: Check to test not seeing for a specific element by its label
5
+ Scenario: Ensure that a specific element is not visible based on its attribute
6
6
  Given I am on "/test--then--i-should--see-text-in-element.html"
7
7
  Then I should not see an "emailId" element by its "id" attr
8
8
  And I should not see a "countryCss" element by attr
@@ -1,8 +1,8 @@
1
- Feature: An example to test not seeing for a specific element on current page by its label
2
- As a user
3
- I want to make sure that when I'm on a particular page, I should not see a specific element by its label
1
+ Feature: An example to ensure that a specific element is not visible on the current page by its label
2
+ As a user,
3
+ I want to ensure that when I'm on a particular page, I do not see a specific element by its label
4
4
 
5
- Scenario: Check to test not seeing for a specific element by its label
5
+ Scenario: Ensure to test that a specific element is not visible by its label
6
6
  Given I am on "/test--then--i-should--see-text-in-element.html"
7
7
  Then I should not see an "Eamil" element
8
8
  And I should not see a "Country" element
@@ -1,8 +1,8 @@
1
- Feature: An example to test seeing for a specific element on current page by its attributes
2
- As a user
3
- I want to make sure that when I'm on a particular page, I should see a specific element by its attributes
1
+ Feature: An example to ensure visibility of a specific element on the current page by its attributes
2
+ As a user,
3
+ I want to make sure that when I'm on a particular page, I can see a specific element by its attributes
4
4
 
5
- Scenario: Check to test seeing for a specific element by its attributes
5
+ Scenario: Ensure visibility of a specific element by its attributes
6
6
  Given I am on "/test--then--i-should--see-text-in-element.html"
7
7
  Then I should see a "uname" element by its "id" attr
8
8
  And I should see a "pwordcss" element by attr
@@ -1,6 +1,6 @@
1
- Feature: An example to test seeing for a specific element on current page by its label
2
- As a user
3
- I want to make sure that when I'm on a particular page, I should see a specific element by its label
1
+ Feature: An example to ensure that a specific element is visible on the current page by its label
2
+ As a user,
3
+ I want to ensure that when I'm on a particular page, I can see a specific element by its label
4
4
 
5
5
  Scenario: Check to test seeing for a specific element by its label
6
6
  Given I am on "/test--then--i-should--see-text-in-element.html"
@@ -1,8 +1,8 @@
1
- Feature: An example of test for selecting a checkbox
2
- As a tester
1
+ Feature: An example of a test case for selecting a checkbox
2
+ As a tester,
3
3
  I want to be able to check that the checkbox is checked or not
4
4
 
5
- Scenario: Check that the checkbox is checked
5
+ Scenario: Verify that the checkbox is checked
6
6
  Given I am on "/test--then--the-checkbox-checked.html"
7
7
  When I check "rememberMe"
8
8
  And I check "PrivacyPolicy"
@@ -10,7 +10,7 @@ Feature: An example of test for selecting a checkbox
10
10
  Then the checkbox "#rememberMe" is checked
11
11
  And I should see "Registration Done Successfully"
12
12
 
13
- Scenario: Check that the checkbox is not checked
13
+ Scenario: Verify that the checkbox is not checked
14
14
  Given I am on "/test--then--the-checkbox-checked.html"
15
15
  When I check "PrivacyPolicy"
16
16
  And I press "Register" by attr
@@ -1,16 +1,16 @@
1
- Feature: An example of test assert for selecting a checkbox
2
- As an anonymous user
3
- I want to be sure that a specific checkbox should be checked before submitting a specific action.
1
+ Feature: An example to assert the selection of a checkbox
2
+ As an anonymous user,
3
+ I want to ensure that a specific checkbox is checked before submitting a particular action
4
4
 
5
- Scenario: Check that the checkbox should be checked
5
+ Scenario: Ensure that the checkbox is checked
6
6
  Given I am on "/test--then--the-checkbox-checked.html"
7
- When I check "PrivacyPolicy"
8
- And I press "Register" by attr
9
- Then the checkbox "#PrivacyPolicy" should be checked
10
- And I should see "Registration Done Successfully"
7
+ When I check "PrivacyPolicy"
8
+ And I press "Register" by attr
9
+ Then the checkbox "#PrivacyPolicy" should be checked
10
+ And I should see "Registration Done Successfully"
11
11
 
12
- Scenario: Check that the checkbox should not be checked
12
+ Scenario: Ensure that the checkbox is not checked
13
13
  Given I am on "/test--then--the-checkbox-checked.html"
14
- When I press "Register" by attr
15
- Then the "#PrivacyPolicy" checkbox should not be checked
16
- And I should see "Please check Agree to Privacy Policy"
14
+ When I press "Register" by attr
15
+ Then the "#PrivacyPolicy" checkbox should not be checked
16
+ And I should see "Please check Agree to Privacy Policy"
@@ -1,9 +1,9 @@
1
- Feature: An example to test if the element contains a certain expected CSS property.
2
- As a developer
3
- I want to be able to test if the element contains a certain expected CSS property.
1
+ Feature: An example to verify whether the element contains a specific expected CSS property.
2
+ As a developer,
3
+ I want to verify whether the element contains a specific expected CSS property.
4
4
 
5
- Scenario: Check element if the element contains a certain expected CSS property
5
+ Scenario: Verify whether the element contains a specific expected CSS property
6
6
  Given I am on "/test--then--the-element-should_not-contain-cssproperty.html"
7
- Then I should see a "body" element by attr
8
- When I press "Submit"
9
- Then the "body" element should contain "background-color:white;" css style
7
+ Then I should see a "body" element by attr
8
+ When I press "Submit"
9
+ Then the "body" element should contain "background-color:white;"
@@ -1,10 +1,10 @@
1
- Feature: An example to test if the element does not contain a certain expected CSS property.
2
- As a developer
3
- I want to be able to test if the element does not contain a certain expected CSS property.
1
+ Feature: An example to verify whether the element does not contain a specific expected CSS property.
2
+ As a developer,
3
+ I want to verify whether the element does not contain a specific expected CSS property.
4
4
 
5
- Scenario: Check element if the element not contain a certain CSS property
5
+ Scenario: Verify whether the element does not contain a certain CSS property
6
6
  Given I am on "/test--then--the-element-should_not-contain-cssproperty.html"
7
- Then I should see a "body" element by attr
8
- When I press "Submit"
9
- Then the "#uname" element should not contain "border:solid 5px red;" css style
10
- And the "pword" element should not contain "font-size: 28px;" css style
7
+ Then I should see a "body" element by attr
8
+ When I press "Submit"
9
+ Then the "#uname" element should not contain "border:solid 5px red;"
10
+ And the "pword" element should not contain "font-size: 28px;"
@@ -1,11 +1,11 @@
1
- Feature: An example to test if the field contains certain value
2
- As a tester
3
- I want to be able to check field if has a certain value or not
1
+ Feature: An example to verify whether the field contains a specific value identified by its element label
2
+ As a tester,
3
+ I want to verify whether the field has a specific value based on its element label
4
4
 
5
- Scenario: Check field if has a particular value or not
5
+ Scenario: Verify that the field has a particular value based on its element label
6
6
  Given I am on "/test--then--i-should--not--see-text-in-element.html"
7
- And I fill in "Username" with "user1"
8
- Then the "#uname" field should contain "user1"
9
- When I press "Reset" by attr
10
- And I fill in "Username" with "user2"
11
- Then the "#uname" field should not contain "user1"
7
+ And I fill in "Username" with "user1"
8
+ Then the "Username" field should contain "user1"
9
+ When I press "Reset" by attr
10
+ And I fill in "Username" with "user2"
11
+ Then the "Username" field should contain "user2"
@@ -1,12 +1,11 @@
1
- Feature: An example to test response page if contain a text
2
- As a tester,
3
- I want to be able to navigate to a page
4
- So that I can check if this page contains a specific text
1
+ Feature: An example to ensure that the response page contains specific text
2
+ As a tester,
3
+ I want to navigate to a page to verify whether it contains specific text
5
4
 
6
- Scenario: Check response page if contain a text
5
+ Scenario: Ensure that the response page contains specific text
7
6
  Given I am on the homepage
8
7
  Then the response should contain "Welcome to the homepage"
9
8
 
10
- Scenario: Check response page if not contain a text
9
+ Scenario: Ensure that the response page does not contain specific text
11
10
  Given I am on the homepage
12
11
  Then the response should not contain "Access denied"
@@ -1,29 +1,29 @@
1
- Feature: An example to test a page response status code
2
- As a tester
3
- I want to be able to test a page response status code
1
+ Feature: An example to check the status code of a page response
2
+ As a tester,
3
+ I want to be able to check the status code of a page response
4
4
 
5
- Scenario: Check the response status code for not existing page page
5
+ Scenario: Check the response status code for a non-existing page
6
6
  Given I am on the homepage
7
7
  When I go to "/not-existing-page.html"
8
8
  And I wait max of 2 seconds
9
9
  Then the response status code should be 404
10
10
  And the response status code should not be 200
11
11
 
12
- Scenario: Check the response status code for existing page
12
+ Scenario: Check the response status code for an existing page
13
13
  Given I am on the homepage
14
14
  When I go to "/existing-page.html"
15
15
  And I wait max of 2 seconds
16
16
  Then the response status code should not be 404
17
17
  And the response status code should be 200
18
18
 
19
- Scenario: Check the response status code for an API with JSON page format
19
+ Scenario: Check the response status code for an API that returns a JSON format
20
20
  Given I am on the homepage
21
21
  When I go to "/example-api.json"
22
22
  And I wait max of 2 seconds
23
23
  Then the response status code should not be 404
24
24
  And the response status code should be 200
25
25
 
26
- Scenario: Check the response status code for a parameter of the API with JSON page format
26
+ Scenario: Check the response status code for a parameter in the API that returns JSON format
27
27
  Given I am on the homepage
28
28
  When I go to "/example-api.json?include=author"
29
29
  And I wait max of 2 seconds
@@ -1,7 +1,7 @@
1
- Feature: An example of testing for matching URLs for a particular expression
2
- As a tester
3
- I want to be able to be sure that current page PATH matches regular expression
1
+ Feature: An example of checking for matching URLs based on a specific pattern
2
+ As a tester,
3
+ I want to ensure that the current page path matches a specific pattern
4
4
 
5
- Scenario: Check the current page path matchs URL expression with dashes between words
5
+ Scenario: Ensure that the current page path matches the URL pattern that uses dashes between words
6
6
  Given I am on "/test-acceptable-url-path.html"
7
7
  Then the url should match "(https?:\/\/)?([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+\.[a-zA-Z]{2,}(:\d+)?(\/[^?#\s_]+)?(\?[^#\s_]+)?(#.*)?"
@@ -1,9 +1,9 @@
1
- Feature: An example to test attach file to field
1
+ Feature: An example of checking the attachment of a file to a field and uploading it
2
2
 
3
- As a tester
4
- I want to be able to attach file (images) to field
3
+ As a tester,
4
+ I want to be able to attach a file (e.g., images) to a field
5
5
 
6
- # Scenario: Check attach file to field
6
+ # Scenario: Checking the attachment of an image to a field and uploading it
7
7
  # Given I am on "/test--when--i-attach-file-to-feild.html"
8
8
  # When I attach the file "webshipco.png" to "#fileUpload"
9
9
  # When I press "Submit" by attr
@@ -1,22 +1,22 @@
1
- Feature: An example to uncheck the checkbox
1
+ Feature: An example of checking and unchecking a checkbox
2
2
 
3
- As a tester
4
- I want to be able to uncheck a checkbox
3
+ As a tester,
4
+ I want to be able to check and uncheck a checkbox
5
5
 
6
- Scenario: Uncheck the checkbox
6
+ Scenario: Implementing the ability to check and uncheck a checkbox
7
7
  Given I am on "/test--when--i-check-uncheck-checkbox.html"
8
- When I check "bike"
9
- And I check "car"
10
- And I press "Submit" by "value" attr
11
- Then I should see "You have a Bike Car"
12
- When I check "van"
13
- And I press "Submit" by "value" attr
14
- Then I should see "You have a Bike Car Van"
15
- When I uncheck "bike"
16
- And I press "Submit" by "value" attr
17
- Then I should see "You have a Car Van"
18
- When I uncheck "car"
19
- When I uncheck "van"
20
- And I press "Submit" by "value" attr
21
- Then I should see "You have a"
8
+ When I check "bike"
9
+ And I check "car"
10
+ And I press "Submit" by "value" attr
11
+ Then I should see "You have a Bike Car"
12
+ When I check "van"
13
+ And I press "Submit" by "value" attr
14
+ Then I should see "You have a Bike Car Van"
15
+ When I uncheck "bike"
16
+ And I press "Submit" by "value" attr
17
+ Then I should see "You have a Car Van"
18
+ When I uncheck "car"
19
+ When I uncheck "van"
20
+ And I press "Submit" by "value" attr
21
+ Then I should see "You have a"
22
22
 
@@ -1,21 +1,21 @@
1
- Feature: An example to click link by its attribute
1
+ Feature: An example of clicking a link by its attribute
2
2
 
3
- As a tester
4
- I want to be able to click link by its attribute
3
+ As a tester,
4
+ I want to be able to click a link by its attribute
5
5
 
6
- Scenario: Check click link by class attribute
6
+ Scenario: Verify the action of clicking a link by targeting its ID attribute
7
7
  Given I am on "/test--when--i-click-link.html"
8
8
  When I click "#aboutUsid" by attr
9
9
  And I wait max of 2 seconds
10
10
  Then I should see "About Us"
11
11
 
12
- Scenario: Check click link by its id attribute
12
+ Scenario: Verify the action of clicking a link by its ID attribute
13
13
  Given I am on "/test--when--i-click-link.html"
14
14
  When I click "aboutUsid" by its "id" attribute
15
15
  And I wait max of 2 seconds
16
16
  Then I should see "About Us"
17
17
 
18
- Scenario: Check click link by class attribute
18
+ Scenario: Verify the action of clicking a link by its class attribute
19
19
  Given I am on "/test--when--i-click-link.html"
20
20
  When I click "aboutUs" by "class" attr
21
21
  And I wait max of 2 seconds
@@ -1,9 +1,9 @@
1
- Feature: An example to click link
1
+ Feature: An example of clicking a link by its text
2
2
 
3
- As a tester
4
- I want to be able to click link
3
+ As a tester,
4
+ I want to be able to click a link based on its text
5
5
 
6
- Scenario: Check click link by link text
6
+ Scenario: Verify clicking a link by its text
7
7
  Given I am on "/test--when--i-click-link.html"
8
8
  When I click "About us link"
9
9
  And I wait max of 2 seconds
@@ -1,29 +1,29 @@
1
- Feature: An example of filling the input textbox with value by its attribute
2
- As a tester
3
- I want to be able to fill input text with value by its attribute
1
+ Feature: An example of filling an input textbox with a value using its attributes.
2
+ As a tester,
3
+ I want to fill an input field with a value using its attributes.
4
4
 
5
- Scenario: Check fill in input field with ready format attribute
5
+ Scenario: Fill in the input field using its ID and class attributes.
6
6
  Given I am on "/test--when--i-fill-in.html"
7
7
  When I fill in "#uname" with "John Smith" by attr
8
8
  And I fill in "pwordcss" with "1234" by its "class" attr
9
9
  When I press "Login"
10
10
  Then I should see "You enter Username: John Smith and Password: 1234"
11
11
 
12
- Scenario: Check fill in input field with value and placeholder attribute
12
+ Scenario: Fill in the input field using its placeholder attribute.
13
13
  Given I am on "/test--when--i-fill-in.html"
14
14
  When I fill in "Your full name" with "John Smith" by its "placeholder" attr
15
15
  And I fill in "Your Password" with "1234" by attr
16
16
  When I press "Login"
17
17
  Then I should see "You enter Username: John Smith and Password: 1234"
18
18
 
19
- Scenario: Check fill in value for input field
19
+ Scenario: Specify a value, then identify and use the field's attribute to fill in the input field.
20
20
  Given I am on "/test--when--i-fill-in.html"
21
21
  When I fill in "John Smith" for "#uname" by attr
22
22
  When I fill in "1234" for "pwordcss" by attr
23
23
  When I press "Login"
24
24
  Then I should see "You enter Username: John Smith and Password: 1234"
25
25
 
26
- Scenario: Check fill in input field with empty value
26
+ Scenario: Fill in the input field with an empty value using its attribute.
27
27
  Given I am on "/test--when--i-fill-in.html"
28
28
  When I fill in "#uname" with: by attribute
29
29
  And I fill in "password" with: by attr
@@ -1,8 +1,8 @@
1
- Feature: An example of filling the input text with value by attribute
2
- As a tester
3
- I want to be able to fill input text with value by attribute
1
+ Feature: An example of populating a table of input fields with values using their attributes.
2
+ As a tester,
3
+ I want to be able to fill input text fields with values using their attributes.
4
4
 
5
- Scenario: Check fill in table of input fields by different attribute
5
+ Scenario: Check the filling of a table of input fields using different attributes.
6
6
  Given I am on "/test--when--i-fill-in.html"
7
7
  When I fill in the following: by attr
8
8
  | #uname | John Smith |
@@ -10,7 +10,7 @@ I want to be able to fill input text with value by attribute
10
10
  When I press "Login"
11
11
  Then I should see "You enter Username: John Smith and Password: 1234"
12
12
 
13
- Scenario: Check fill in table of input fields by specific attribute
13
+ Scenario: Check the filling of a table of input fields using the placeholder attribute.
14
14
  Given I am on "/test--when--i-fill-in.html"
15
15
  When I fill in the following: by its "placeholder" attribute
16
16
  | Your full name | John Smith |
@@ -1,29 +1,29 @@
1
- Feature: An example of filling the input textbox with value
2
- As a tester
3
- I want to be able to fill input text with value
1
+ Feature: An example of filling an input textbox with a value using its label.
2
+ As a tester,
3
+ I want to be able to fill input text fields with values using their labels.
4
4
 
5
- Scenario: Check fill in input field with value
5
+ Scenario: Check filling an input field with a value using its label.
6
6
  Given I am on "/test--when--i-fill-in.html"
7
7
  When I fill in "Username" with "John Smith"
8
8
  When I fill in "Password" with "1234"
9
9
  When I press "Login"
10
10
  Then I should see "You enter Username: John Smith and Password: 1234"
11
11
 
12
- Scenario: Check fill in value for input field
12
+ Scenario: Check filling in a value for an input field using its label.
13
13
  Given I am on "/test--when--i-fill-in.html"
14
14
  When I fill in "John Smith" for "Username"
15
15
  When I fill in "1234" for "Password"
16
16
  When I press "Login"
17
17
  Then I should see "You enter Username: John Smith and Password: 1234"
18
18
 
19
- Scenario: Check fill in input field with empty value
19
+ Scenario: Check filling an input field with an empty value using its label.
20
20
  Given I am on "/test--when--i-fill-in.html"
21
21
  When I fill in "Username" with:
22
22
  And I fill in "Password" with:
23
23
  When I press "Login"
24
24
  Then I should see "You enter Username: and Password:"
25
25
 
26
- Scenario: Check fill in table of input fields
26
+ Scenario: Check filling a table of input fields using their labels.
27
27
  Given I am on "/test--when--i-fill-in.html"
28
28
  When I fill in the following:
29
29
  | Username | John Smith |
@@ -1,8 +1,10 @@
1
- Feature: An example to test for being on any page and go to homepage
2
- As an anonymous user
3
- I want to be able to navigate to the homepage from another page, So that I can check the welcome message at homepage
1
+ Feature: An example of testing whether the user is on any page and then navigating to the homepage.
2
+
3
+ As an anonymous user,
4
+ I want to be able to navigate to the homepage from another page,
5
+ so that I can check the welcome message on the homepage.
4
6
 
5
- Scenario: Check to be on (the) About Us page then go to home page
7
+ Scenario: Check if on the About Us page, then navigate to the homepage.
6
8
  Given I am on "/about-us.html"
7
9
  When I go to the homepage
8
10
  Then I should see "Welcome to the homepage of the Webship-js Examples"
@@ -1,7 +1,7 @@
1
- Feature: An example to navigate forward and backward one page
1
+ Feature: An example of navigating forward and backward by one page.
2
2
 
3
- As a tester
4
- I want to be able to navigate forward and backward one page
3
+ As a tester,
4
+ I want to be able to navigate forward and backward by one page.
5
5
 
6
6
  Scenario: Check to navigate forward and backward one page
7
7
  Given I am on the homepage
@@ -1,9 +1,9 @@
1
- Feature: An example to press a button
1
+ Feature: An example of pressing a button using its attributes.
2
2
 
3
- As a tester
4
- I want to be able to press a button
3
+ As a tester,
4
+ I want to be able to press a button using its attributes.
5
5
 
6
- Scenario: Verify clicking a button using its ID attribute.
6
+ Scenario: Verify that you can click a button using its ID attribute.
7
7
  Given I am on "/test--when--i-press-button.html"
8
8
  When I press "btn-pressid" by "id" attr
9
9
  Then I should see "Button Pressed Successfully"
@@ -1,9 +1,9 @@
1
- Feature: An example to press a button
1
+ Feature: An example of pressing a button by its label.
2
2
 
3
- As a tester
4
- I want to be able to press a button
3
+ As a tester,
4
+ I want to be able to press a button using its label.
5
5
 
6
- Scenario: Check press a button
6
+ Scenario: Check pressing a button using its label.
7
7
  Given I am on "/test--when--i-press-button.html"
8
8
  When I press "Submit"
9
9
  Then I should see "Button Pressed Successfully"
@@ -1,9 +1,9 @@
1
- Feature: An example to reload the page
1
+ Feature: An example of reloading the page.
2
2
 
3
- As a tester
4
- I want to be able to reload the page
3
+ As a tester,
4
+ I want to be able to reload the page.
5
5
 
6
- Scenario: Check to reload the page
6
+ Scenario: Check reloading the page.
7
7
  Given I am on "/test--when--i-reload-page.html"
8
8
  When I press "Submit" by attr
9
9
  Then I should see "Button Pressed Successfully"
@@ -1,15 +1,15 @@
1
- Feature: An example to select option from dropdown list by its attributes
1
+ Feature: An example of selecting an option from a dropdown list using its attributes.
2
2
 
3
- As a tester
4
- I want to be able to test select option from dropdown list by its attributes
3
+ As a tester,
4
+ I want to be able to test selecting an option from a dropdown list using its attributes.
5
5
 
6
- Scenario: Check of selecting option from dropdown list by its attributes
6
+ Scenario: Check selecting an option from a dropdown list using its attributes.
7
7
  Given I am on "/test--when--i-select-option-from-dropdownlist.html"
8
8
  When I select "Saab" from "#cars" by attr
9
9
  When I press "Submit"
10
10
  Then I should see "Option ( Saab ) has been selected successfully"
11
11
 
12
- Scenario: Check of selecting option from drop down list
12
+ Scenario: Check selecting an option from a dropdown list.
13
13
  Given I am on "/test--when--i-select-option-from-dropdownlist.html"
14
14
  When I select "Mercedes" from "cars" by its "id" attr
15
15
  When I press "Submit"
@@ -1,9 +1,9 @@
1
- Feature: An example to select the option in the dropdown list field by its text label
1
+ Feature: An example of selecting an option in the dropdown list by its text label.
2
2
 
3
- As a tester
4
- I want to be able to test select option from dropdown list by its text label
3
+ As a tester,
4
+ I want to be able to test selecting an option from a dropdown list by its text label.
5
5
 
6
- Scenario: Check of selecting option from dropdown list by its text label
6
+ Scenario: Check selecting an option from a dropdown list by its text label.
7
7
  Given I am on "/test--when--i-select-option-from-dropdownlist.html"
8
8
  When I select "Saab" from "Choose a car:"
9
9
  When I press "Submit" by attr
@@ -0,0 +1,9 @@
1
+ Feature: An example test to wait until the page is loaded.
2
+
3
+ As a tester,
4
+ I want to make sure that I can wait until a page is loaded.
5
+
6
+ Scenario: Check waiting for the page to load.
7
+ Given I am on "/test--when-i-wait-page-until-is-loaded.html"
8
+ And I wait until the page loaded
9
+ Then I should see "The waiting process was completed successfully."
@@ -1,14 +1,15 @@
1
- Feature: Example test for Wait a Specific/Max number of seconds/minutes for page load
2
- As a tester
3
- I want to make sure that I can wait for a page to load, an element to visible
1
+ Feature: An example test to wait for a specific maximum number of seconds/minutes for the page to load.
2
+
3
+ As a tester,
4
+ I want to make sure that I can wait for a page to load and for an element to become visible.
4
5
 
5
- Scenario: Check page content to load
6
+ Scenario: Check waiting 6 seconds for the page content to load.
6
7
  Given I am on the homepage
7
8
  When I go to "/test--when-i-wait-specific-time.html"
8
9
  And I wait 6 seconds
9
10
  Then I should see "Welcome with waiting full time"
10
11
 
11
- Scenario: Check page content to load
12
+ Scenario: Check waiting a maximum of 6 seconds for the page content to load.
12
13
  Given I am on the homepage
13
14
  When I go to "/test--when-i-wait-max-of-time.html"
14
15
  And I wait max of 6 seconds
@@ -2,7 +2,7 @@ const { Given} = require('@cucumber/cucumber');
2
2
  const { When, Before} = require('@cucumber/cucumber');
3
3
  const { Then} = require('@cucumber/cucumber');
4
4
 
5
- const request = require('request');
5
+ const axios = require('axios');
6
6
 
7
7
  /**
8
8
  * Opens homepage.
@@ -696,20 +696,7 @@ Then(/^(I|we)* should not see (a|an) "([^"]*)?" element by( its)*( "([^"]*)?")*
696
696
  * Example: Then the "body" element should contain "color:white;"
697
697
  *
698
698
  */
699
- Then(/^the "([^"]*)?" element should contain "([^"]*)?" css style$/, function (attrValue, elementCss) {
700
-
701
- const hasASpace = attrValue.indexOf(' ');
702
-
703
- var selector = '';
704
- if((attrValue.startsWith('#') || attrValue.startsWith('.')) && hasASpace == -1){
705
- selector = attrValue;
706
- }
707
- else if (hasASpace == -1){
708
- selector = attrValue + ',#' + attrValue + ',.' + attrValue + ',[name=' + attrValue + "]," + '[value="' + attrValue + '"],[placeholder="' + attrValue + '"]';
709
- }
710
- else if (hasASpace > -1){
711
- selector ='[value="' + attrValue + '"],[placeholder="' + attrValue + '"]';
712
- }
699
+ Then(/^the "([^"]*)?" element should contain "([^"]*)?"$/, function (selector, elementCss) {
713
700
 
714
701
  elementCss = elementCss.replace(";", '');
715
702
  const cssPropertyArr = elementCss.split(":");
@@ -724,24 +711,11 @@ Then(/^the "([^"]*)?" element should contain "([^"]*)?" css style$/, function (a
724
711
 
725
712
  /**
726
713
  * Assert, that element contains a specific CSS style
727
- * Example: Then the "body" element should not contain "color:white;" css style
728
- * Example: Then the "#uname" element should not contain "border:solid 5px red;" css style
729
- * Example: Then the "pword" element should not contain "font-size: 26px;" css style
714
+ * Example: Then the "body" element should not contain "color:white;"
715
+ * Example: Then the "#uname" element should not contain "border:solid 5px red;"
716
+ * Example: Then the "pword" element should not contain "font-size: 26px;"
730
717
  */
731
- Then(/^the "([^"]*)?" element should not contain "([^"]*)?" css style$/, function (attrValue, elementCss) {
732
-
733
- const hasASpace = attrValue.indexOf(' ');
734
-
735
- var selector = '';
736
- if((attrValue.startsWith('#') || attrValue.startsWith('.')) && hasASpace == -1){
737
- selector = attrValue;
738
- }
739
- else if (hasASpace == -1){
740
- selector = attrValue + ',#' + attrValue + ',.' + attrValue + ',[name=' + attrValue + "]," + '[value="' + attrValue + '"],[placeholder="' + attrValue + '"]';
741
- }
742
- else if (hasASpace > -1){
743
- selector ='[value="' + attrValue + '"],[placeholder="' + attrValue + '"]';
744
- }
718
+ Then(/^the "([^"]*)?" element should not contain "([^"]*)?"$/, function (selector, elementCss) {
745
719
 
746
720
  elementCss = elementCss.replace(";", '');
747
721
  const cssPropertyArr = elementCss.split(":");
@@ -760,19 +734,22 @@ Then(/^the "([^"]*)?" element should not contain "([^"]*)?" css style$/, functio
760
734
  *
761
735
  */
762
736
  When(/^(I|we)* attach the file "([^"]*)?" to "([^"]*)?"$/, function (pronoundCase, fileUrl, element) {
763
- // browser.setValue(element, require('path').resolve(__dirname + fileUrl));
737
+
764
738
  });
765
739
 
766
740
  /**
767
741
  * Assert, that field contain a specific text
768
- * Example: Then the "#username" field should contain "John Smith"
742
+ * Example: Then the "Username" field should contain "John Smith"
769
743
  *
770
744
  */
771
745
  Then(/^the "([^"]*)?" field should contain "([^"]*)?"$/, function (field, expectedText) {
772
746
 
773
- return this.shouldSee = function (browser) {
774
- browser.assert.textContains(field, expectedText);
775
- };
747
+ const elementField = browser.element.findByText(field);
748
+ browser.getAttribute(elementField, 'for', function (eleAttribute) {
749
+ return this.shouldSee = function (browser) {
750
+ browser.assert.textContains('#' + eleAttribute.value, expectedText);
751
+ };
752
+ });
776
753
  });
777
754
 
778
755
  /**
@@ -901,6 +878,14 @@ When(/^(I|we)* wait max of (\d*) minute(s)*$/, function (pronoundCase, number, w
901
878
  return browser.waitForElementPresent('body', waitTime);
902
879
  });
903
880
 
881
+ /**
882
+ * Wait until the page is loaded.
883
+ * Example: When I wait until the page is loaded
884
+ *
885
+ */
886
+ When(/^(I|we)* wait until the page( is)* loaded*$/, function (pronoundCase, withIs) {
887
+ return browser.waitForElementPresent('body', 10000);
888
+ });
904
889
  /**
905
890
  * Checks, that the current page response status is equal the specified code
906
891
  * Example: Then the response status code should be 200
@@ -908,8 +893,15 @@ When(/^(I|we)* wait max of (\d*) minute(s)*$/, function (pronoundCase, number, w
908
893
  */
909
894
  Then(/^the response status code should be (\d+)$/, function (expectedStatusCode) {
910
895
  return browser.url(function (currentURL) {
911
- request(currentURL.value, (error, response, body) => {
912
- browser.assert.equal(response.statusCode, expectedStatusCode);
896
+ axios.get(currentURL.value)
897
+ .then(function (response) {
898
+ browser.assert.equal(response.status, expectedStatusCode);
899
+ })
900
+ .catch(function (error) {
901
+ browser.assert.equal(error.status, expectedStatusCode);
902
+ })
903
+ .finally(function () {
904
+ // always executed
913
905
  });
914
906
  });
915
907
  });
@@ -921,8 +913,15 @@ Then(/^the response status code should be (\d+)$/, function (expectedStatusCode)
921
913
  */
922
914
  Then(/^the response status code should not be (\d+)$/, function ( expectedStatusCode) {
923
915
  return browser.url(function (currentURL) {
924
- request(currentURL.value, (error, response, body) => {
925
- browser.assert.not.equal(response.statusCode, expectedStatusCode);
916
+ axios.get(currentURL.value)
917
+ .then(function (response) {
918
+ browser.assert.not.equal(response.status, expectedStatusCode);
919
+ })
920
+ .catch(function (error) {
921
+ browser.assert.not.equal(error.status, expectedStatusCode);
922
+ })
923
+ .finally(function () {
924
+ // always executed
926
925
  });
927
926
  });
928
927
  });
@@ -960,13 +959,9 @@ Then(/^(I|we)* should not see text matching "([^"]*)?"$/, function (pronoundCase
960
959
  *
961
960
  */
962
961
  Then(/^(I|we)* should see text matching "([^"]*)?" in the "([^"]*)?" element$/, function (pronoundCase, textPattern, element) {
963
- // return browser.elements('css selector', element, function (elements) {
964
- // elements.value.forEach(function (elementsObj) {
965
962
  return this.shouldSeePattern = function (browser) {
966
963
  browser.assert.textMatches(element, textPattern);
967
964
  };
968
- // });
969
- // });
970
965
  });
971
966
 
972
967
  /**
@@ -976,15 +971,9 @@ Then(/^(I|we)* should see text matching "([^"]*)?" in the "([^"]*)?" element$/,
976
971
  *
977
972
  */
978
973
  Then(/^(I|we)* should not see text matching "([^"]*)?" in the "([^"]*)?" element$/, function (pronoundCase, textPattern, element) {
979
-
980
- // return browser.elements('css selector', element, function (elements) {
981
- // elements.value.forEach(function (elementsObj) {
982
974
  return this.shouldSeePattern = function (browser) {
983
975
  browser.assert.not.textMatches(element, textPattern);
984
976
  };
985
- // browser.assert.not.textMatches(elementsObj, textPattern);
986
- // });
987
- // });
988
977
  });
989
978
 
990
979
  /**