webship-js 1.0.19 → 1.0.22
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 +2 -2
- package/bitbucket-pipelines.yml +26 -0
- package/examples/example-api.json +28 -0
- package/examples/existing-page.html +11 -0
- package/examples/index.html +2 -2
- package/examples/test--then--i-should--see-text-matching-pattern.html +31 -0
- package/examples/{test--when--i-follow-link.html → test--when--i-click-link.html} +3 -3
- package/examples/test--when--i-press-button.html +1 -1
- package/examples/test--when--i-reload-page.html +1 -1
- package/lib/custom-assertions/textMatching.js +12 -0
- package/lib/custom-commands/smartClickLink.js +23 -0
- package/lib/custom-commands/smartSelectOption.js +8 -8
- package/nightwatch.conf.js +1 -1
- package/package.json +5 -6
- package/tests/features/test--given--i-am-on-homepage.feature +8 -8
- package/tests/features/test--then--i-should--not--see-text-in-element.feature +10 -6
- package/tests/features/test--then--i-should--see-text-matching-pattern-in-element.feature +18 -0
- package/tests/features/test--then--i-should--see-text-matching-pattern.feature +18 -0
- package/tests/features/test--then--i-should-be-on-page.feature +6 -6
- package/tests/features/test--then--i-should-be-on-the-homepage.feature +5 -4
- package/tests/features/test--then--i-should-see-an-element.feature +4 -5
- package/tests/features/test--then--the-checkbox-is-checked.feature +18 -0
- package/tests/features/test--then--the-checkbox-should-be-checked.feature +16 -0
- package/tests/features/test--then--the-element-should_not-contain-cssproperty.feature +11 -8
- package/tests/features/test--then--the-field-should-contain-value.feature +3 -4
- package/tests/features/test--then--the-response-should-contain.feature +3 -3
- package/tests/features/test--then--the-response-status-code-should-be.feature +31 -0
- package/tests/features/test--when--i-attach-file-to-feild.feature +5 -5
- package/tests/features/test--when--i-check-checkbox.feature +4 -4
- package/tests/features/test--when--i-click-link.feature +16 -0
- package/tests/features/test--when--i-fill-in.feature +13 -18
- package/tests/features/test--when--i-move-forward-backward-one-page.feature +8 -7
- package/tests/features/test--when--i-press-button.feature +7 -9
- package/tests/features/test--when--i-reload-page.feature +5 -7
- package/tests/features/test--when--i-select-option-from-dropdownlist.feature +12 -0
- package/tests/features/test--when--i-uncheck-checkbox.feature +5 -7
- package/tests/features/test--when--i-wait-time.feature +2 -2
- package/tests/step-definitions/webship.js +161 -111
- package/bitbucket-pipelines-test.yml +0 -34
- package/lib/custom-commands/smartLinkFollow.js +0 -17
- package/tests/features/test--then--i-should-see-text-matching.feature +0 -8
- package/tests/features/test--then--the-checkbox-checked.feature +0 -16
- package/tests/features/test--when--i-follow-link.feature +0 -13
- package/tests/features/test--when--i-select-option-from-selectbox.feature +0 -13
- /package/examples/{test--when--i-select-option-from-selectbox.html → test--when--i-select-option-from-dropdownlist.html} +0 -0
package/.circleci/config.yml
CHANGED
|
@@ -62,9 +62,9 @@ commands:
|
|
|
62
62
|
- run:
|
|
63
63
|
name: Run Selenium Standalone server
|
|
64
64
|
command: |
|
|
65
|
-
if [[ ! -f /home/circleci/selenium-server-
|
|
65
|
+
if [[ ! -f /home/circleci/selenium-server-4.1.2.jar ]]; then wget -O /home/circleci/selenium-server-4.1.2.jar https://github.com/SeleniumHQ/selenium/releases/download/selenium-4.1.0/selenium-server-4.1.2.jar; fi
|
|
66
66
|
cd /home/circleci/
|
|
67
|
-
java -jar selenium-server-
|
|
67
|
+
java -jar selenium-server-4.1.2.jar standalone
|
|
68
68
|
background: true
|
|
69
69
|
|
|
70
70
|
jobs:
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
image: node:16 # Choose an appropriate Node.js version
|
|
2
|
+
|
|
3
|
+
pipelines:
|
|
4
|
+
default:
|
|
5
|
+
- step:
|
|
6
|
+
name: Install and Test
|
|
7
|
+
caches:
|
|
8
|
+
- node
|
|
9
|
+
script:
|
|
10
|
+
- npm install # Install your Node.js dependencies
|
|
11
|
+
- npm install selenium-webdriver --save # Install the Selenium WebDriver
|
|
12
|
+
- npm install chromedriver --save # Install ChromeDriver (for running tests in Chrome)
|
|
13
|
+
# Add other dependencies as needed
|
|
14
|
+
|
|
15
|
+
# Set up your test environment here (e.g., starting a server, configuring the application)
|
|
16
|
+
# For example, if you have a start script defined in your package.json:
|
|
17
|
+
# - npm run start & # Start your server in the background
|
|
18
|
+
|
|
19
|
+
# Run your tests here, assuming you have a test script defined in your package.json:
|
|
20
|
+
- yarn install
|
|
21
|
+
- yarn test
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"data": [{
|
|
3
|
+
"type": "articles",
|
|
4
|
+
"id": "1",
|
|
5
|
+
"attributes": {
|
|
6
|
+
"title": "JSON:API paints my bikeshed!",
|
|
7
|
+
"body": "The shortest article. Ever.",
|
|
8
|
+
"created": "2015-05-22T14:56:29.000Z",
|
|
9
|
+
"updated": "2015-05-22T14:56:28.000Z"
|
|
10
|
+
},
|
|
11
|
+
"relationships": {
|
|
12
|
+
"author": {
|
|
13
|
+
"data": {"id": "42", "type": "people"}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}],
|
|
17
|
+
"included": [
|
|
18
|
+
{
|
|
19
|
+
"type": "people",
|
|
20
|
+
"id": "42",
|
|
21
|
+
"attributes": {
|
|
22
|
+
"name": "John",
|
|
23
|
+
"age": 80,
|
|
24
|
+
"gender": "male"
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
]
|
|
28
|
+
}
|
package/examples/index.html
CHANGED
|
@@ -17,9 +17,9 @@
|
|
|
17
17
|
<li><a href="about-us.html">About Us</a></li>
|
|
18
18
|
<li><a href="test--when--i-press-button.html">When I press "Button"</a></li>
|
|
19
19
|
<li><a href="test--when--i-reload-page.html">When I go reload page</a></li>
|
|
20
|
-
<li><a href="test--when--i-
|
|
20
|
+
<li><a href="test--when--i-click-link.html">When I click "link"</a></li>
|
|
21
21
|
<li><a href="test--when--i-fill-in.html">When I fill in input text with value</a></li>
|
|
22
|
-
<li><a href="test--when--i-select-option-from-
|
|
22
|
+
<li><a href="test--when--i-select-option-from-dropdownlist.html">When I select option from select box</a></li>
|
|
23
23
|
<li><a href="test--then--i-should--not--see-text-in-element.html">Then I sould (not) see test in element</a></li>
|
|
24
24
|
<li><a href="test--then--the-element-should_not-contain-cssproperty.html">Then the element should (not) contain css property</a></li>
|
|
25
25
|
<li><a href="test--then--the-checkbox-checked.html">Then the checkbox (is/should be) (not) checked</a></li>
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
|
|
4
|
+
<head>
|
|
5
|
+
<meta charset='utf-8'>
|
|
6
|
+
<title>Text Matching Pattern</title>
|
|
7
|
+
<style>
|
|
8
|
+
.container,
|
|
9
|
+
.container input,
|
|
10
|
+
.container button {
|
|
11
|
+
font-size: 26px;
|
|
12
|
+
}
|
|
13
|
+
</style>
|
|
14
|
+
|
|
15
|
+
</head>
|
|
16
|
+
|
|
17
|
+
<body>
|
|
18
|
+
<h1>Text Matching Pattern</h1>
|
|
19
|
+
|
|
20
|
+
<div class="container">
|
|
21
|
+
<p>Email:</p><p>info@webship.co</p>
|
|
22
|
+
<p>Telephone:</p><p>0796-778899</p>
|
|
23
|
+
<p>Password conditions:</p><p>Pa$$word2023</p>
|
|
24
|
+
<div class="time"><p>Time:</p><p>10:30 AM</p></div>
|
|
25
|
+
<div id="date"><p>Date (Number):</p><p>22-03-2023</p></div>
|
|
26
|
+
<div id="countryCode"><p>Country code:</p><p id="ccode">JOR</p></div>
|
|
27
|
+
</div>
|
|
28
|
+
|
|
29
|
+
</body>
|
|
30
|
+
|
|
31
|
+
</html>
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
<html>
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset='utf-8'>
|
|
5
|
-
<title>
|
|
5
|
+
<title>Click Link</title>
|
|
6
6
|
<style>
|
|
7
7
|
.style{
|
|
8
8
|
font-size: 26px;
|
|
@@ -10,9 +10,9 @@
|
|
|
10
10
|
</style>
|
|
11
11
|
</head>
|
|
12
12
|
<body>
|
|
13
|
-
<h1>
|
|
13
|
+
<h1>Click Link</h1>
|
|
14
14
|
<div id="result" class="style">
|
|
15
|
-
Please click <a id="
|
|
15
|
+
Please click <a id="aboutUsid" class="aboutUs" href="about-us.html">About us link</a> for more information.
|
|
16
16
|
</div>
|
|
17
17
|
</body>
|
|
18
18
|
</html>
|
|
@@ -23,6 +23,6 @@
|
|
|
23
23
|
<h1>Press Button</h1>
|
|
24
24
|
<div id="result" class="style"></div><br/>
|
|
25
25
|
<label for="btnClickid">Press button</label>
|
|
26
|
-
<input id="btnClickid" class="btnClickclass" name="btnClickname" type="button" value="
|
|
26
|
+
<input id="btnClickid" class="btnClickclass" name="btnClickname" type="button" value="Submit" onclick="onClick()">
|
|
27
27
|
</body>
|
|
28
28
|
</html>
|
|
@@ -22,6 +22,6 @@
|
|
|
22
22
|
<body>
|
|
23
23
|
<h1>Press Button</h1>
|
|
24
24
|
<div id="result" class="style"></div><br/>
|
|
25
|
-
<input id="btnClick" class="btnClick" name="btnClick" type="button" value="
|
|
25
|
+
<input id="btnClick" class="btnClick" name="btnClick" type="button" value="Submit" onclick="onClick()">
|
|
26
26
|
</body>
|
|
27
27
|
</html>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
|
|
2
|
+
module.exports.assertion = function (negativeCase, textPattern, element) {
|
|
3
|
+
|
|
4
|
+
browser.elements('css selector', element, function (elements) {
|
|
5
|
+
elements.value.forEach(function (elementsObj) {
|
|
6
|
+
if (negativeCase) {
|
|
7
|
+
return browser.assert.not.textMatches(elementsObj, textPattern);
|
|
8
|
+
}
|
|
9
|
+
return browser.assert.textMatches(elementsObj, textPattern);
|
|
10
|
+
});
|
|
11
|
+
});
|
|
12
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
|
|
2
|
+
module.exports.command = function (item) {
|
|
3
|
+
|
|
4
|
+
browser.element('css selector', item, function (result) {
|
|
5
|
+
if (result.status === 0) {
|
|
6
|
+
return browser.click(item);
|
|
7
|
+
} else {
|
|
8
|
+
browser.element('css selector', '#' + item, function (result) {
|
|
9
|
+
if (result.status === 0) {
|
|
10
|
+
return browser.click('#' + item);
|
|
11
|
+
} else {
|
|
12
|
+
browser.element('css selector', '.' + item, function (result) {
|
|
13
|
+
if (result.status === 0) {
|
|
14
|
+
return browser.click('.' + item);
|
|
15
|
+
} else {
|
|
16
|
+
return browser.click("link text", item);
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
}
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
|
|
2
|
-
module.exports.command = function (option,
|
|
2
|
+
module.exports.command = function (option, dropdownlist) {
|
|
3
3
|
|
|
4
|
-
browser.element('css selector',
|
|
4
|
+
browser.element('css selector', dropdownlist, function (result) {
|
|
5
5
|
if (result.status === 0) {
|
|
6
|
-
return browser.click(
|
|
6
|
+
return browser.click(dropdownlist + ' option[value=' + option + ']');
|
|
7
7
|
} else {
|
|
8
|
-
browser.element('css selector', '#' +
|
|
8
|
+
browser.element('css selector', '#' + dropdownlist, function (result) {
|
|
9
9
|
if (result.status === 0) {
|
|
10
|
-
return browser.click('#' +
|
|
10
|
+
return browser.click('#' + dropdownlist + ' option[value=' + option + ']');
|
|
11
11
|
} else {
|
|
12
|
-
browser.element('css selector', 'select[name=' +
|
|
12
|
+
browser.element('css selector', 'select[name=' + dropdownlist + ']', function (result) {
|
|
13
13
|
if (result.status === 0) {
|
|
14
|
-
return browser.click('select[name=' +
|
|
14
|
+
return browser.click('select[name=' + dropdownlist + ']' + ' option[value=' + option + ']');
|
|
15
15
|
} else {
|
|
16
16
|
browser.elements('css selector', 'label', function (elements) {
|
|
17
17
|
elements.value.forEach(function (elementsObj) {
|
|
18
18
|
browser.elementIdText(elementsObj.ELEMENT, function (result) {
|
|
19
|
-
if (result.value ==
|
|
19
|
+
if (result.value == dropdownlist) {
|
|
20
20
|
browser.getAttribute(elementsObj, "for", function (forVal) {
|
|
21
21
|
return browser.click('#' + forVal.value + ' option[value=' + option + ']');
|
|
22
22
|
});
|
package/nightwatch.conf.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "webship-js",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.22",
|
|
4
4
|
"description": "Webship JS automated functional testing.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"directories": {
|
|
@@ -37,15 +37,14 @@
|
|
|
37
37
|
"eslint-config-airbnb-base": "~15.0",
|
|
38
38
|
"eslint-plugin-import": "~2.25",
|
|
39
39
|
"lodash": "~4.17.21",
|
|
40
|
-
"webpack": "~5.0"
|
|
41
|
-
},
|
|
42
|
-
"devDependencies": {
|
|
40
|
+
"webpack": "~5.0",
|
|
43
41
|
"chromedriver": "*",
|
|
44
42
|
"geckodriver": "*",
|
|
45
43
|
"webpack-cli": "~5.0",
|
|
46
|
-
"webpack-dev-server": "~4.0"
|
|
44
|
+
"webpack-dev-server": "~4.0",
|
|
45
|
+
"request": "~2.0"
|
|
47
46
|
},
|
|
48
47
|
"bin": {
|
|
49
48
|
"steplist": "./steplist.js"
|
|
50
49
|
}
|
|
51
|
-
}
|
|
50
|
+
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
Feature:
|
|
2
|
-
As
|
|
3
|
-
I want to be able to navigate to the homepage
|
|
4
|
-
So that I can check the welcome message at homepage
|
|
1
|
+
Feature: An example to test for being on the homepage
|
|
2
|
+
As an anonymous user
|
|
3
|
+
I want to be able to navigate to the homepage
|
|
4
|
+
So that I can check the welcome message at homepage
|
|
5
5
|
|
|
6
|
-
Scenario: Check the homepage
|
|
6
|
+
Scenario: Check being on the 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
|
|
10
|
+
Scenario: Check being on homepage
|
|
11
11
|
Given I am on homepage
|
|
12
|
-
|
|
12
|
+
Then I should see "Welcome to the homepage of the Webship-js Examples"
|
|
@@ -1,13 +1,17 @@
|
|
|
1
|
-
Feature:
|
|
2
|
-
As a
|
|
3
|
-
I want to be able to check an element
|
|
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
|
|
4
4
|
|
|
5
|
-
Scenario: Check an element if it
|
|
6
|
-
Given I am on
|
|
7
|
-
When I go to "test--then--i-should--not--see-text-in-element.html"
|
|
5
|
+
Scenario: Check an element if it contains a specific text
|
|
6
|
+
Given I am on "/test--then--i-should--not--see-text-in-element.html"
|
|
8
7
|
And I fill in "Username" with "user1"
|
|
9
8
|
And I fill in "Password" with "1234"
|
|
10
9
|
Then I should see "user1" in the "Username" element
|
|
11
10
|
When I press "Reset"
|
|
12
11
|
And I fill in "Username" with "user2"
|
|
13
12
|
Then I should not see "user1" in the "Username" element
|
|
13
|
+
|
|
14
|
+
Scenario: Check an element if it does not contain a specific text
|
|
15
|
+
Given I am on "/test--then--i-should--not--see-text-in-element.html"
|
|
16
|
+
And I fill in "Username" with "user2"
|
|
17
|
+
Then I should not see "user1" in the "Username" element
|
|
@@ -0,0 +1,18 @@
|
|
|
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.
|
|
4
|
+
|
|
5
|
+
Scenario: Check if text exist in an element has a pattern match with 12-hour time format
|
|
6
|
+
Given I am on "/test--then--i-should--see-text-matching-pattern.html"
|
|
7
|
+
And I wait max of 3 seconds
|
|
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
|
+
|
|
10
|
+
Scenario: Check if text exist in an element has a pattern not match with date YYYY-MM-DD
|
|
11
|
+
Given I am on "/test--then--i-should--see-text-matching-pattern.html"
|
|
12
|
+
And I wait max of 3 seconds
|
|
13
|
+
Then I should not see text matching "\d{4}[\/\-](0?[1-9]|1[012])[\/\-](0?[1-9]|[12][0-9]|3[01])" in the "#date" element
|
|
14
|
+
|
|
15
|
+
Scenario: Check if text exist in an element has a pattern match with date DD/MM/YYYY or DD-MM-YYYY
|
|
16
|
+
Given I am on "/test--then--i-should--see-text-matching-pattern.html"
|
|
17
|
+
And I wait max of 3 seconds
|
|
18
|
+
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
|
|
@@ -0,0 +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.
|
|
4
|
+
|
|
5
|
+
Scenario: Check if exist a text has a pattern match with text start with "T"
|
|
6
|
+
Given I am on "/test--then--i-should--see-text-matching-pattern.html"
|
|
7
|
+
And I wait max of 3 seconds
|
|
8
|
+
Then I should see text matching "^T\w+"
|
|
9
|
+
|
|
10
|
+
Scenario: Check if not exist a text has a pattern match with text start with "O"
|
|
11
|
+
Given I am on "/test--then--i-should--see-text-matching-pattern.html"
|
|
12
|
+
And I wait max of 3 seconds
|
|
13
|
+
Then I should not see text matching "^O\w+"
|
|
14
|
+
|
|
15
|
+
Scenario: Check if exist a text has a pattern match with Email
|
|
16
|
+
Given I am on "/test--then--i-should--see-text-matching-pattern.html"
|
|
17
|
+
And I wait max of 3 seconds
|
|
18
|
+
Then I should see text matching "[a-z0-9]+@[a-z]+\.[a-z]{2,3}"
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
Feature:
|
|
2
|
-
As
|
|
3
|
-
I want to be sure I am on
|
|
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
|
|
4
4
|
|
|
5
|
-
Scenario: Check
|
|
5
|
+
Scenario: Check being 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"
|
|
7
|
+
When I go to "/about-us.html"
|
|
8
|
+
Then I should be on "/about-us.html"
|
|
9
9
|
When I move backward one page
|
|
10
10
|
Then I should be on "/"
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
Feature:
|
|
2
|
-
As
|
|
1
|
+
Feature: An example to test being on the homepage
|
|
2
|
+
As an anonymous user
|
|
3
3
|
I want to be sure I am on the homepage
|
|
4
4
|
|
|
5
|
-
Scenario: Check
|
|
5
|
+
Scenario: Check being on the homepage
|
|
6
6
|
Given I am on the homepage
|
|
7
|
-
When I go to "about-us.html"
|
|
7
|
+
When I go to "/about-us.html"
|
|
8
8
|
And I move backward one page
|
|
9
|
+
And I wait max of 3 seconds
|
|
9
10
|
Then I should be on the homepage
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
Feature:
|
|
2
|
-
As a
|
|
1
|
+
Feature: An example to test seeing for a specific element on current page
|
|
2
|
+
As a user
|
|
3
3
|
I want to make sure that when I'm on a particular page, I should see a specific element
|
|
4
4
|
|
|
5
|
-
Scenario: Check
|
|
6
|
-
Given I am on
|
|
7
|
-
When I go to "about-us.html"
|
|
5
|
+
Scenario: Check to test seeing for a specific element
|
|
6
|
+
Given I am on "/about-us.html"
|
|
8
7
|
Then I should see a "body" element
|
|
9
8
|
And I should see a "#paragraphid" element
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
Feature: An example of test for selecting a checkbox
|
|
2
|
+
As a tester
|
|
3
|
+
I want to be able to check that the checkbox is checked or not
|
|
4
|
+
|
|
5
|
+
Scenario: Check that the checkbox is checked
|
|
6
|
+
Given I am on "/test--then--the-checkbox-checked.html"
|
|
7
|
+
When I check "rememberMe"
|
|
8
|
+
And I check "PrivacyPolicy"
|
|
9
|
+
And I press "Register"
|
|
10
|
+
Then the checkbox "Remember me" is checked
|
|
11
|
+
And I should see "Registration Done Successfully"
|
|
12
|
+
|
|
13
|
+
Scenario: Check that the checkbox is not checked
|
|
14
|
+
Given I am on "/test--then--the-checkbox-checked.html"
|
|
15
|
+
When I check "PrivacyPolicy"
|
|
16
|
+
And I press "Register"
|
|
17
|
+
Then the checkbox "Remember me" is not checked
|
|
18
|
+
Then I should see "Registration Done Successfully"
|
|
@@ -0,0 +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.
|
|
4
|
+
|
|
5
|
+
Scenario: Check that the checkbox should be checked
|
|
6
|
+
Given I am on "/test--then--the-checkbox-checked.html"
|
|
7
|
+
When I check "PrivacyPolicy"
|
|
8
|
+
And I press "Register"
|
|
9
|
+
Then the checkbox "PrivacyPolicy" should be checked
|
|
10
|
+
And I should see "Registration Done Successfully"
|
|
11
|
+
|
|
12
|
+
Scenario: Check that the checkbox should not be checked
|
|
13
|
+
Given I am on "/test--then--the-checkbox-checked.html"
|
|
14
|
+
When I press "Register"
|
|
15
|
+
Then the "PrivacyPolicy" checkbox should not be checked
|
|
16
|
+
And I should see "Please check Agree to Privacy Policy"
|
|
@@ -1,12 +1,15 @@
|
|
|
1
|
-
Feature:
|
|
1
|
+
Feature: An example to test if the element contains a certain expected CSS property or not.
|
|
2
2
|
As a developer
|
|
3
|
-
I want to be able to test if element contains
|
|
3
|
+
I want to be able to test if the element contains a certain expected CSS property or not.
|
|
4
4
|
|
|
5
|
-
Scenario: Check element if contains
|
|
6
|
-
Given I am on
|
|
7
|
-
|
|
8
|
-
Then the "body" element should contain "background-color: lightcoral;"
|
|
9
|
-
And the "Username" element should contain "border: solid 5px red;"
|
|
5
|
+
Scenario: Check element if the element contains a certain expected CSS property
|
|
6
|
+
Given I am on "/test--then--the-element-should_not-contain-cssproperty.html"
|
|
7
|
+
Then I should see a "body" element
|
|
10
8
|
When I press "Submit"
|
|
11
9
|
Then the "body" element should contain "background-color: white;"
|
|
12
|
-
|
|
10
|
+
|
|
11
|
+
Scenario: Check element if the element not contains a certain CSS property
|
|
12
|
+
Given I am on "/test--then--the-element-should_not-contain-cssproperty.html"
|
|
13
|
+
Then I should see a "body" element
|
|
14
|
+
When I press "Submit"
|
|
15
|
+
Then the "Username" element should not contain "border: solid 5px red;"
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
Feature:
|
|
1
|
+
Feature: An example to test if the field contains certain value
|
|
2
2
|
As a tester
|
|
3
|
-
I want to be able to check field if has a
|
|
3
|
+
I want to be able to check field if has a certain value or not
|
|
4
4
|
|
|
5
5
|
Scenario: Check field if has a particular value or not
|
|
6
|
-
Given I am on
|
|
7
|
-
When I go to "test--then--i-should--not--see-text-in-element.html"
|
|
6
|
+
Given I am on "/test--then--i-should--not--see-text-in-element.html"
|
|
8
7
|
And I fill in "Username" with "user1"
|
|
9
8
|
Then the "Username" field should contain "user1"
|
|
10
9
|
When I press "Reset"
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
Feature:
|
|
1
|
+
Feature: An example to test response page if contain a text
|
|
2
2
|
As a tester,
|
|
3
3
|
I want to be able to navigate to a page
|
|
4
4
|
So that I can check if this page contains a specific text
|
|
5
5
|
|
|
6
|
-
Scenario: Check
|
|
6
|
+
Scenario: Check response page if contain a text
|
|
7
7
|
Given I am on the homepage
|
|
8
8
|
Then the response should contain "Welcome to the homepage"
|
|
9
9
|
|
|
10
|
-
Scenario: Check
|
|
10
|
+
Scenario: Check response page if not contain a text
|
|
11
11
|
Given I am on the homepage
|
|
12
12
|
Then the response should not contain "Access denied"
|
|
@@ -0,0 +1,31 @@
|
|
|
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
|
|
4
|
+
|
|
5
|
+
Scenario: Check the response status code for not existing page page
|
|
6
|
+
Given I am on the homepage
|
|
7
|
+
When I go to "/not-existing-page.html"
|
|
8
|
+
And I wait 2 seconds
|
|
9
|
+
Then the response status code should be 404
|
|
10
|
+
And the response status code should not be 200
|
|
11
|
+
|
|
12
|
+
Scenario: Check the response status code for existing page
|
|
13
|
+
Given I am on the homepage
|
|
14
|
+
When I go to "/existing-page.html"
|
|
15
|
+
And I wait 2 seconds
|
|
16
|
+
Then the response status code should not be 404
|
|
17
|
+
And the response status code should be 200
|
|
18
|
+
|
|
19
|
+
Scenario: Check the response status code for an API with JSON page format
|
|
20
|
+
Given I am on the homepage
|
|
21
|
+
When I go to "/example-api.json"
|
|
22
|
+
And I wait 2 seconds
|
|
23
|
+
Then the response status code should not be 404
|
|
24
|
+
And the response status code should be 200
|
|
25
|
+
|
|
26
|
+
Scenario: Check the response status code for a parameter of the API with JSON page format
|
|
27
|
+
Given I am on the homepage
|
|
28
|
+
When I go to "/example-api.json?include=author"
|
|
29
|
+
And I wait 2 seconds
|
|
30
|
+
Then the response status code should not be 404
|
|
31
|
+
And the response status code should be 200
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
Feature:
|
|
1
|
+
Feature: An example to test attach file to field
|
|
2
2
|
|
|
3
3
|
As a tester
|
|
4
|
-
I want to be able to attach file (images) to
|
|
4
|
+
I want to be able to attach file (images) to field
|
|
5
5
|
|
|
6
|
-
Scenario: Check
|
|
7
|
-
Given I am on "test--when--i-attach-file-to-feild.html"
|
|
8
|
-
When I attach the file "
|
|
6
|
+
Scenario: Check attach file to field
|
|
7
|
+
Given I am on "/test--when--i-attach-file-to-feild.html"
|
|
8
|
+
When I attach the file "webshipco.png" to "#fileUpload"
|
|
9
9
|
When I press "Submit"
|
|
10
10
|
Then I should see "webshipco.png"
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
Feature:
|
|
1
|
+
Feature: An example to check the checkbox
|
|
2
2
|
|
|
3
3
|
As a tester
|
|
4
|
-
I want to be able to
|
|
4
|
+
I want to be able to check a checkbox
|
|
5
5
|
|
|
6
|
-
Scenario: Check the
|
|
7
|
-
Given I am on "test--when--i-check-uncheck-checkbox.html"
|
|
6
|
+
Scenario: Check the checkbox
|
|
7
|
+
Given I am on "/test--when--i-check-uncheck-checkbox.html"
|
|
8
8
|
When I check "vehicle1"
|
|
9
9
|
And I press "Submit"
|
|
10
10
|
Then I should see "You have a Bike"
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
Feature: An example to click link
|
|
2
|
+
|
|
3
|
+
As a tester
|
|
4
|
+
I want to be able to click link
|
|
5
|
+
|
|
6
|
+
Scenario: Check click link by link text
|
|
7
|
+
Given I am on "/test--when--i-click-link.html"
|
|
8
|
+
When I click "About us link"
|
|
9
|
+
And I wait max of 2 seconds
|
|
10
|
+
Then I should see "About Us"
|
|
11
|
+
|
|
12
|
+
Scenario: Check click link by link css class
|
|
13
|
+
Given I am on "/test--when--i-click-link.html"
|
|
14
|
+
When I click "aboutUs"
|
|
15
|
+
And I wait max of 2 seconds
|
|
16
|
+
Then I should see "About Us"
|