webship-js 1.0.19 → 1.0.20

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.
@@ -17,7 +17,7 @@
17
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
- <li><a href="test--when--i-follow-link.html">When I go follow "link"</a></li>
20
+ <li><a href="test--when--i-click-link.html">When I click "link"</a></li>
21
21
  <li><a href="test--when--i-fill-in.html">When I fill in input text with value</a></li>
22
22
  <li><a href="test--when--i-select-option-from-selectbox.html">When I select option from select box</a></li>
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>
@@ -2,7 +2,7 @@
2
2
  <html>
3
3
  <head>
4
4
  <meta charset='utf-8'>
5
- <title>Follow Link</title>
5
+ <title>Click Link</title>
6
6
  <style>
7
7
  .style{
8
8
  font-size: 26px;
@@ -10,9 +10,9 @@
10
10
  </style>
11
11
  </head>
12
12
  <body>
13
- <h1>Follow Link</h1>
13
+ <h1>Click Link</h1>
14
14
  <div id="result" class="style">
15
- Please click <a id="aboutUs" class="aboutUs" href="about-us.html">About us link</a> for more information.
15
+ Please click <a id="aboutUsid" class="aboutUs" href="about-us.html">About us link</a> for more information.
16
16
  </div>
17
17
  </body>
18
18
  </html>
@@ -0,0 +1,23 @@
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(item);
7
+ } else {
8
+ browser.element('css selector', '#' + item, function (result) {
9
+ if (result.status === 0) {
10
+ return browser.click('#' + item);
11
+ } else {
12
+ browser.element('css selector', '.' + item, function (result) {
13
+ if (result.status === 0) {
14
+ return browser.click('.' + item);
15
+ } else {
16
+ return browser.click("link text", item);
17
+ }
18
+ });
19
+ }
20
+ });
21
+ }
22
+ });
23
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "webship-js",
3
- "version": "1.0.19",
3
+ "version": "1.0.20",
4
4
  "description": "Webship JS automated functional testing.",
5
5
  "main": "index.js",
6
6
  "directories": {
@@ -0,0 +1,17 @@
1
+ Feature: Example test for "When I click 'link'"
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
6
+
7
+ Scenario: Check the "When I click link" by link text step definitions
8
+ Given I am on "test--when--i-click-link.html"
9
+ When I click "About us link"
10
+ And I wait max of 2 seconds
11
+ Then I should see "About Us"
12
+
13
+ Scenario: Check the "When I click link" by link css class step definitions
14
+ Given I am on "test--when--i-click-link.html"
15
+ When I click "aboutUs"
16
+ And I wait max of 2 seconds
17
+ Then I should see "About Us"
@@ -82,7 +82,7 @@ When(/^I move backward one page$/, function () {
82
82
  });
83
83
 
84
84
  /**
85
- * Presses button with specified id|class|name|title|value
85
+ * Presses button with specified id|class|name|value
86
86
  * Example: When I press "Log In"
87
87
  * Example: And I press "Log In"
88
88
  *
@@ -94,14 +94,14 @@ When(/^I press "([^"]*)?"$/, function (elementValue) {
94
94
  });
95
95
 
96
96
  /**
97
- * Clicks link with specified id|class|name|title|text
98
- * Example: When I follow "Contact Us"
99
- * Example: And I follow "Log In"
97
+ * Clicks link with specified id|class|name|text
98
+ * Example: When I click "Contact Us"
99
+ * Example: And I click "aboutUs"
100
100
  *
101
- * @When /^I follow "([^"]*)?"$/
101
+ * @When /^I click "([^"]*)?"$/
102
102
  */
103
- When(/^I follow "([^"]*)?"$/, function (item) {
104
- browser.smartLinkFollow(item);
103
+ When(/^I click "([^"]*)?"$/, function (item) {
104
+ browser.smartClickLink(item);
105
105
  });
106
106
 
107
107
  /**
@@ -1,17 +0,0 @@
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
- }
@@ -1,13 +0,0 @@
1
- Feature: Example test for "When I follow 'link'"
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
6
-
7
- Scenario: Check the "When I follow link" step definitions
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
- When I move backward one page
12
- And I follow "aboutUs"
13
- Then I should see "About Us"