webship-js 1.0.38 → 1.0.39

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.
@@ -27,6 +27,7 @@ module.exports = {
27
27
  selenium_port: 4444,
28
28
  selenium_host: '127.0.0.1',
29
29
  silent: true,
30
+ output: false,
30
31
  screenshots: {
31
32
  enabled: false,
32
33
  path: './reports/screenshots',
@@ -37,6 +37,7 @@ module.exports = {
37
37
  selenium_port: 4444,
38
38
  selenium_host: '127.0.0.1',
39
39
  silent: true,
40
+ output: false,
40
41
  screenshots: {
41
42
  enabled: true,
42
43
  path: './reports/screenshots',
@@ -0,0 +1,49 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+
4
+ <head>
5
+ <meta charset='utf-8'>
6
+ <title>when I scroll to the bottom</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
+ border-width: 1pc;
18
+ }
19
+
20
+ #complete{
21
+ font-size: 32px;
22
+ line-height: 30px;
23
+ }
24
+
25
+ </style>
26
+
27
+ </head>
28
+
29
+ <body>
30
+ <h1>scrolling page to the bottom</h1>
31
+
32
+ <div id="container">
33
+
34
+ </div>
35
+
36
+ <div id="complete">
37
+
38
+ </div>
39
+ </body>
40
+
41
+ <script>
42
+
43
+ for(var i=0; i<20; i++){
44
+ document.getElementById("container").innerHTML += '<p class="style"> Container #' + i + '</p>';
45
+ }
46
+ document.getElementById("complete").innerHTML += "Scrolling has reached the bottom";
47
+
48
+ </script>
49
+ </html>
@@ -27,6 +27,7 @@ module.exports = {
27
27
  selenium_port: 4444,
28
28
  selenium_host: '127.0.0.1',
29
29
  silent: true,
30
+ output: false,
30
31
  screenshots: {
31
32
  enabled: true,
32
33
  path: './reports/screenshots',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "webship-js",
3
- "version": "1.0.38",
3
+ "version": "1.0.39",
4
4
  "description": "Webship JS automated functional testing.",
5
5
  "main": "index.js",
6
6
  "directories": {
@@ -7,4 +7,4 @@ Feature: An example to verify whether the element does not contain a specific ex
7
7
  Then I should see a "body" element by attr
8
8
  When I press "Submit"
9
9
  Then the "#uname" element should not contain "border:solid 5px red;"
10
- And the "pword" element should not contain "font-size: 28px;"
10
+ And the "pword" element should not contain "font-size: 28px;"
@@ -4,4 +4,4 @@ Feature: An example of checking for matching URLs based on a specific pattern
4
4
 
5
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
- Then the url should match "(https?:\/\/)?([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+\.[a-zA-Z]{2,}(:\d+)?(\/[^?#\s_]+)?(\?[^#\s_]+)?(#.*)?"
7
+ Then the url should match "(https?:\/\/)?([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+\.[a-zA-Z]{2,}(:\d+)?(\/[^?#\s_]+)?(\?[^#\s_]+)?(#.*)?"
@@ -5,15 +5,15 @@ Feature: An example of checking the href attribute of a link element to see if i
5
5
 
6
6
  Scenario: Verify that the link contains "about" by its direct id, class attribute
7
7
  Given I am on "/test--then--the-link-should-contain.html"
8
- Then the "#aboutUsid" link should contain "about" by attr
8
+ Then the "#aboutUsid" link should contain "about" by attr
9
9
  And the ".contactUs" link should contain "/contact-" by attr
10
10
 
11
11
  Scenario: Verify that the link contains "contact-" by its id, class attribute
12
12
  Given I am on "/test--then--the-link-should-contain.html"
13
- Then the "contactUsid" link should contain "/contact-" by its "id" attribute
13
+ Then the "contactUsid" link should contain "/contact-" by its "id" attribute
14
14
  And the "aboutUs" link should contain "about" by its "class" attribute
15
15
 
16
16
  Scenario: Verify that the link contains "about" by its "Title" attribute
17
17
  Given I am on "/test--then--the-link-should-contain.html"
18
- Then the "aboutUsTitle" link should contain "about-us" by attr
19
- And the "aboutUsTitle" link should contain "about-us" by its "title" attribute
18
+ Then the "aboutUsTitle" link should contain "about-us" by attr
19
+ And the "aboutUsTitle" link should contain "about-us" by its "title" attribute
@@ -5,4 +5,4 @@ Feature: An example of checking the href attribute of a link element to see if i
5
5
 
6
6
  Scenario: Verify that the link contains "about"
7
7
  Given I am on "/test--then--the-link-should-contain.html"
8
- Then the "About us" link should contain "about"
8
+ Then the "About us" link should contain "about"
@@ -5,6 +5,6 @@ Feature: An example of clicking a link by its text
5
5
 
6
6
  Scenario: Verify clicking a link by its text
7
7
  Given I am on "/test--when--i-click-link.html"
8
- When I click "About us link"
8
+ When I click "About us link"
9
9
  And I wait max of 2 seconds
10
- Then I should see "About Us"
10
+ Then I should see "About Us"
@@ -4,17 +4,17 @@ Feature: An example of filling an input textbox with a value using its attribute
4
4
 
5
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
- When I fill in "#uname" with "John Smith" by attr
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
- When I press "Login"
10
- Then I should see "You enter Username: John Smith and Password: 1234"
9
+ When I press "Login"
10
+ Then I should see "You enter Username: John Smith and Password: 1234"
11
11
 
12
12
  Scenario: Fill in the input field using its placeholder attribute.
13
13
  Given I am on "/test--when--i-fill-in.html"
14
- When I fill in "Your full name" with "John Smith" by its "placeholder" attr
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
- When I press "Login"
17
- Then I should see "You enter Username: John Smith and Password: 1234"
16
+ When I press "Login"
17
+ Then I should see "You enter Username: John Smith and Password: 1234"
18
18
 
19
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"
@@ -26,6 +26,6 @@ Feature: An example of filling an input textbox with a value using its attribute
26
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
- And I fill in "password" with: by attr
29
+ And I fill in "password" with: by attr
30
30
  When I press "Login" by attr
31
31
  Then I should see "You enter Username: and Password:"
@@ -19,7 +19,7 @@ Feature: An example of filling an input textbox with a value using its label.
19
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
- And I fill in "Password" with:
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
 
@@ -5,15 +5,15 @@ Feature: An example of pressing a button using its attributes.
5
5
 
6
6
  Scenario: Verify that you can click a button by specifying its ID with the '#' sign.
7
7
  Given I am on "/test--when--i-press-button.html"
8
- When I press "#btn-pressid" by attr
9
- Then I should see "Button Pressed Successfully"
8
+ When I press "#btn-pressid" by attr
9
+ Then I should see "Button Pressed Successfully"
10
10
 
11
11
  Scenario: Verify that you can click a button by specifying the 'ID' attribute without the '#' sign.
12
12
  Given I am on "/test--when--i-press-button.html"
13
- When I press "btn-pressid" by "id" attr
14
- Then I should see "Button Pressed Successfully"
13
+ When I press "btn-pressid" by "id" attr
14
+ Then I should see "Button Pressed Successfully"
15
15
 
16
16
  Scenario: Verify that you can click a button without specifying any attributes or signs, using only the value of one of its attributes.
17
17
  Given I am on "/test--when--i-press-button.html"
18
- When I press "btn-pressname" by attr
19
- Then I should see "Button Pressed Successfully"
18
+ When I press "btn-pressname" by attr
19
+ Then I should see "Button Pressed Successfully"
@@ -0,0 +1,9 @@
1
+ Feature: An example test Scrolling page to the bottom.
2
+
3
+ As a tester,
4
+ I want to make sure that I can arrive the bottom of the current page.
5
+
6
+ Scenario: Check Scrolling page to the bottom.
7
+ Given I am on "/test--when--i-scroll-to-the-bottom.html"
8
+ When I scroll to the bottom
9
+ Then I should see "Scrolling has reached the bottom"
@@ -5,6 +5,6 @@ Feature: An example of selecting an option in the dropdown list by its text labe
5
5
 
6
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
- When I select "Saab" from "Choose a car:"
9
- When I press "Submit" by attr
10
- Then I should see "Option ( Saab ) has been selected successfully"
8
+ When I select "Saab" from "Choose a car:"
9
+ When I press "Submit" by attr
10
+ Then I should see "Option ( Saab ) has been selected successfully"
@@ -5,18 +5,18 @@ Feature: An example test to wait for a specific maximum number of seconds/minute
5
5
 
6
6
  Scenario: Check waiting 6 seconds for the page content to load.
7
7
  Given I am on the homepage
8
- When I go to "/test--when-i-wait-specific-time.html"
9
- And I wait 6 seconds
10
- Then I should see "Welcome with waiting full time"
8
+ When I go to "/test--when-i-wait-specific-time.html"
9
+ And I wait 6 seconds
10
+ Then I should see "Welcome with waiting full time"
11
11
 
12
12
  Scenario: Check waiting 3s for the page content to load.
13
13
  Given I am on the homepage
14
- When I go to "/test--when-i-wait-specific-time.html"
15
- And I wait 3s
16
- Then I should see "Welcome with waiting full time"
14
+ When I go to "/test--when-i-wait-specific-time.html"
15
+ And I wait 3s
16
+ Then I should see "Welcome with waiting full time"
17
17
 
18
18
  Scenario: Check waiting a maximum of 6 seconds for the page content to load.
19
19
  Given I am on the homepage
20
- When I go to "/test--when-i-wait-max-of-time.html"
21
- And I wait max of 6 seconds
22
- Then I should see "Welcome with waiting until page load"
20
+ When I go to "/test--when-i-wait-max-of-time.html"
21
+ And I wait max of 6 seconds
22
+ Then I should see "Welcome with waiting until page load"
@@ -4,22 +4,15 @@ const { Then} = require('@cucumber/cucumber');
4
4
 
5
5
  const axios = require('axios');
6
6
 
7
- /**
8
- * Opens homepage.
9
- * Example: Given I am on homepage
10
- *
11
- */
12
- Given(/^(I am|we are) on homepage$/, function (pronoundCase) {
13
- return browser.url(browser.launch_url);
14
- });
15
7
 
16
8
  /**
17
9
  * Opens homepage.
10
+ * Example: Given I am on homepage
18
11
  * Example: Given I am on the homepage
19
12
  *
20
13
  */
21
- Given(/^(I am|we are) on the homepage$/, function (pronoundCase) {
22
- return browser.url(browser.launch_url);
14
+ Given(/^(I am|we are) on( the)* homepage$/, function (pronoundCase, theCase) {
15
+ return browser.url(browser.launch_url).waitForElementPresent('body', 1000);
23
16
  });
24
17
 
25
18
  /**
@@ -28,17 +21,7 @@ Given(/^(I am|we are) on the homepage$/, function (pronoundCase) {
28
21
  *
29
22
  */
30
23
  Given(/^(I am|we are) on "([^"]*)?"$/, function (pronoundCase, url) {
31
- return browser.url(browser.launch_url + url);
32
- });
33
-
34
- /**
35
- * Go to homepage
36
- * Example: When I go to homepage
37
- * Example: And I go to "/"
38
- *
39
- */
40
- When(/^(I|we)* go to homepage$/, function (pronoundCase) {
41
- return browser.url(browser.launch_url);
24
+ return browser.url(browser.launch_url + url).waitForElementPresent('body', 1000);
42
25
  });
43
26
 
44
27
  /**
@@ -47,8 +30,8 @@ When(/^(I|we)* go to homepage$/, function (pronoundCase) {
47
30
  * Example: And I go to the "/"
48
31
  *
49
32
  */
50
- When(/^(I|we)* go to the homepage$/, function (pronoundCase) {
51
- return browser.url(browser.launch_url);
33
+ When(/^(I|we)* go to( the)* homepage$/, function (pronoundCase, theCase) {
34
+ return browser.url(browser.launch_url).waitForElementPresent('body', 1000);
52
35
  });
53
36
 
54
37
  /**
@@ -57,7 +40,7 @@ When(/^(I|we)* go to the homepage$/, function (pronoundCase) {
57
40
  *
58
41
  */
59
42
  When(/^(I|we)* go to "([^"]*)?"$/, function (pronoundCase, url) {
60
- return browser.url(browser.launch_url + url);
43
+ return browser.url(browser.launch_url + url).waitForElementPresent('body', 1000);
61
44
  });
62
45
 
63
46
  /**
@@ -201,7 +184,7 @@ When(/^(I|we)* reload page$/, function (pronoundCase) {
201
184
  * Example: And I reload the page
202
185
  *
203
186
  */
204
- When(/^(I|we)* reload the page$/, function (pronoundCase) {
187
+ When(/^(I|we)* reload( the)* page$/, function (pronoundCase, theCase) {
205
188
  return browser.refresh(browser.getCurrentUrl());
206
189
  });
207
190
 
@@ -212,7 +195,7 @@ When(/^(I|we)* reload the page$/, function (pronoundCase) {
212
195
  *
213
196
  */
214
197
  When(/^(I|we)* fill in "([^"]*)?" with "([^"]*)?"$/, function (pronoundCase, field, value) {
215
- const elementField = browser.element.findByText(field);
198
+ const elementField = browser.element.findByText(field, { exact: true });
216
199
  browser.getAttribute(elementField, 'for', function (eleAttribute) {
217
200
  return browser.setValue('#' + eleAttribute.value, value);
218
201
  });
@@ -254,7 +237,7 @@ When(/^(I|we)* fill in "([^"]*)?" with "([^"]*)?" by( its)*( "([^"]*)?")* (attri
254
237
  *
255
238
  */
256
239
  When(/^(I|we)* fill in "([^"]*)?" with:$/, function (pronoundCase, field) {
257
- const elementField = browser.element.findByText(field);
240
+ const elementField = browser.element.findByText(field, { exact: true });
258
241
  browser.getAttribute(elementField, 'for', function (eleAttribute) {
259
242
  return browser.setValue('#' + eleAttribute.value, '');
260
243
  });
@@ -295,7 +278,7 @@ When(/^(I|we)* fill in "([^"]*)?" with: by( its)*( "([^"]*)?")* (attribute|attr)
295
278
  *
296
279
  */
297
280
  When(/^(I|we)* fill in "([^"]*)?" for "([^"]*)?"$/, function (pronoundCase, value, field) {
298
- const elementField = browser.element.findByText(field);
281
+ const elementField = browser.element.findByText(field, { exact: true });
299
282
  browser.getAttribute(elementField, 'for', function (eleAttribute) {
300
283
  return browser.setValue('#' + eleAttribute.value, value);
301
284
  });
@@ -338,16 +321,16 @@ When(/^(I|we)* fill in "([^"]*)?" for "([^"]*)?" by( its)*( "([^"]*)?")* (attrib
338
321
  * | Password | 1234 |
339
322
  */
340
323
 
341
- When(/^(I|we)* fill in the following:$/, function (pronoundCase, table) {
324
+ When(/^(I|we)* fill in( the)* following:$/, function (pronoundCase, theCase, table) {
342
325
 
343
- var elementField = browser.element.findByText(table.rawTable[0][0]);
326
+ var elementField = browser.element.findByText(table.rawTable[0][0], { exact: true });
344
327
  browser.getAttribute(elementField, 'for', function (eleAttribute) {
345
328
  browser.setValue('#' + eleAttribute.value, table.rawTable[0][1]);
346
329
  });
347
330
 
348
331
  table.rows().forEach(row => {
349
332
 
350
- elementField = browser.element.findByText(row[0]);
333
+ elementField = browser.element.findByText(row[0], { exact: true });
351
334
  browser.getAttribute(elementField, 'for', function (eleAttribute2) {
352
335
  browser.setValue('#' + eleAttribute2.value, row[1]);
353
336
  });
@@ -365,7 +348,7 @@ When(/^(I|we)* fill in the following:$/, function (pronoundCase, table) {
365
348
  * | Your Password | 1234 |
366
349
  */
367
350
 
368
- When(/^(I|we)* fill in the following: by( its)*( "([^"]*)?")* (attribute|attr)$/, function (pronoundCase, itsCase, attr, attrCase, table) {
351
+ When(/^(I|we)* fill in( the)* following: by( its)*( "([^"]*)?")* (attribute|attr)$/, function (pronoundCase, theCase, itsCase, attr, attrCase, table) {
369
352
 
370
353
  var hasASpace = table.rawTable[0][0].indexOf(' ');
371
354
  var selector = '';
@@ -417,11 +400,11 @@ When(/^(I|we)* fill in the following: by( its)*( "([^"]*)?")* (attribute|attr)$/
417
400
  */
418
401
  When(/^(I|we)* select "([^"]*)?" from "([^"]*)?"$/, function (pronoundCase, option, dropdownlist) {
419
402
 
420
- const elementField = browser.element.findByText(dropdownlist);
403
+ const elementField = browser.element.findByText(dropdownlist, { exact: true });
421
404
  browser.getAttribute(elementField, 'for', function (eleAttribute) {
422
405
  return browser.waitForElementVisible('css selector', '#' + eleAttribute.value)
423
406
  .click('#' + eleAttribute.value)
424
- .click(browser.element.findByText(option))
407
+ .click(browser.element.findByText(option, { exact: true }))
425
408
  .click('#' + eleAttribute.value);
426
409
  });
427
410
  });
@@ -453,7 +436,7 @@ When(/^(I|we)* select "([^"]*)?" from "([^"]*)?" by( its)*( "([^"]*)?")* (attrib
453
436
 
454
437
  return browser.waitForElementVisible('css selector', selector)
455
438
  .click(selector)
456
- .click(browser.element.findByText(option))
439
+ .click(browser.element.findByText(option, { exact: true }))
457
440
  .click(selector);
458
441
  });
459
442
 
@@ -480,18 +463,10 @@ When(/^(I|we)* uncheck "([^"]*)?"$/, function (pronoundCase, item) {
480
463
  /**
481
464
  * Verify, that current page is the homepage
482
465
  * Example: Then I should be on homepage
483
- *
484
- */
485
- Then(/^(I|we)* should be on homepage$/, function (pronoundCase) {
486
- return browser.assert.urlMatches(browser.launch_url);
487
- });
488
-
489
- /**
490
- * Verify, that current page is the homepage
491
466
  * Example: Then I should be on the homepage
492
467
  *
493
468
  */
494
- Then(/^(I|we)* should be on the homepage$/, function (pronoundCase) {
469
+ Then(/^(I|we)* should be on( the)* homepage$/, function (pronoundCase, theCase) {
495
470
  return browser.assert.urlMatches(browser.launch_url);
496
471
  });
497
472
 
@@ -509,7 +484,7 @@ Then(/^(I|we)* should not be on homepage$/, function (pronoundCase) {
509
484
  * Example: Then I should not be on the homepage
510
485
  *
511
486
  */
512
- Then(/^(I|we)* should not be on the homepage$/, function (pronoundCase) {
487
+ Then(/^(I|we)* should not be on( the)* homepage$/, function (pronoundCase, theCase) {
513
488
  return browser.assert.not.urlMatches(browser.launch_url);
514
489
  });
515
490
 
@@ -530,7 +505,7 @@ Then(/^(I|we)* should be on "([^"]*)?"$/, function (pronoundCase, url) {
530
505
  * Example: Then the "Login" link should contain "/log-in"
531
506
  *
532
507
  */
533
- Then(/^the "([^"]*)?" link should contain "([^"]*)?"$/, function (element, url) {
508
+ Then(/^(the )*"([^"]*)?" link should contain "([^"]*)?"$/, function (theCase, element, url) {
534
509
  const elementField = browser.element.findByText(element, { exact: true });
535
510
  return browser.assert.attributeContains(elementField, 'href', url);
536
511
  });
@@ -542,7 +517,7 @@ Then(/^the "([^"]*)?" link should contain "([^"]*)?"$/, function (element, url)
542
517
  * Example: And the ".contactUs" link should contain "/contact-" by attr
543
518
  *
544
519
  */
545
- Then(/^the "([^"]*)?" link should contain "([^"]*)?" by( its)*( "([^"]*)?")* (attribute|attr)$/, function (attrValue, url, itsCase, attr, attrCase) {
520
+ Then(/^(the )*"([^"]*)?" link should contain "([^"]*)?" by( its)*( "([^"]*)?")* (attribute|attr)$/, function (theCase, attrValue, url, itsCase, attr, attrCase) {
546
521
 
547
522
  const hasASpace = attrValue.indexOf(' ');
548
523
  var selector = '';
@@ -568,7 +543,7 @@ Then(/^the "([^"]*)?" link should contain "([^"]*)?" by( its)*( "([^"]*)?")* (at
568
543
  * Example: Then the response should contain "Welcome visitor, How can I help you?"
569
544
  *
570
545
  */
571
- Then(/^the response should contain "([^"]*)?"$/, function (expectedText) {
546
+ Then(/^(the )*response should contain "([^"]*)?"$/, function (theCase, expectedText) {
572
547
  return this.shouldSee = function (browser) {
573
548
  browser.assert.textContains("html", expectedText);
574
549
  };
@@ -579,7 +554,7 @@ Then(/^the response should contain "([^"]*)?"$/, function (expectedText) {
579
554
  * Example: Then the response should not contain "Error: Ambiguous messages that are unclear"
580
555
  *
581
556
  */
582
- Then(/^the response should not contain "([^"]*)?"$/, function (expectedText) {
557
+ Then(/^(the )*response should not contain "([^"]*)?"$/, function (theCase, expectedText) {
583
558
  return this.shouldSee = function (browser) {
584
559
  browser.assert.not.textContains("html", expectedText);
585
560
  };
@@ -591,8 +566,8 @@ Then(/^the response should not contain "([^"]*)?"$/, function (expectedText) {
591
566
  * Example: Then I should see "John Smith" in the "Username" element
592
567
  *
593
568
  */
594
- Then(/^(I|we)* should see "([^"]*)?" in the "([^"]*)?" element$/, function (pronoundCase, expectedText, element) {
595
- const elementField = browser.element.findByText(element);
569
+ Then(/^(I|we)* should see "([^"]*)?" in( the)* "([^"]*)?" element$/, function (pronoundCase, expectedText,theCase , element) {
570
+ const elementField = browser.element.findByText(element, { exact: true });
596
571
  browser.getAttribute(elementField, 'for', function (eleAttribute) {
597
572
  return this.shouldSee = function (browser) {
598
573
  browser.assert.textContains('#' + eleAttribute.value, expectedText);
@@ -606,7 +581,7 @@ Then(/^(I|we)* should see "([^"]*)?" in the "([^"]*)?" element$/, function (pron
606
581
  * Example: Then I should see "1234" in the "pwordcss" element by attr
607
582
  *
608
583
  */
609
- Then(/^(I|we)* should see "([^"]*)?" in the "([^"]*)?" element by( its)*( "([^"]*)?")* (attribute|attr)$/, function (pronoundCase, expectedText, attrValue, itsCase, attr, attrCase) {
584
+ Then(/^(I|we)* should see "([^"]*)?" in( the)* "([^"]*)?" element by( its)*( "([^"]*)?")* (attribute|attr)$/, function (pronoundCase, expectedText, theCase, attrValue, itsCase, attr, attrCase) {
610
585
 
611
586
  const hasASpace = attrValue.indexOf(' ');
612
587
 
@@ -631,9 +606,9 @@ Then(/^(I|we)* should see "([^"]*)?" in the "([^"]*)?" element by( its)*( "([^"]
631
606
  * Example: Then I should not see "Joe Smith" in the "Username" element
632
607
  *
633
608
  */
634
- Then(/^(I|we)* should not see "([^"]*)?" in the "([^"]*)?" element$/, function (pronoundCase, expectedText, element) {
609
+ Then(/^(I|we)* should not see "([^"]*)?" in( the)* "([^"]*)?" element$/, function (pronoundCase, expectedText, theCase, element) {
635
610
 
636
- const elementField = browser.element.findByText(element);
611
+ const elementField = browser.element.findByText(element, { exact: true });
637
612
  browser.getAttribute(elementField, 'for', function (eleAttribute) {
638
613
  return this.shouldSee = function (browser) {
639
614
  browser.assert.not.textContains('#' + eleAttribute.value, expectedText);
@@ -647,7 +622,7 @@ Then(/^(I|we)* should not see "([^"]*)?" in the "([^"]*)?" element$/, function (
647
622
  * Example: Then I should not see "1234" in the "pwordcss" element by attr
648
623
  *
649
624
  */
650
- Then(/^(I|we)* should not see "([^"]*)?" in the "([^"]*)?" element by( its)*( "([^"]*)?")* (attribute|attr)$/, function (pronoundCase, expectedText, attrValue, itsCase, attr, attrCase) {
625
+ Then(/^(I|we)* should not see "([^"]*)?" in( the)* "([^"]*)?" element by( its)*( "([^"]*)?")* (attribute|attr)$/, function (pronoundCase, expectedText, theCase, attrValue, itsCase, attr, attrCase) {
651
626
 
652
627
  const hasASpace = attrValue.indexOf(' ');
653
628
 
@@ -742,7 +717,7 @@ Then(/^(I|we)* should not see (a|an) "([^"]*)?" element by( its)*( "([^"]*)?")*
742
717
  * Example: Then the "body" element should contain "color:white;"
743
718
  *
744
719
  */
745
- Then(/^the "([^"]*)?" element should contain "([^"]*)?"$/, function (selector, elementCss) {
720
+ Then(/^(the )*"([^"]*)?" element should contain "([^"]*)?"$/, function (theCase ,selector, elementCss) {
746
721
 
747
722
  elementCss = elementCss.replace(";", '');
748
723
  const cssPropertyArr = elementCss.split(":");
@@ -761,7 +736,7 @@ Then(/^the "([^"]*)?" element should contain "([^"]*)?"$/, function (selector, e
761
736
  * Example: Then the "#uname" element should not contain "border:solid 5px red;"
762
737
  * Example: Then the "pword" element should not contain "font-size: 26px;"
763
738
  */
764
- Then(/^the "([^"]*)?" element should not contain "([^"]*)?"$/, function (selector, elementCss) {
739
+ Then(/^(the )*"([^"]*)?" element should not contain "([^"]*)?"$/, function (theCase, selector, elementCss) {
765
740
 
766
741
  elementCss = elementCss.replace(";", '');
767
742
  const cssPropertyArr = elementCss.split(":");
@@ -779,7 +754,7 @@ Then(/^the "([^"]*)?" element should not contain "([^"]*)?"$/, function (selecto
779
754
  * Example: When I attach the file "profileIcon.jpg" to "#profileIconUpload"
780
755
  *
781
756
  */
782
- When(/^(I|we)* attach the file "([^"]*)?" to "([^"]*)?"$/, function (pronoundCase, fileUrl, element) {
757
+ When(/^(I|we)* attach( the)* file "([^"]*)?" to "([^"]*)?"$/, function (pronoundCase, theCase, fileUrl, element) {
783
758
  var dirname = __dirname + '';
784
759
  dirname = dirname.substring(0, dirname.lastIndexOf("/"));
785
760
 
@@ -791,9 +766,9 @@ When(/^(I|we)* attach the file "([^"]*)?" to "([^"]*)?"$/, function (pronoundCas
791
766
  * Example: Then the "Username" field should contain "John Smith"
792
767
  *
793
768
  */
794
- Then(/^the "([^"]*)?" field should contain "([^"]*)?"$/, function (field, expectedText) {
769
+ Then(/^(the )*"([^"]*)?" field should contain "([^"]*)?"$/, function (theCase, field, expectedText) {
795
770
 
796
- const elementField = browser.element.findByText(field);
771
+ const elementField = browser.element.findByText(field, { exact: true });
797
772
  browser.getAttribute(elementField, 'for', function (eleAttribute) {
798
773
  return this.shouldSee = function (browser) {
799
774
  browser.assert.textContains('#' + eleAttribute.value, expectedText);
@@ -806,7 +781,7 @@ Then(/^the "([^"]*)?" field should contain "([^"]*)?"$/, function (field, expect
806
781
  * Example: Then the "#username" field should not contain "John Smith"
807
782
  *
808
783
  */
809
- Then(/^the "([^"]*)?" field should not contain "([^"]*)?"$/, function (field, expectedText) {
784
+ Then(/^(the )*"([^"]*)?" field should not contain "([^"]*)?"$/, function (theCase, field, expectedText) {
810
785
 
811
786
  return this.shouldSee = function (browser) {
812
787
  browser.assert.not.textContains(field, expectedText);
@@ -818,7 +793,7 @@ Then(/^the "([^"]*)?" field should not contain "([^"]*)?"$/, function (field, ex
818
793
  * Example: Then the "#PrivacyPolicy" checkbox should be checked
819
794
  *
820
795
  */
821
- Then(/^the "([^"]*)?" checkbox should be checked$/, function (checkbox) {
796
+ Then(/^(the )*"([^"]*)?" checkbox should be checked$/, function (theCase, checkbox) {
822
797
  return browser.expect.element(checkbox).to.be.selected;
823
798
  });
824
799
 
@@ -827,7 +802,7 @@ Then(/^the "([^"]*)?" checkbox should be checked$/, function (checkbox) {
827
802
  * Example: Then the "#PrivacyPolicy" checkbox should not be checked
828
803
  *
829
804
  */
830
- Then(/^the "([^"]*)?" checkbox should not be checked$/, function (checkbox) {
805
+ Then(/^(the )*"([^"]*)?" checkbox should not be checked$/, function (theCase, checkbox) {
831
806
  return browser.expect.element(checkbox).to.not.be.selected;
832
807
  });
833
808
 
@@ -836,7 +811,7 @@ Then(/^the "([^"]*)?" checkbox should not be checked$/, function (checkbox) {
836
811
  * Example: Then the "#rememberMe" checkbox is checked
837
812
  *
838
813
  */
839
- Then(/^the "([^"]*)?" checkbox is checked$/, function (checkbox) {
814
+ Then(/^(the )*"([^"]*)?" checkbox is checked$/, function (theCase, checkbox) {
840
815
  return browser.expect.element(checkbox).to.be.selected;
841
816
  });
842
817
 
@@ -845,7 +820,7 @@ Then(/^the "([^"]*)?" checkbox is checked$/, function (checkbox) {
845
820
  * Example: Then the "#rememberMe" checkbox is not checked
846
821
  *
847
822
  */
848
- Then(/^the "([^"]*)?" checkbox is not checked$/, function (checkbox) {
823
+ Then(/^(the )*"([^"]*)?" checkbox is not checked$/, function (theCase, checkbox) {
849
824
  return browser.expect.element(checkbox).to.not.be.selected;
850
825
  });
851
826
 
@@ -854,7 +829,7 @@ Then(/^the "([^"]*)?" checkbox is not checked$/, function (checkbox) {
854
829
  * Example: Then the checkbox "#PrivacyPolicy" should be checked
855
830
  *
856
831
  */
857
- Then(/^the checkbox "([^"]*)?" should be checked$/, function (checkbox) {
832
+ Then(/^(the )*checkbox "([^"]*)?" should be checked$/, function (theCase, checkbox) {
858
833
  return browser.expect.element(checkbox).to.be.selected;
859
834
  });
860
835
 
@@ -863,7 +838,7 @@ Then(/^the checkbox "([^"]*)?" should be checked$/, function (checkbox) {
863
838
  * Example: Then the checkbox "#PrivacyPolicy" should not be checked
864
839
  *
865
840
  */
866
- Then(/^the checkbox "([^"]*)?" should not be checked$/, function (checkbox) {
841
+ Then(/^(the )*checkbox "([^"]*)?" should not be checked$/, function (theCase, checkbox) {
867
842
  return browser.expect.element(checkbox).to.not.be.selected;
868
843
  });
869
844
 
@@ -872,7 +847,7 @@ Then(/^the checkbox "([^"]*)?" should not be checked$/, function (checkbox) {
872
847
  * Example: Then the checkbox "#rememberMe" is checked
873
848
  *
874
849
  */
875
- Then(/^the checkbox "([^"]*)?" is checked$/, function (checkbox) {
850
+ Then(/^(the )*checkbox "([^"]*)?" is checked$/, function (theCase, checkbox) {
876
851
  return browser.expect.element(checkbox).to.be.selected;
877
852
  });
878
853
 
@@ -881,7 +856,7 @@ Then(/^the checkbox "([^"]*)?" is checked$/, function (checkbox) {
881
856
  * Example: Then the checkbox "#rememberMe" is not checked
882
857
  *
883
858
  */
884
- Then(/^the checkbox "([^"]*)?" is not checked$/, function (checkbox) {
859
+ Then(/^(the )*checkbox "([^"]*)?" is not checked$/, function (theCase, checkbox) {
885
860
  return browser.expect.element(checkbox).to.not.be.selected;
886
861
  });
887
862
 
@@ -933,7 +908,7 @@ When(/^(I|we)* wait max of (\d*)( minute)*(m)*$/, function (pronoundCase, number
933
908
  * Example: When I wait until the page is loaded
934
909
  *
935
910
  */
936
- When(/^(I|we)* wait until the page( is)* loaded*$/, function (pronoundCase, withIs) {
911
+ When(/^(I|we)* wait until( the)* page( is)* loaded*$/, function (pronoundCase, theCase, withIs) {
937
912
  return browser.waitForElementPresent('body', 10000);
938
913
  });
939
914
  /**
@@ -941,7 +916,7 @@ When(/^(I|we)* wait until the page( is)* loaded*$/, function (pronoundCase, with
941
916
  * Example: Then the response status code should be 200
942
917
  *
943
918
  */
944
- Then(/^the response status code should be (\d+)$/, function (expectedStatusCode) {
919
+ Then(/^(the )*response status code should be (\d+)$/, function (theCase, expectedStatusCode) {
945
920
  return browser.url(function (currentURL) {
946
921
  axios.get(currentURL.value)
947
922
  .then(function (response) {
@@ -961,7 +936,7 @@ Then(/^the response status code should be (\d+)$/, function (expectedStatusCode)
961
936
  * Example: And the response status code should not be 404
962
937
  *
963
938
  */
964
- Then(/^the response status code should not be (\d+)$/, function ( expectedStatusCode) {
939
+ Then(/^(the )*response status code should not be (\d+)$/, function ( theCase, expectedStatusCode) {
965
940
  return browser.url(function (currentURL) {
966
941
  axios.get(currentURL.value)
967
942
  .then(function (response) {
@@ -1008,7 +983,7 @@ Then(/^(I|we)* should not see text matching "([^"]*)?"$/, function (pronoundCase
1008
983
  * //pattern of DD/MM/YYYY or DD-MM-YYYY
1009
984
  *
1010
985
  */
1011
- Then(/^(I|we)* should see text matching "([^"]*)?" in the "([^"]*)?" element$/, function (pronoundCase, textPattern, element) {
986
+ Then(/^(I|we)* should see text matching "([^"]*)?" in( the)* "([^"]*)?" element$/, function (pronoundCase, textPattern, theCase, element) {
1012
987
  return this.shouldSeePattern = function (browser) {
1013
988
  browser.assert.textMatches(element, textPattern);
1014
989
  };
@@ -1020,7 +995,7 @@ Then(/^(I|we)* should see text matching "([^"]*)?" in the "([^"]*)?" element$/,
1020
995
  * //pattern of DD/MM/YYYY or DD-MM-YYYY
1021
996
  *
1022
997
  */
1023
- Then(/^(I|we)* should not see text matching "([^"]*)?" in the "([^"]*)?" element$/, function (pronoundCase, textPattern, element) {
998
+ Then(/^(I|we)* should not see text matching "([^"]*)?" in( the)* "([^"]*)?" element$/, function (pronoundCase, textPattern, element) {
1024
999
  return this.shouldSeePattern = function (browser) {
1025
1000
  browser.assert.not.textMatches(element, textPattern);
1026
1001
  };
@@ -1031,7 +1006,7 @@ Then(/^(I|we)* should not see text matching "([^"]*)?" in the "([^"]*)?" element
1031
1006
  * Example: Then the url should match "/contact-us.html"
1032
1007
  *
1033
1008
  */
1034
- Then(/^the url should match "([^"]*)?"$/, function (pattern) {
1009
+ Then(/^(the )*url should match "([^"]*)?"$/, function (theCase, pattern) {
1035
1010
  return browser.assert.urlMatches(pattern);
1036
1011
  });
1037
1012
 
@@ -1040,6 +1015,15 @@ Then(/^the url should match "([^"]*)?"$/, function (pattern) {
1040
1015
  * Example: Then the url should not match "/contact-us.html"
1041
1016
  *
1042
1017
  */
1043
- Then(/^the url should not match "([^"]*)?"$/, function (pattern) {
1018
+ Then(/^(the )*url should not match "([^"]*)?"$/, function (theCase, pattern) {
1044
1019
  return browser.assert.not.urlMatches(pattern);
1020
+ });
1021
+
1022
+ /**
1023
+ * Checks, Scrolls to the bottom of the current page
1024
+ * Example: When I scroll to the bottom
1025
+ *
1026
+ */
1027
+ When(/^(I|we)* scroll to( the)* bottom$/, async function(pronoundCase, theCase) {
1028
+ return browser.executeScript('window.scrollTo(0,document.body.scrollHeight);');
1045
1029
  });