webship-js 1.0.28 → 1.0.30

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.
@@ -8,15 +8,16 @@ jobs:
8
8
  runs-on: ubuntu-latest
9
9
 
10
10
  env:
11
- TEST_BASE_URL: http://localhost:808
11
+ TEST_BASE_URL: http://localhost:8080
12
12
  SELENIUM_HOST: http://selenium:4444/wd/hub
13
13
 
14
14
  steps:
15
15
  - name: Install Chrome
16
16
  run: |
17
- wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
18
- sudo dpkg -i google-chrome-stable_current_amd64.deb
19
-
17
+ CHROME_VERSION="115.0.5790.110-1"
18
+ wget https://dl.google.com/linux/chrome/deb/pool/main/g/google-chrome-stable/google-chrome-stable_${CHROME_VERSION}_amd64.deb
19
+ sudo dpkg -i google-chrome-stable_${CHROME_VERSION}_amd64.deb
20
+
20
21
  - uses: actions/checkout@v3
21
22
  - name: Use Node.js
22
23
  uses: actions/setup-node@v3
@@ -25,8 +26,8 @@ jobs:
25
26
 
26
27
  - name: Run Selenium Standalone server
27
28
  run: |
28
- wget https://github.com/SeleniumHQ/selenium/releases/download/selenium-4.4.0/selenium-server-4.4.0.jar
29
- java -jar selenium-server-4.4.0.jar standalone --port 4444
29
+ wget https://github.com/SeleniumHQ/selenium/releases/download/selenium-4.1.0/selenium-server-4.1.2.jar
30
+ java -jar selenium-server-4.1.2.jar standalone
30
31
 
31
32
  - name: Install
32
33
  run: yarn install
@@ -53,8 +53,8 @@
53
53
  </p>
54
54
  <hr>
55
55
 
56
- <p><input type="checkbox" value="lsRememberMe" id="rememberMe"> <label for="rememberMe">Remember me</label></p>
57
- <p><input type="checkbox" value="lsPrivacyPolicy" id="PrivacyPolicy"> <label for="PrivacyPolicy">I Agree to Privacy Policy</label></p>
56
+ <p><input type="checkbox" value="lsRememberMe" id="rememberMe" name="rememberMe"> <label for="rememberMe">Remember me</label></p>
57
+ <p><input type="checkbox" value="lsPrivacyPolicy" id="PrivacyPolicy" name="PrivacyPolicy"> <label for="PrivacyPolicy">I Agree to Privacy Policy</label></p>
58
58
 
59
59
  <p><input id="registerbtn" class="registerbtn" name="registerbtn" type="button" value="Register"
60
60
  onclick="onClick()"></p>
@@ -30,13 +30,13 @@
30
30
  <body>
31
31
  <h1>Check Option</h1>
32
32
  <form>
33
- <input type="checkbox" id="bike" name="vehicle1" value="Bike">
33
+ <input type="checkbox" id="bike" name="bike" value="Bike">
34
34
  <label for="vehicle1"> I have a bike</label><br>
35
- <input type="checkbox" id="car" name="vehicle2" value="Car">
35
+ <input type="checkbox" id="car" name="car" value="Car">
36
36
  <label for="vehicle2"> I have a car</label><br>
37
- <input type="checkbox" id="boat" name="vehicle3" value="Boat">
37
+ <input type="checkbox" id="boat" name="boat" value="Boat">
38
38
  <label for="vehicle3"> I have a boat</label><br>
39
- <input type="checkbox" id="van" name="vehicle4" value="Van">
39
+ <input type="checkbox" id="van" name="van" value="Van">
40
40
  <label for="vehicle4"> I have a van</label><br>
41
41
  </form>
42
42
 
@@ -1,44 +1,4 @@
1
1
  module.exports.command = function (item) {
2
2
 
3
- browser.element('css selector', item, function (result) {
4
- if (result.status === 0) {
5
- return browser.click(item);
6
- } else {
7
- browser.element('css selector', '#' + item, function (result) {
8
- if (result.status === 0) {
9
- return browser.click('#' + item);
10
- } else {
11
- browser.element('css selector', '.' + item, function (result) {
12
- if (result.status === 0) {
13
- return browser.click('.' + item);
14
- } else {
15
- browser.element('css selector', 'input[name="' + item + '"]', function (result) {
16
- if (result.status === 0) {
17
- return browser.click('input[name="' + item + '"]');
18
- } else {
19
- browser.element('css selector', 'input[value="' + item + '"]', function (result) {
20
- if (result.status === 0) {
21
- return browser.click('input[value="' + item + '"]');
22
- } else {
23
- browser.elements('css selector', 'label', function (elements) {
24
- elements.value.forEach(function (elementsObj) {
25
- browser.elementIdText(elementsObj.ELEMENT, function (result) {
26
- if (result.value == item) {
27
- browser.getAttribute(elementsObj, "for", function (forVal) {
28
- return browser.click('#' + forVal.value);
29
- });
30
- }
31
- })
32
- });
33
- });
34
- }
35
- });
36
- }
37
- });
38
- }
39
- });
40
- }
41
- });
42
- }
43
- });
3
+ browser.click("input[name='" + item + "']");
44
4
  }
@@ -1,33 +1,11 @@
1
-
2
1
  module.exports.command = function (option, dropdownlist) {
3
2
 
4
- browser.element('css selector', dropdownlist, function (result) {
3
+ browser.findElement('css selector', 'select[name=' + dropdownlist + ']', function (result) {
5
4
  if (result.status === 0) {
6
- return browser.click(dropdownlist + ' option[value=' + option + ']');
7
- } else {
8
- browser.element('css selector', '#' + dropdownlist, function (result) {
9
- if (result.status === 0) {
10
- return browser.click('#' + dropdownlist + ' option[value=' + option + ']');
11
- } else {
12
- browser.element('css selector', 'select[name=' + dropdownlist + ']', function (result) {
13
- if (result.status === 0) {
14
- return browser.click('select[name=' + dropdownlist + ']' + ' option[value=' + option + ']');
15
- } else {
16
- browser.elements('css selector', 'label', function (elements) {
17
- elements.value.forEach(function (elementsObj) {
18
- browser.elementIdText(elementsObj.ELEMENT, function (result) {
19
- if (result.value == dropdownlist) {
20
- browser.getAttribute(elementsObj, "for", function (forVal) {
21
- return browser.click('#' + forVal.value + ' option[value=' + option + ']');
22
- });
23
- }
24
- })
25
- });
26
- });
27
- }
28
- });
29
- }
30
- });
5
+ browser.waitForElementVisible('css selector', 'select[name="' + dropdownlist + '"]')
6
+ .click('select[name="' + dropdownlist + '"]')
7
+ .click(browser.element.findByText(option))
8
+ .click('select[name="' + dropdownlist + '"]');
31
9
  }
32
10
  });
33
- }
11
+ }
@@ -1,44 +1,4 @@
1
1
  module.exports.command = function (item) {
2
2
 
3
- browser.element('css selector', item, function (result) {
4
- if (result.status === 0) {
5
- return browser.click(item);
6
- } else {
7
- browser.element('css selector', '#' + item, function (result) {
8
- if (result.status === 0) {
9
- return browser.click('#' + item);
10
- } else {
11
- browser.element('css selector', '.' + item, function (result) {
12
- if (result.status === 0) {
13
- return browser.click('.' + item);
14
- } else {
15
- browser.element('css selector', 'input[name=' + item + ']', function (result) {
16
- if (result.status === 0) {
17
- return browser.click('input[name=' + item + ']');
18
- } else {
19
- browser.element('css selector', 'input[value="' + item + '"]', function (result) {
20
- if (result.status === 0) {
21
- return browser.click('input[value="' + item + '"]');
22
- } else {
23
- browser.elements('css selector', 'label', function (elements) {
24
- elements.value.forEach(function (elementsObj) {
25
- browser.elementIdText(elementsObj.ELEMENT, function (result) {
26
- if (result.value == item) {
27
- browser.getAttribute(elementsObj, "for", function (forVal) {
28
- return browser.click('#' + forVal.value);
29
- });
30
- }
31
- })
32
- });
33
- });
34
- }
35
- });
36
- }
37
- });
38
- }
39
- });
40
- }
41
- });
42
- }
43
- });
3
+ browser.click("input[name='" + item + "']");
44
4
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "webship-js",
3
- "version": "1.0.28",
3
+ "version": "1.0.30",
4
4
  "description": "Webship JS automated functional testing.",
5
5
  "main": "index.js",
6
6
  "directories": {
@@ -4,15 +4,15 @@ Feature: An example of test for selecting a checkbox
4
4
 
5
5
  Scenario: Check that the checkbox is checked
6
6
  Given I am on "/test--then--the-checkbox-checked.html"
7
- When I check "#rememberMe"
8
- And I check "#PrivacyPolicy"
7
+ When I check "rememberMe"
8
+ And I check "PrivacyPolicy"
9
9
  And I press "Register"
10
10
  Then the checkbox "#rememberMe" is checked
11
11
  And I should see "Registration Done Successfully"
12
12
 
13
13
  Scenario: Check that the checkbox is not checked
14
14
  Given I am on "/test--then--the-checkbox-checked.html"
15
- When I check "#PrivacyPolicy"
15
+ When I check "PrivacyPolicy"
16
16
  And I press "Register"
17
17
  Then the checkbox "#rememberMe" is not checked
18
18
  Then I should see "Registration Done Successfully"
@@ -4,7 +4,7 @@ Feature: An example of test assert for selecting a checkbox
4
4
 
5
5
  Scenario: Check that the checkbox should be checked
6
6
  Given I am on "/test--then--the-checkbox-checked.html"
7
- When I check "#PrivacyPolicy"
7
+ When I check "PrivacyPolicy"
8
8
  And I press "Register"
9
9
  Then the checkbox "#PrivacyPolicy" should be checked
10
10
  And I should see "Registration Done Successfully"
@@ -5,18 +5,18 @@ Feature: An example to uncheck the checkbox
5
5
 
6
6
  Scenario: Uncheck the checkbox
7
7
  Given I am on "/test--when--i-check-uncheck-checkbox.html"
8
- When I check "#bike"
9
- And I check "#car"
8
+ When I check "bike"
9
+ And I check "car"
10
10
  And I press "Submit"
11
11
  Then I should see "You have a Bike Car"
12
- When I check "#van"
12
+ When I check "van"
13
13
  And I press "Submit"
14
14
  Then I should see "You have a Bike Car Van"
15
- When I uncheck "#bike"
15
+ When I uncheck "bike"
16
16
  And I press "Submit"
17
17
  Then I should see "You have a Car Van"
18
- When I uncheck "#car"
19
- When I uncheck "#van"
18
+ When I uncheck "car"
19
+ When I uncheck "van"
20
20
  And I press "Submit"
21
21
  Then I should see "You have a"
22
22
 
@@ -5,7 +5,7 @@ Feature: An example to select option from drop down list
5
5
 
6
6
  Scenario: Check of selecting option from drop down list
7
7
  Given I am on "/test--when--i-select-option-from-dropdownlist.html"
8
- When I select "saab" from "cars"
8
+ When I select "Saab" from "cars"
9
9
  When I press "Check select"
10
10
  Then I should see "Option ( Saab ) has been selected successfully"
11
11
 
@@ -189,15 +189,12 @@ When(/^(I|we)* fill in the following:$/, function (pronoundCase, table) {
189
189
 
190
190
  /**
191
191
  * Selects option in select field
192
- * Example: When I select "mercedes" from "Cars"
192
+ * Example: When I select "Mercedes" from "Cars"
193
193
  *
194
194
  */
195
195
  When(/^(I|we)* select "([^"]*)?" from "([^"]*)?"$/, function (pronoundCase, option, dropdownlist) {
196
196
 
197
- browser.waitForElementVisible('css selector', 'select[name="' + dropdownlist + '"]')
198
- .click('select[name="' + dropdownlist + '"]')
199
- .click('select[name="' + dropdownlist + '"]' + ' option[value=' + option + ']')
200
- .click('select[name="' + dropdownlist + '"]');
197
+ browser.selectOption(option, dropdownlist);
201
198
  });
202
199
 
203
200
  /**
@@ -207,7 +204,7 @@ When(/^(I|we)* select "([^"]*)?" from "([^"]*)?"$/, function (pronoundCase, opti
207
204
  */
208
205
  When(/^(I|we)* check "([^"]*)?"$/, function (pronoundCase, item) {
209
206
 
210
- browser.click(item);
207
+ browser.checkItem(item);
211
208
  });
212
209
 
213
210
  /**
@@ -217,7 +214,7 @@ When(/^(I|we)* check "([^"]*)?"$/, function (pronoundCase, item) {
217
214
  */
218
215
  When(/^(I|we)* uncheck "([^"]*)?"$/, function (pronoundCase, item) {
219
216
 
220
- browser.click(item);
217
+ browser.uncheckItem(item);
221
218
  });
222
219
 
223
220
  /**