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.
- package/.circleci/config.yml +23 -18
- package/.github/workflows/github-actions.yml +12 -13
- package/.gitlab-ci.yml +9 -10
- package/examples/test--when-i-wait-max-of-time.html +1 -1
- package/examples/test--when-i-wait-page-until-is-loaded.html +47 -0
- package/examples/test--when-i-wait-specific-time.html +1 -1
- package/lib/custom-assertions/responseStatus.js +23 -5
- package/package.json +2 -2
- package/tests/features/test--given--i-am-on-homepage.feature +6 -6
- package/tests/features/test--then--i-should--not--see-text-in-element.feature +6 -5
- package/tests/features/test--then--i-should--see-text-in-element-by-attr.feature +8 -8
- package/tests/features/test--then--i-should--see-text-in-element.feature +8 -8
- package/tests/features/test--then--i-should--see-text-matching-pattern-in-element.feature +5 -5
- package/tests/features/test--then--i-should--see-text-matching-pattern.feature +6 -6
- package/tests/features/test--then--i-should-be-on-page.feature +8 -8
- package/tests/features/test--then--i-should-be-on-the-homepage.feature +8 -8
- package/tests/features/test--then--i-should-not-see-an-element-by-attr.feature +4 -4
- package/tests/features/test--then--i-should-not-see-an-element.feature +4 -4
- package/tests/features/test--then--i-should-see-an-element-by-attr.feature +4 -4
- package/tests/features/test--then--i-should-see-an-element.feature +3 -3
- package/tests/features/test--then--the-checkbox-is-checked.feature +4 -4
- package/tests/features/test--then--the-checkbox-should-be-checked.feature +12 -12
- package/tests/features/test--then--the-element-should-contain-cssproperty.feature +7 -7
- package/tests/features/test--then--the-element-should-not-contain-cssproperty.feature +8 -8
- package/tests/features/test--then--the-field-should-contain-value.feature +9 -9
- package/tests/features/test--then--the-response-should-contain.feature +5 -6
- package/tests/features/test--then--the-response-status-code-should-be.feature +7 -7
- package/tests/features/test--then--the-url-should-match.feature +4 -4
- package/tests/features/test--when--i-attach-file-to-feild.feature +4 -4
- package/tests/features/test--when--i-check-checkbox.feature +18 -18
- package/tests/features/test--when--i-click-link-by-attribute.feature +6 -6
- package/tests/features/test--when--i-click-link.feature +4 -4
- package/tests/features/test--when--i-fill-in-by-attr.feature +7 -7
- package/tests/features/test--when--i-fill-in-table-by-attr.feature +5 -5
- package/tests/features/test--when--i-fill-in.feature +7 -7
- package/tests/features/test--when--i-go-to-homepage.feature +6 -4
- package/tests/features/test--when--i-move-forward-backward-one-page.feature +3 -3
- package/tests/features/test--when--i-press-button-by-attribute.feature +4 -4
- package/tests/features/test--when--i-press-button.feature +4 -4
- package/tests/features/test--when--i-reload-page.feature +4 -4
- package/tests/features/test--when--i-select-option-from-dropdownlist-by-attr.feature +5 -5
- package/tests/features/test--when--i-select-option-from-dropdownlist.feature +4 -4
- package/tests/features/test--when--i-wait-page-is-loaded.feature +9 -0
- package/tests/features/test--when--i-wait-time.feature +6 -5
- package/tests/step-definitions/webship.js +40 -51
package/.circleci/config.yml
CHANGED
|
@@ -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
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
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
|
-
|
|
56
|
-
echo $
|
|
57
|
-
wget
|
|
58
|
-
unzip
|
|
59
|
-
sudo chmod +x chromedriver
|
|
60
|
-
sudo mv -f chromedriver /usr/bin/
|
|
61
|
-
rm
|
|
62
|
-
|
|
63
|
-
|
|
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
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
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
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
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://
|
|
25
|
-
- sudo dpkg -i google-chrome-
|
|
26
|
-
- rm google-chrome-
|
|
27
|
-
-
|
|
28
|
-
-
|
|
29
|
-
-
|
|
30
|
-
- sudo
|
|
31
|
-
-
|
|
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
|
|
@@ -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>
|
|
@@ -1,13 +1,31 @@
|
|
|
1
|
-
const
|
|
1
|
+
const axios = require('axios');
|
|
2
2
|
|
|
3
3
|
module.exports.assertion = function (negativeCase, expectedStatusCode) {
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
browser.url(function (currentURL) {
|
|
6
6
|
request(currentURL.value, (error, response, body) => {
|
|
7
7
|
if (negativeCase) {
|
|
8
|
-
return
|
|
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
|
|
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.
|
|
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
|
-
"
|
|
45
|
+
"axios": "~1"
|
|
46
46
|
},
|
|
47
47
|
"bin": {
|
|
48
48
|
"steplist": "./steplist.js"
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
Feature: An example
|
|
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
|
-
|
|
4
|
+
so that I can check the welcome message on the homepage.
|
|
5
5
|
|
|
6
|
-
Scenario:
|
|
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:
|
|
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:
|
|
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
|
|
2
|
-
As a tester
|
|
3
|
-
I want to
|
|
4
|
-
|
|
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
|
-
|
|
13
|
+
And I should not see "1234" in the "pword" element by attr
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
Feature: An example to
|
|
2
|
-
As a tester
|
|
3
|
-
I want to
|
|
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:
|
|
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
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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
|
|
2
|
-
As a tester
|
|
3
|
-
I want to
|
|
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:
|
|
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
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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
|
|
2
|
-
As a developer
|
|
3
|
-
I want to
|
|
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:
|
|
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:
|
|
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
|
|
2
|
-
As a developer
|
|
3
|
-
I want to
|
|
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:
|
|
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:
|
|
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:
|
|
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
|
|
2
|
-
As an anonymous user
|
|
3
|
-
I want to
|
|
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:
|
|
5
|
+
Scenario: Ensure that you are on a specific page
|
|
6
6
|
Given I am on the homepage
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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
|
|
2
|
-
As an anonymous user
|
|
3
|
-
I want to
|
|
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:
|
|
5
|
+
Scenario: Ensure that you are on the homepage
|
|
6
6
|
Given I am on the homepage
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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
|
|
2
|
-
As a user
|
|
3
|
-
I want to
|
|
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:
|
|
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
|
|
2
|
-
As a user
|
|
3
|
-
I want to
|
|
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:
|
|
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
|
|
2
|
-
As a user
|
|
3
|
-
I want to make sure that when I'm on a particular page, I
|
|
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:
|
|
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
|
|
2
|
-
As a user
|
|
3
|
-
I want to
|
|
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:
|
|
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:
|
|
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
|
|
2
|
-
As an anonymous user
|
|
3
|
-
I want to
|
|
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:
|
|
5
|
+
Scenario: Ensure that the checkbox is checked
|
|
6
6
|
Given I am on "/test--then--the-checkbox-checked.html"
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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:
|
|
12
|
+
Scenario: Ensure that the checkbox is not checked
|
|
13
13
|
Given I am on "/test--then--the-checkbox-checked.html"
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
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
|
|
2
|
-
As a developer
|
|
3
|
-
I want to
|
|
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:
|
|
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
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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
|
|
2
|
-
As a developer
|
|
3
|
-
I want to
|
|
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:
|
|
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
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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
|
|
2
|
-
As a tester
|
|
3
|
-
I want to
|
|
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:
|
|
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
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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
|
|
2
|
-
As a tester,
|
|
3
|
-
I want to
|
|
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:
|
|
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:
|
|
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
|
|
2
|
-
As a tester
|
|
3
|
-
I want to be able to
|
|
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
|
|
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
|
|
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
|
|
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
|
|
2
|
-
As a tester
|
|
3
|
-
I want to
|
|
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:
|
|
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
|
|
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:
|
|
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
|
|
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:
|
|
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
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
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
|
|
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:
|
|
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:
|
|
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:
|
|
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
|
|
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:
|
|
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
|
|
2
|
-
As a tester
|
|
3
|
-
I want to
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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
|
|
2
|
-
As a tester
|
|
3
|
-
I want to be able to fill input text with
|
|
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
|
|
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
|
|
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
|
|
2
|
-
As a tester
|
|
3
|
-
I want to be able to fill input text with
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
2
|
-
|
|
3
|
-
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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:
|
|
2
|
-
|
|
3
|
-
|
|
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
|
|
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 "([^"]*)?"
|
|
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;"
|
|
728
|
-
* Example: Then the "#uname" element should not contain "border:solid 5px red;"
|
|
729
|
-
* Example: Then the "pword" element should not contain "font-size: 26px;"
|
|
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 "([^"]*)?"
|
|
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
|
-
|
|
737
|
+
|
|
764
738
|
});
|
|
765
739
|
|
|
766
740
|
/**
|
|
767
741
|
* Assert, that field contain a specific text
|
|
768
|
-
* Example: Then the "
|
|
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
|
-
|
|
774
|
-
|
|
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
|
-
|
|
912
|
-
|
|
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
|
-
|
|
925
|
-
|
|
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
|
/**
|