webship-js 1.0.29 → 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.
@@ -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,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.29",
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
 
@@ -204,7 +204,7 @@ When(/^(I|we)* select "([^"]*)?" from "([^"]*)?"$/, function (pronoundCase, opti
204
204
  */
205
205
  When(/^(I|we)* check "([^"]*)?"$/, function (pronoundCase, item) {
206
206
 
207
- browser.click(item);
207
+ browser.checkItem(item);
208
208
  });
209
209
 
210
210
  /**
@@ -214,7 +214,7 @@ When(/^(I|we)* check "([^"]*)?"$/, function (pronoundCase, item) {
214
214
  */
215
215
  When(/^(I|we)* uncheck "([^"]*)?"$/, function (pronoundCase, item) {
216
216
 
217
- browser.click(item);
217
+ browser.uncheckItem(item);
218
218
  });
219
219
 
220
220
  /**