webship-js 1.0.18 → 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 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/documentation/webship-js).
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
@@ -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>
@@ -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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "webship-js",
3
- "version": "1.0.18",
3
+ "version": "1.0.19",
4
4
  "description": "Webship JS automated functional testing.",
5
5
  "main": "index.js",
6
6
  "directories": {
@@ -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"
@@ -344,4 +344,40 @@ Then(/^the checkbox "([^"]*)?" should( not)* be checked$/, function (checkbox, n
344
344
  */
345
345
  Then(/^the checkbox "([^"]*)?" is( not)* checked$/, function (checkbox, negativeCase) {
346
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);
347
383
  });