webship-js 1.0.17 → 1.0.18

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.
@@ -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">When I move forward/backward one page</a></li>
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>
@@ -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>
@@ -7,6 +7,7 @@ var options = {
7
7
  reportSuiteAsScenarios: true,
8
8
  scenarioTimestamp: true,
9
9
  launchReport: true,
10
+ brandTitle: "Test Report",
10
11
  metadata: {
11
12
  "App Version": "7.1.0",
12
13
  "Test Environment": "development",
@@ -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.17",
3
+ "version": "1.0.18",
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: Example test the checkbox if checked or not
1
+ Feature: Test register page
2
2
  As a tester
3
- I want to be able to test uncheck a checkbox item
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/upload/webshipco.png" to "#fileUpload"
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
- When I follow "About us link"
10
- Then I should see "About Us"
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"
@@ -14,7 +14,7 @@ Given(/^I am on( the)* homepage$/, function (url) {
14
14
  });
15
15
 
16
16
  /**
17
- * Opens specified page
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
- * Opens homepage
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
- * Opens specified page
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: And I move forward one page
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|alt|value
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|alt|text
98
- * Example: When I follow "Log In"
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 (elementValue) {
104
- browser.click("link text", elementValue);
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
- * Fills in form field with specified id|name|label|value
121
- * Example: When I fill in "username" with "webshipco"
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|value
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|value
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|value
170
- * Example: When I select "saab" from "Cars"
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 with specified id|name|label|value
181
- * Example: When I check "Pearl Necklace"
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 with specified id|name|label|value
192
- * Example: When I uncheck "Broadway Plays"
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
- * Checks, that current page is the homepage
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
- * Checks, that current page PATH is equal to specified
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 "/bats"
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 string
226
- * Example: Then the response should contain "Batman is the hero Gotham deserves."
227
- * Example: And the response should contain "Batman is the hero Gotham deserves."
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
- * Checks, that element with specified CSS contains specified text
241
- * Example: Then I should see "Batman" in the "heroes_list" element
242
- * Example: And I should see "Batman" in the "heroes_list" element
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
- * Checks, that page contains text matching specified pattern
252
- * Example: Then I should see text matching "Bruce Wayne, the vigilante"
253
- * Example: And I should not see "Bruce Wayne, the vigilante"
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
- * Checks, that element with specified CSS exists on page
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
- * Checks, that element with specified CSS contains specified HTML
281
- * Example: Then the "body" element should contain "color:black;"
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|value
292
- * Example: When I attach the file "bwayne_profile.png" to "profileImageUpload"
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
- * Checks, that form field with specified id|name|label|value has specified value
303
- * Example: Then the "username" field should contain "bwayne"
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
- * Checks, that checkbox with specified id|name|label|value is checked
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
- * Checks, that checkbox with specified id|name|label|value is checked
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
- * Checks, that checkbox with specified id|name|label|value is checked
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
- * Checks, that checkbox with specified id|name|label|value is checked
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
  *
@@ -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
- }