webship-js 1.0.17 → 1.0.19
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/README.md +7 -9
- package/examples/index.html +3 -1
- package/examples/test--when--i-follow-link.html +1 -1
- package/examples/test--when-i-wait-max-of-time.html +39 -0
- package/examples/test--when-i-wait-specific-time.html +39 -0
- package/generate-reports.js +1 -0
- package/lib/custom-commands/smartLinkFollow.js +17 -0
- package/package.json +2 -3
- package/tests/{upload → assets}/webshipco.png +0 -0
- package/tests/features/test--then--the-checkbox-checked.feature +2 -2
- package/tests/features/test--when--i-attach-file-to-feild.feature +1 -1
- package/tests/features/test--when--i-follow-link.feature +9 -7
- package/tests/features/test--when--i-wait-time.feature +15 -0
- package/tests/step-definitions/webship.js +78 -53
- package/lib/custom-commands/smartLinkClick.js +0 -12
package/README.md
CHANGED
|
@@ -12,21 +12,19 @@ Webship JS has a ready step definitions for automated functional testing.
|
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
### Webship-js Documentations
|
|
15
|
-
All you need to know about [webship-js Docs](https://webship.co/
|
|
15
|
+
All you need to know about [webship-js Docs](https://webship.co/docs/webship-js/1.0.x).
|
|
16
16
|
|
|
17
17
|
|
|
18
|
-
## How to configure your project to test using webship-js steps
|
|
19
|
-
|
|
20
|
-
### Install node js and yarn
|
|
21
|
-
|
|
22
|
-
### Install Latest Chrome Driver
|
|
23
|
-
|
|
24
|
-
### Run selenium standalone server
|
|
25
|
-
|
|
26
18
|
## Install webship-js using Yarn
|
|
27
19
|
|
|
28
20
|
```
|
|
29
21
|
yarn add webship-js
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Install files required by the webship-js tool
|
|
25
|
+
|
|
26
|
+
```
|
|
27
|
+
bash <(wget -O - https://raw.githubusercontent.com/webship/wbash/v1/webship-js/v1/template.sh)
|
|
30
28
|
```
|
|
31
29
|
|
|
32
30
|
## Automated Functional Acceptance Testing
|
package/examples/index.html
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
<h3>Welcome to the homepage of the Webship-js Examples</h3>
|
|
15
15
|
<ul>
|
|
16
16
|
<li><a href="/">Given I go to homepage</a></li>
|
|
17
|
-
<li><a href="about-us.html">
|
|
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
20
|
<li><a href="test--when--i-follow-link.html">When I go follow "link"</a></li>
|
|
@@ -23,6 +23,8 @@
|
|
|
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>
|
|
26
|
+
<li><a href="test--when-i-wait-specific-time.html">When I Wait a specific Time</a></li>
|
|
27
|
+
<li><a href="test--when-i-wait-max-of-time.html">When I Wait a Maximum of Time</a></li>
|
|
26
28
|
</ul>
|
|
27
29
|
<script src="main.js"></script>
|
|
28
30
|
</body>
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
<body>
|
|
13
13
|
<h1>Follow Link</h1>
|
|
14
14
|
<div id="result" class="style">
|
|
15
|
-
Please click <a href="about-us.html">About us link</a> for more information.
|
|
15
|
+
Please click <a id="aboutUs" class="aboutUs" href="about-us.html">About us link</a> for more information.
|
|
16
16
|
</div>
|
|
17
17
|
</body>
|
|
18
18
|
</html>
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
|
|
4
|
+
<head>
|
|
5
|
+
<meta charset='utf-8'>
|
|
6
|
+
<title>I wait time</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: 50px;
|
|
17
|
+
}
|
|
18
|
+
</style>
|
|
19
|
+
|
|
20
|
+
</head>
|
|
21
|
+
|
|
22
|
+
<body>
|
|
23
|
+
<h1>Waiting Max number of Time</h1>
|
|
24
|
+
|
|
25
|
+
<div class="container">
|
|
26
|
+
<b><div id="result" class="style">Waiting . . .</div></b>
|
|
27
|
+
|
|
28
|
+
</body>
|
|
29
|
+
|
|
30
|
+
<script>
|
|
31
|
+
const element = document.getElementById("result");
|
|
32
|
+
const timeWate = 3;
|
|
33
|
+
|
|
34
|
+
setTimeout(() => {
|
|
35
|
+
element.innerText = 'Welcome with waiting until page load';
|
|
36
|
+
}, timeWate * 1000);
|
|
37
|
+
|
|
38
|
+
</script>
|
|
39
|
+
</html>
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
|
|
4
|
+
<head>
|
|
5
|
+
<meta charset='utf-8'>
|
|
6
|
+
<title>I wait time</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: 50px;
|
|
17
|
+
}
|
|
18
|
+
</style>
|
|
19
|
+
|
|
20
|
+
</head>
|
|
21
|
+
|
|
22
|
+
<body>
|
|
23
|
+
<h1>Waiting a Specific number of Time</h1>
|
|
24
|
+
|
|
25
|
+
<div class="container">
|
|
26
|
+
<b><div id="result" class="style">Waiting . . .</div></b>
|
|
27
|
+
|
|
28
|
+
</body>
|
|
29
|
+
|
|
30
|
+
<script>
|
|
31
|
+
const element = document.getElementById("result");
|
|
32
|
+
const timeWate = 3;
|
|
33
|
+
|
|
34
|
+
setTimeout(() => {
|
|
35
|
+
element.innerText = 'Welcome with waiting full time';
|
|
36
|
+
}, timeWate * 1000);
|
|
37
|
+
|
|
38
|
+
</script>
|
|
39
|
+
</html>
|
package/generate-reports.js
CHANGED
|
@@ -0,0 +1,17 @@
|
|
|
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("link text", result.value);
|
|
7
|
+
} else {
|
|
8
|
+
browser.element('css selector', '#' + item, function (result) {
|
|
9
|
+
if (result.status === 0) {
|
|
10
|
+
return browser.click("link text", result.value);
|
|
11
|
+
} else {
|
|
12
|
+
return browser.click("link text", item);
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "webship-js",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.19",
|
|
4
4
|
"description": "Webship JS automated functional testing.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"directories": {
|
|
@@ -11,8 +11,7 @@
|
|
|
11
11
|
"node": ">= 16.0"
|
|
12
12
|
},
|
|
13
13
|
"scripts": {
|
|
14
|
-
"test": "nightwatch --format @cucumber/pretty-formatter --format-options '{\"colorsEnabled\": true}' --format-options '{\"theme\": {\"feature keyword\":[\"bold\",\"blue\"],\"feature name\":[\"blue\",\"underline\"],\"feature description\":[\"blueBright\"],\"scenario keyword\":[\"bold\",\"magenta\"],\"scenario name\":[\"magenta\",\"underline\"],\"step keyword\":[\"bold\",\"green\"],\"step text\":[\"greenBright\",\"italic\"]}}' --format json:./tests/reports/cucumber_report.json",
|
|
15
|
-
"report":"node generate-reports.js",
|
|
14
|
+
"test": "nightwatch --format @cucumber/pretty-formatter --format-options '{\"colorsEnabled\": true}' --format-options '{\"theme\": {\"feature keyword\":[\"bold\",\"blue\"],\"feature name\":[\"blue\",\"underline\"],\"feature description\":[\"blueBright\"],\"scenario keyword\":[\"bold\",\"magenta\"],\"scenario name\":[\"magenta\",\"underline\"],\"step keyword\":[\"bold\",\"green\"],\"step text\":[\"greenBright\",\"italic\"]}}' --format json:./tests/reports/cucumber_report.json; node generate-reports.js;",
|
|
16
15
|
"lint:js": "node ./node_modules/eslint/bin/eslint.js --config=.eslintrc.json .",
|
|
17
16
|
"build": "webpack",
|
|
18
17
|
"start": "npm run devServer",
|
|
File without changes
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Feature:
|
|
1
|
+
Feature: Test register page
|
|
2
2
|
As a tester
|
|
3
|
-
I want to be able to test
|
|
3
|
+
I want to be able to test the register page work
|
|
4
4
|
|
|
5
5
|
Scenario: Check the "Then checkbox is/should be checked" step definitions
|
|
6
6
|
Given I am on "test--then--the-checkbox-checked.html"
|
|
@@ -5,6 +5,6 @@ Feature: Example test for "When I attach file to field"
|
|
|
5
5
|
|
|
6
6
|
Scenario: Check the "When I attach file to feild" step definitions
|
|
7
7
|
Given I am on "test--when--i-attach-file-to-feild.html"
|
|
8
|
-
When I attach the file "../../../tests/
|
|
8
|
+
When I attach the file "../../../tests/assets/webshipco.png" to "#fileUpload"
|
|
9
9
|
When I press "Submit"
|
|
10
10
|
Then I should see "webshipco.png"
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
Feature: Example test for "When I follow 'link'"
|
|
1
|
+
Feature: Example test for "When I follow 'link'"
|
|
2
2
|
|
|
3
|
-
As a tester
|
|
4
|
-
I want to be able to test when a link is clicked,
|
|
5
|
-
it will go to the link path page
|
|
3
|
+
As a tester
|
|
4
|
+
I want to be able to test when a link is clicked,
|
|
5
|
+
it will go to the link path page
|
|
6
6
|
|
|
7
7
|
Scenario: Check the "When I follow link" step definitions
|
|
8
8
|
Given I am on "test--when--i-follow-link.html"
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
When I follow "About us link"
|
|
10
|
+
Then I should see "About Us"
|
|
11
|
+
When I move backward one page
|
|
12
|
+
And I follow "aboutUs"
|
|
13
|
+
Then I should see "About Us"
|
|
@@ -0,0 +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
|
|
4
|
+
|
|
5
|
+
Scenario: Check page content to load
|
|
6
|
+
Given I am on the homepage
|
|
7
|
+
When I go to "test--when-i-wait-specific-time.html"
|
|
8
|
+
And I wait 6 seconds
|
|
9
|
+
Then I should see "Welcome with waiting full time"
|
|
10
|
+
|
|
11
|
+
Scenario: Check page content to load
|
|
12
|
+
Given I am on the homepage
|
|
13
|
+
When I go to "test--when-i-wait-max-of-time.html"
|
|
14
|
+
And I wait max of 6 seconds
|
|
15
|
+
Then I should see "Welcome with waiting until page load"
|
|
@@ -14,7 +14,7 @@ Given(/^I am on( the)* homepage$/, function (url) {
|
|
|
14
14
|
});
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
|
-
*
|
|
17
|
+
* Open specific page
|
|
18
18
|
* Example: Given I am on "about-us.html"
|
|
19
19
|
*
|
|
20
20
|
* @Given /^I am on "([^"]*)?"$/
|
|
@@ -24,7 +24,7 @@ Given(/^I am on "([^"]*)?"$/, function (url) {
|
|
|
24
24
|
});
|
|
25
25
|
|
|
26
26
|
/**
|
|
27
|
-
*
|
|
27
|
+
* Go to homepage
|
|
28
28
|
* Example: When I go to the homepage
|
|
29
29
|
* Example: And I go to "/"
|
|
30
30
|
*
|
|
@@ -35,7 +35,7 @@ When(/^I go to( the)* homepage$/, function () {
|
|
|
35
35
|
});
|
|
36
36
|
|
|
37
37
|
/**
|
|
38
|
-
*
|
|
38
|
+
* Go to specific page
|
|
39
39
|
* Example: When I go to "contact-us.html"
|
|
40
40
|
*
|
|
41
41
|
* @When /^I go to "([^"]*)?"$/
|
|
@@ -63,7 +63,7 @@ Then(/^I should( not)* see "([^"]*)?"$/, function (negativeCase, expectedText) {
|
|
|
63
63
|
|
|
64
64
|
/**
|
|
65
65
|
* Moves forward one page in history
|
|
66
|
-
* Example:
|
|
66
|
+
* Example: When I move forward one page
|
|
67
67
|
*
|
|
68
68
|
* @When /^I move forward one page$/
|
|
69
69
|
*/
|
|
@@ -82,7 +82,7 @@ When(/^I move backward one page$/, function () {
|
|
|
82
82
|
});
|
|
83
83
|
|
|
84
84
|
/**
|
|
85
|
-
* Presses button with specified id|name|title|
|
|
85
|
+
* Presses button with specified id|class|name|title|value
|
|
86
86
|
* Example: When I press "Log In"
|
|
87
87
|
* Example: And I press "Log In"
|
|
88
88
|
*
|
|
@@ -94,15 +94,14 @@ When(/^I press "([^"]*)?"$/, function (elementValue) {
|
|
|
94
94
|
});
|
|
95
95
|
|
|
96
96
|
/**
|
|
97
|
-
* Clicks link with specified id|title|
|
|
98
|
-
* Example: When I follow "
|
|
97
|
+
* Clicks link with specified id|class|name|title|text
|
|
98
|
+
* Example: When I follow "Contact Us"
|
|
99
99
|
* Example: And I follow "Log In"
|
|
100
100
|
*
|
|
101
101
|
* @When /^I follow "([^"]*)?"$/
|
|
102
102
|
*/
|
|
103
|
-
When(/^I follow "([^"]*)?"$/, function (
|
|
104
|
-
browser.
|
|
105
|
-
// return browser.smartLinkClick(elementValue);
|
|
103
|
+
When(/^I follow "([^"]*)?"$/, function (item) {
|
|
104
|
+
browser.smartLinkFollow(item);
|
|
106
105
|
});
|
|
107
106
|
|
|
108
107
|
/**
|
|
@@ -117,8 +116,8 @@ When(/^I reload( the)* page$/, function (url) {
|
|
|
117
116
|
});
|
|
118
117
|
|
|
119
118
|
/**
|
|
120
|
-
*
|
|
121
|
-
* Example: When I fill in "
|
|
119
|
+
* Define the step of filling values in the form field specified by id|class|name|label.
|
|
120
|
+
* Example: When I fill in "Username" with "John Smith"
|
|
122
121
|
*
|
|
123
122
|
* @When /^I fill in "([^"]*)?" with "([^"]*)?"$/
|
|
124
123
|
*/
|
|
@@ -127,7 +126,7 @@ When(/^I fill in "([^"]*)?" with "([^"]*)?"$/, function (field, value) {
|
|
|
127
126
|
});
|
|
128
127
|
|
|
129
128
|
/**
|
|
130
|
-
* Fills in form field with specified id|name|label
|
|
129
|
+
* Fills in form field with specified id|class|name|label
|
|
131
130
|
* Example: When I fill in "username" with:
|
|
132
131
|
*
|
|
133
132
|
* @When /^I fill in "([^"]*)?" with:$/
|
|
@@ -137,7 +136,7 @@ When(/^I fill in "([^"]*)?" with:$/, function (field) {
|
|
|
137
136
|
});
|
|
138
137
|
|
|
139
138
|
/**
|
|
140
|
-
* Fills in form field with specified id|name|label
|
|
139
|
+
* Fills in form field with specified id|class|name|label
|
|
141
140
|
* Example: And I fill in "webshipco" for "username"
|
|
142
141
|
*
|
|
143
142
|
* @When /^I fill in "([^"]*)?" for "([^"]*)?"$/
|
|
@@ -166,9 +165,8 @@ When(/^I fill in the following:$/, function (table) {
|
|
|
166
165
|
});
|
|
167
166
|
|
|
168
167
|
/**
|
|
169
|
-
* Selects option in select field with specified id|name|label
|
|
170
|
-
* Example: When I select "
|
|
171
|
-
* Example: And I select "saab" from "Cars"
|
|
168
|
+
* Selects option in select field with specified id|class|name|label
|
|
169
|
+
* Example: When I select "mercedes" from "Cars"
|
|
172
170
|
*
|
|
173
171
|
* @When /^I select "([^"]*)?" from "([^"]*)?"$/
|
|
174
172
|
*/
|
|
@@ -177,9 +175,8 @@ When(/^I select "([^"]*)?" from "([^"]*)?"$/, function (option, selectBox) {
|
|
|
177
175
|
});
|
|
178
176
|
|
|
179
177
|
/**
|
|
180
|
-
* Checks checkbox
|
|
181
|
-
* Example: When I check "
|
|
182
|
-
* Example: And I check "Pearl Necklace"
|
|
178
|
+
* Checks checkbox specified by id|class|name|label
|
|
179
|
+
* Example: When I check "Remember me"
|
|
183
180
|
*
|
|
184
181
|
* @When /^I check "([^"]*)?"$/
|
|
185
182
|
*/
|
|
@@ -188,9 +185,8 @@ When(/^I check "([^"]*)?"$/, function (item) {
|
|
|
188
185
|
});
|
|
189
186
|
|
|
190
187
|
/**
|
|
191
|
-
* Unchecks checkbox
|
|
192
|
-
* Example: When I uncheck "
|
|
193
|
-
* Example: And I uncheck "Broadway Plays"
|
|
188
|
+
* Unchecks checkbox specified by id|class|name|label
|
|
189
|
+
* Example: When I uncheck "Remember me"
|
|
194
190
|
*
|
|
195
191
|
* @When /^I uncheck "([^"]*)?"$/
|
|
196
192
|
*/
|
|
@@ -199,9 +195,8 @@ When(/^I uncheck "([^"]*)?"$/, function (item) {
|
|
|
199
195
|
});
|
|
200
196
|
|
|
201
197
|
/**
|
|
202
|
-
*
|
|
198
|
+
* Verify, that current page is the homepage
|
|
203
199
|
* Example: Then I should be on the homepage
|
|
204
|
-
* Example: And I should be on the homepage
|
|
205
200
|
*
|
|
206
201
|
* @Then /^I should be on( the)* homepage$/
|
|
207
202
|
*/
|
|
@@ -210,9 +205,9 @@ Then(/^I should be on( the)* homepage$/, function (url) {
|
|
|
210
205
|
});
|
|
211
206
|
|
|
212
207
|
/**
|
|
213
|
-
*
|
|
208
|
+
* Verify, that current page path is equal to specified
|
|
214
209
|
* Example: Then I should be on "/"
|
|
215
|
-
* Example: And I should be on "/
|
|
210
|
+
* Example: And I should be on "/user/login"
|
|
216
211
|
* Example: And I should be on "http://google.com"
|
|
217
212
|
*
|
|
218
213
|
* @Then /^I should be on "([^"]*)?"$/
|
|
@@ -222,9 +217,9 @@ Then(/^I should be on "([^"]*)?"$/, function (url) {
|
|
|
222
217
|
});
|
|
223
218
|
|
|
224
219
|
/**
|
|
225
|
-
* Checks, that HTML response contains specified
|
|
226
|
-
* Example: Then the response should contain "
|
|
227
|
-
* Example:
|
|
220
|
+
* Checks, that HTML response contains specific text specified by id|class|name|label
|
|
221
|
+
* Example: Then the response should contain "Welcome visitor, How can I help you?"
|
|
222
|
+
* Example: Then the response should not contain "Error: Ambiguous messages that are unclear"
|
|
228
223
|
*
|
|
229
224
|
* @Then /^the response should contain "([^"]*)?"$/
|
|
230
225
|
*/
|
|
@@ -237,9 +232,9 @@ Then(/^the response should( not)* contain "([^"]*)?"$/, function (negativeCase,
|
|
|
237
232
|
});
|
|
238
233
|
|
|
239
234
|
/**
|
|
240
|
-
*
|
|
241
|
-
* Example: Then I should see "
|
|
242
|
-
* Example:
|
|
235
|
+
* Assert, that element contains a specific text value specified by id|class|name|label
|
|
236
|
+
* Example: Then I should see "John Smith" in the "Username" element
|
|
237
|
+
* Example: Then I should see "Joe Smith" in the "Username" element
|
|
243
238
|
*
|
|
244
239
|
* @Then /^I should( not)* see "([^"]*)?" in the "([^"]*)?" element$/
|
|
245
240
|
*/
|
|
@@ -248,9 +243,9 @@ Then(/^I should( not)* see "([^"]*)?" in the "([^"]*)?" element$/, function (neg
|
|
|
248
243
|
});
|
|
249
244
|
|
|
250
245
|
/**
|
|
251
|
-
*
|
|
252
|
-
* Example: Then I should see text matching "
|
|
253
|
-
* Example:
|
|
246
|
+
* Assert, that page contains text matching specified pattern
|
|
247
|
+
* Example: Then I should see text matching "Welcome visitor, How can I help you?"
|
|
248
|
+
* Example: Then I should not see text matching "Error: Ambiguous messages that are unclear"
|
|
254
249
|
*
|
|
255
250
|
* @Then /^I should( not)* see text matching "([^"]*)?"$/
|
|
256
251
|
*/
|
|
@@ -263,9 +258,8 @@ Then(/^I should( not)* see text matching "([^"]*)?"$/, function (negativeCase, e
|
|
|
263
258
|
});
|
|
264
259
|
|
|
265
260
|
/**
|
|
266
|
-
*
|
|
261
|
+
* Assert, that element exists on page specified by id|class|name|label
|
|
267
262
|
* Example: Then I should see a "body" element
|
|
268
|
-
* Example: And I should see a "body" element
|
|
269
263
|
*
|
|
270
264
|
* @Then /^I should( not)* see a(n)* "([^"]*)?" element$/
|
|
271
265
|
*/
|
|
@@ -277,9 +271,8 @@ Then(/^I should( not)* see a(n)* "([^"]*)?" element$/, function (negativeCase, i
|
|
|
277
271
|
});
|
|
278
272
|
|
|
279
273
|
/**
|
|
280
|
-
*
|
|
281
|
-
* Example: Then the "body" element should contain "color:
|
|
282
|
-
* Example: And the "body" element should contain "color:black;"
|
|
274
|
+
* Assert, that element contains a specific CSS style specified by id|class|name|label|tag.
|
|
275
|
+
* Example: Then the "body" element should contain "color:white;"
|
|
283
276
|
*
|
|
284
277
|
* @Then /^the "([^"]*)?" element should( not)* contain "([^"]*)?"$/
|
|
285
278
|
*/
|
|
@@ -288,9 +281,8 @@ Then(/^the "([^"]*)?" element should( not)* contain "([^"]*)?"$/, function (elem
|
|
|
288
281
|
});
|
|
289
282
|
|
|
290
283
|
/**
|
|
291
|
-
* Attaches file to field with specified id|name|label
|
|
292
|
-
* Example: When I attach the file "
|
|
293
|
-
* Example: And I attach the file "bwayne_profile.png" to "profileImageUpload"
|
|
284
|
+
* Attaches file to field with specified id|class|name|label
|
|
285
|
+
* Example: When I attach the file "profileIcon.jpg" to "profileIconUpload"
|
|
294
286
|
*
|
|
295
287
|
* @When /^I attach the file "([^"]*)?" to "([^"]*)?"$/
|
|
296
288
|
*/
|
|
@@ -299,9 +291,8 @@ When(/^I attach the file "([^"]*)?" to "([^"]*)?"$/, function (fileUrl, element)
|
|
|
299
291
|
});
|
|
300
292
|
|
|
301
293
|
/**
|
|
302
|
-
*
|
|
303
|
-
* Example: Then the "username" field should contain "
|
|
304
|
-
* Example: And the "username" field should not contain "bwayne"
|
|
294
|
+
* Assert, that form field with specified id|class|name|label has specified value
|
|
295
|
+
* Example: Then the "username" field should contain "John Smith"
|
|
305
296
|
*
|
|
306
297
|
* @Then /^the "([^"]*)?" field should( not)* contain "([^"]*)?"$/
|
|
307
298
|
*/
|
|
@@ -310,9 +301,8 @@ Then(/^the "([^"]*)?" field should( not)* contain "([^"]*)?"$/, function (field,
|
|
|
310
301
|
});
|
|
311
302
|
|
|
312
303
|
/**
|
|
313
|
-
*
|
|
304
|
+
* Assert, that checkbox with specified id|class|name|label is should be checked
|
|
314
305
|
* Example: Then the "PrivacyPolicy" checkbox should be checked
|
|
315
|
-
* Example: And the "PrivacyPolicy" checkbox should not be checked
|
|
316
306
|
*
|
|
317
307
|
* @Then /^the "([^"]*)?" checkbox should(not)* be checked$/
|
|
318
308
|
*
|
|
@@ -322,9 +312,8 @@ Then(/^the "([^"]*)?" checkbox should( not)* be checked$/, function (checkbox, n
|
|
|
322
312
|
});
|
|
323
313
|
|
|
324
314
|
/**
|
|
325
|
-
*
|
|
315
|
+
* Check, whether the checkbox specified by id|class|name|label is checked or not.
|
|
326
316
|
* Example: Then the "Remember Me" checkbox is checked
|
|
327
|
-
* Example: And the "Remember Me" checkbox is not checked
|
|
328
317
|
*
|
|
329
318
|
* @Then /^the "([^"]*)?" checkbox is( not)* checked$/
|
|
330
319
|
*
|
|
@@ -334,7 +323,7 @@ Then(/^the "([^"]*)?" checkbox is( not)* checked$/, function (checkbox, negative
|
|
|
334
323
|
});
|
|
335
324
|
|
|
336
325
|
/**
|
|
337
|
-
*
|
|
326
|
+
* Assert, that checkbox with specified id|name|label|value is checked
|
|
338
327
|
* Example: Then the checkbox "PrivacyPolicy" should be checked
|
|
339
328
|
* Example: Then the checkbox "PrivacyPolicy" should not be checked
|
|
340
329
|
*
|
|
@@ -346,7 +335,7 @@ Then(/^the checkbox "([^"]*)?" should( not)* be checked$/, function (checkbox, n
|
|
|
346
335
|
});
|
|
347
336
|
|
|
348
337
|
/**
|
|
349
|
-
*
|
|
338
|
+
* Assert, that checkbox with specified id|name|label|value is checked
|
|
350
339
|
* Example: Then the checkbox "Remember Me" is checked
|
|
351
340
|
* Example: And the checkbox "Remember Me" is not checked
|
|
352
341
|
*
|
|
@@ -355,4 +344,40 @@ Then(/^the checkbox "([^"]*)?" should( not)* be checked$/, function (checkbox, n
|
|
|
355
344
|
*/
|
|
356
345
|
Then(/^the checkbox "([^"]*)?" is( not)* checked$/, function (checkbox, negativeCase) {
|
|
357
346
|
return browser.assert.smartCheckboxChecked(checkbox, negativeCase);
|
|
347
|
+
});
|
|
348
|
+
|
|
349
|
+
/**
|
|
350
|
+
* Wait a specific number of seconds, or a max number of seconds
|
|
351
|
+
until the element present.
|
|
352
|
+
* Example: When I wait 1 second
|
|
353
|
+
* Example: When I wait 5 seconds
|
|
354
|
+
* Example: When I wait max of 6 seconds
|
|
355
|
+
*
|
|
356
|
+
* @When /^I wait( max of)* "([^"]*)?" second(s)*$/
|
|
357
|
+
*
|
|
358
|
+
*/
|
|
359
|
+
When(/^I wait( max of)* (\d*) second(s)*$/, function (maxof, number, withS) {
|
|
360
|
+
var waitTime = number * 1000;
|
|
361
|
+
if (maxof) {
|
|
362
|
+
return browser.waitForElementPresent('body', waitTime);
|
|
363
|
+
}
|
|
364
|
+
return browser.pause(waitTime);
|
|
365
|
+
});
|
|
366
|
+
|
|
367
|
+
/**
|
|
368
|
+
* Wait a specific number of minutes, or a max number of minutes
|
|
369
|
+
until the element present.
|
|
370
|
+
* Example: When I wait 1 minute
|
|
371
|
+
* Example: When I wait 5 minutes
|
|
372
|
+
* Example: When I wait max of 6 minutes
|
|
373
|
+
*
|
|
374
|
+
* @When /^I wait( max of)* "([^"]*)?" second(s)*$/
|
|
375
|
+
*
|
|
376
|
+
*/
|
|
377
|
+
When(/^I wait( max of)* (\d*) minute(s)*$/, function (maxof, number, withS) {
|
|
378
|
+
var waitTime = number * 60 * 1000;
|
|
379
|
+
if (maxof) {
|
|
380
|
+
return browser.waitForElementPresent('body', waitTime);
|
|
381
|
+
}
|
|
382
|
+
return browser.pause(waitTime);
|
|
358
383
|
});
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
module.exports.command = function (elementValue) {
|
|
3
|
-
|
|
4
|
-
browser.element('css selector', elementValue, function (result) {
|
|
5
|
-
if (result.status === 0) {
|
|
6
|
-
return browser.click(elementValue);
|
|
7
|
-
}
|
|
8
|
-
else {
|
|
9
|
-
browser.click("link text", elementValue);
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
}
|