webship-js 1.0.42 → 1.0.43

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.
@@ -23,13 +23,12 @@ commands:
23
23
  command: Xvfb -ac :99 -screen 0 1600x1200x24 > /dev/null 2>&1
24
24
  background: true
25
25
 
26
- ## Install node js, npm, yarn, and gulp
26
+ ## Install node js, npm, and gulp
27
27
  - run:
28
28
  name: Install node js
29
29
  command: |
30
30
  curl -sL https://deb.nodesource.com/setup_20.x | sudo bash -
31
31
  sudo apt install -y nodejs
32
- sudo npm install -g yarn
33
32
  ## Install Java.
34
33
  - run:
35
34
  name: Install Java
@@ -79,11 +78,12 @@ jobs:
79
78
  <<: *defaults
80
79
  steps:
81
80
  - webship-js-build
82
- ## Automated Functional Acceptance Testing
81
+ ## Install npm dependencies
83
82
  - run:
84
- name: Install yarn
83
+ name: Install npm dependencies
85
84
  command: |
86
- yarn install
85
+ npm install
86
+ ## Automated Functional Acceptance Testing
87
87
  - run:
88
88
  name: Configure nightwatch.conf.js for Circle CI
89
89
  command: |
@@ -92,12 +92,12 @@ jobs:
92
92
  name: Start virtual server
93
93
  command: |
94
94
  export NODE_OPTIONS=--openssl-legacy-provider
95
- yarn start
95
+ npm start
96
96
  background: true
97
97
  - run:
98
98
  name: Test
99
99
  command: |
100
- yarn test
100
+ npm test
101
101
  workflows:
102
102
  version: 2
103
103
  webship-js-workflow:
@@ -50,7 +50,7 @@ jobs:
50
50
 
51
51
 
52
52
  - name: Install dependencies
53
- run: yarn install
53
+ run: npm install
54
54
 
55
55
  - name: Configure nightwatch.conf.js for GitHub
56
56
  run: node webship-init -ci circleci -os linux -b chrome
@@ -58,7 +58,7 @@ jobs:
58
58
  - name: Start virtual server
59
59
  run: |
60
60
  export NODE_OPTIONS=--openssl-legacy-provider
61
- yarn start &
61
+ npm start &
62
62
 
63
63
  - name: Run tests
64
- run: yarn test
64
+ run: npm test
package/.gitlab-ci.yml CHANGED
@@ -14,7 +14,6 @@ before_script:
14
14
  - sudo apt-get install -yqq xvfb libasound2 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3.0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 libnss3
15
15
  - curl -sL https://deb.nodesource.com/setup_20.x | sudo bash -
16
16
  - sudo apt-get install -y nodejs
17
- - sudo npm install -g yarn
18
17
  - sudo apt-get update
19
18
  - sudo apt-get install -y openjdk-11-jre openjdk-11-jre-headless openjdk-11-jdk openjdk-11-jdk-headless
20
19
  - sudo apt-get install -y libu2f-udev
@@ -38,11 +37,11 @@ webship-js-build:
38
37
  script:
39
38
  - wget https://github.com/SeleniumHQ/selenium/releases/download/selenium-4.4.0/selenium-server-4.4.0.jar
40
39
  - nohup java -jar selenium-server-4.4.0.jar standalone > selenium.log 2>&1 &
41
- - yarn install
40
+ - npm install
42
41
  - node webship-init -ci circleci -os linux -b chrome
43
42
  - export NODE_OPTIONS=--openssl-legacy-provider
44
- - yarn start &
45
- - yarn test
43
+ - npm start &
44
+ - npm test
46
45
 
47
46
  only:
48
47
  refs:
package/README.md CHANGED
@@ -12,10 +12,10 @@ Webship-js is an Automated Functional Acceptance Testing tool. Helps to ease and
12
12
  All you need to know is at [webship-js Docs](https://webship.co/docs/webship-js/1.0.x).
13
13
 
14
14
 
15
- ## Install webship-js using Yarn
15
+ ## Install webship-js using npm
16
16
 
17
17
  ```
18
- yarn add webship-js
18
+ npm install webship-js
19
19
  ```
20
20
 
21
21
  ## Install files required by the webship-js tool
@@ -27,5 +27,5 @@ bash <(wget -O - https://raw.githubusercontent.com/webship/wbash/v1/webship-js/v
27
27
  ## Automated Functional Acceptance Testing
28
28
 
29
29
  ```
30
- yarn test
30
+ npm test
31
31
  ```
@@ -1,25 +1,20 @@
1
- image: node:20 # Choose an appropriate Node.js version
1
+ image: node:20
2
2
 
3
3
  pipelines:
4
4
  default:
5
5
  - step:
6
6
  name: Install and Test
7
+ services:
8
+ - selenium
7
9
  caches:
8
10
  - node
9
11
  script:
10
- - npm install # Install your Node.js dependencies
11
- - npm install selenium-webdriver --save # Install the Selenium WebDriver
12
- - npm install chromedriver --save # Install ChromeDriver (for running tests in Chrome)
13
- # Add other dependencies as needed
14
-
15
- # Set up your test environment here (e.g., starting a server, configuring the application)
16
- # For example, if you have a start script defined in your package.json:
17
- # - npm run start & # Start your server in the background
18
-
19
- # Run your tests here, assuming you have a test script defined in your package.json:
20
- - yarn install
21
- - yarn test
22
-
23
-
24
-
12
+ - npm install
13
+ - npm test
25
14
 
15
+ definitions:
16
+ services:
17
+ selenium:
18
+ image: selenium/standalone-chrome:latest
19
+ ports:
20
+ - 4444:4444
@@ -0,0 +1,232 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Table Row Text Assertion Test</title>
7
+ <style>
8
+ body {
9
+ font-family: Arial, sans-serif;
10
+ margin: 20px;
11
+ }
12
+ table {
13
+ border-collapse: collapse;
14
+ width: 100%;
15
+ margin: 20px 0;
16
+ }
17
+ th, td {
18
+ border: 1px solid #ddd;
19
+ padding: 8px;
20
+ text-align: left;
21
+ }
22
+ th {
23
+ background-color: #f2f2f2;
24
+ }
25
+ .status-active { color: #28a745; font-weight: bold; }
26
+ .status-inactive { color: #dc3545; font-weight: bold; }
27
+ .status-pending { color: #ffc107; font-weight: bold; }
28
+ .price { color: #007bff; font-weight: bold; }
29
+ .stock-high { color: #28a745; }
30
+ .stock-low { color: #dc3545; }
31
+ .badge {
32
+ padding: 3px 8px;
33
+ border-radius: 3px;
34
+ font-size: 0.8em;
35
+ font-weight: bold;
36
+ text-transform: uppercase;
37
+ }
38
+ .badge-admin { background-color: #dc3545; color: white; }
39
+ .badge-user { background-color: #17a2b8; color: white; }
40
+ .badge-manager { background-color: #28a745; color: white; }
41
+ .badge-guest { background-color: #6c757d; color: white; }
42
+ </style>
43
+ </head>
44
+ <body>
45
+ <h1>Table Row Text Assertion Test Page</h1>
46
+ <p>This page demonstrates text visibility assertions within table rows for automated testing.</p>
47
+
48
+ <h2>Employee Directory</h2>
49
+ <table id="employees-table">
50
+ <thead>
51
+ <tr>
52
+ <th>Name</th>
53
+ <th>Email</th>
54
+ <th>Department</th>
55
+ <th>Role</th>
56
+ <th>Status</th>
57
+ <th>Salary</th>
58
+ </tr>
59
+ </thead>
60
+ <tbody>
61
+ <tr>
62
+ <td>John Smith</td>
63
+ <td>john.smith@company.com</td>
64
+ <td>Engineering</td>
65
+ <td><span class="badge badge-admin">Admin</span></td>
66
+ <td><span class="status-active">Active</span></td>
67
+ <td class="price">$85,000</td>
68
+ </tr>
69
+ <tr>
70
+ <td>Jane Doe</td>
71
+ <td>jane.doe@company.com</td>
72
+ <td>Marketing</td>
73
+ <td><span class="badge badge-user">User</span></td>
74
+ <td><span class="status-active">Active</span></td>
75
+ <td class="price">$65,000</td>
76
+ </tr>
77
+ <tr>
78
+ <td>Bob Johnson</td>
79
+ <td>bob.johnson@company.com</td>
80
+ <td>Sales</td>
81
+ <td><span class="badge badge-manager">Manager</span></td>
82
+ <td><span class="status-pending">On Leave</span></td>
83
+ <td class="price">$75,000</td>
84
+ </tr>
85
+ <tr>
86
+ <td>Alice Cooper</td>
87
+ <td>alice.cooper@company.com</td>
88
+ <td>HR</td>
89
+ <td><span class="badge badge-user">User</span></td>
90
+ <td><span class="status-inactive">Inactive</span></td>
91
+ <td class="price">$60,000</td>
92
+ </tr>
93
+ </tbody>
94
+ </table>
95
+
96
+ <h2>Product Inventory</h2>
97
+ <table id="inventory-table">
98
+ <thead>
99
+ <tr>
100
+ <th>Product Name</th>
101
+ <th>SKU</th>
102
+ <th>Category</th>
103
+ <th>Price</th>
104
+ <th>Stock</th>
105
+ <th>Availability</th>
106
+ </tr>
107
+ </thead>
108
+ <tbody>
109
+ <tr>
110
+ <td>Wireless Headphones</td>
111
+ <td>WH-2024-001</td>
112
+ <td>Electronics</td>
113
+ <td class="price">$199.99</td>
114
+ <td class="stock-high">150</td>
115
+ <td>In Stock</td>
116
+ </tr>
117
+ <tr>
118
+ <td>Gaming Mouse</td>
119
+ <td>GM-2024-002</td>
120
+ <td>Electronics</td>
121
+ <td class="price">$79.99</td>
122
+ <td class="stock-low">5</td>
123
+ <td>Low Stock</td>
124
+ </tr>
125
+ <tr>
126
+ <td>Office Chair</td>
127
+ <td>OC-2024-003</td>
128
+ <td>Furniture</td>
129
+ <td class="price">$299.99</td>
130
+ <td class="stock-low">0</td>
131
+ <td>Out of Stock</td>
132
+ </tr>
133
+ <tr>
134
+ <td>Laptop Stand</td>
135
+ <td>LS-2024-004</td>
136
+ <td>Accessories</td>
137
+ <td class="price">$49.99</td>
138
+ <td class="stock-high">87</td>
139
+ <td>In Stock</td>
140
+ </tr>
141
+ </tbody>
142
+ </table>
143
+
144
+ <h2>Order History</h2>
145
+ <table id="orders-table">
146
+ <thead>
147
+ <tr>
148
+ <th>Order ID</th>
149
+ <th>Customer</th>
150
+ <th>Product</th>
151
+ <th>Amount</th>
152
+ <th>Status</th>
153
+ <th>Date</th>
154
+ </tr>
155
+ </thead>
156
+ <tbody>
157
+ <tr>
158
+ <td>ORD-2024-001</td>
159
+ <td>Michael Chen</td>
160
+ <td>Wireless Headphones</td>
161
+ <td class="price">$199.99</td>
162
+ <td><span class="status-active">Completed</span></td>
163
+ <td>2024-08-15</td>
164
+ </tr>
165
+ <tr>
166
+ <td>ORD-2024-002</td>
167
+ <td>Sarah Wilson</td>
168
+ <td>Gaming Mouse</td>
169
+ <td class="price">$79.99</td>
170
+ <td><span class="status-pending">Processing</span></td>
171
+ <td>2024-08-16</td>
172
+ </tr>
173
+ <tr>
174
+ <td>ORD-2024-003</td>
175
+ <td>David Miller</td>
176
+ <td>Office Chair</td>
177
+ <td class="price">$299.99</td>
178
+ <td><span class="status-inactive">Cancelled</span></td>
179
+ <td>2024-08-14</td>
180
+ </tr>
181
+ <tr>
182
+ <td>ORD-2024-004</td>
183
+ <td>Emma Davis</td>
184
+ <td>Laptop Stand</td>
185
+ <td class="price">$49.99</td>
186
+ <td><span class="status-active">Shipped</span></td>
187
+ <td>2024-08-13</td>
188
+ </tr>
189
+ </tbody>
190
+ </table>
191
+
192
+ <h2>Project Status</h2>
193
+ <table id="projects-table">
194
+ <thead>
195
+ <tr>
196
+ <th>Project Name</th>
197
+ <th>Manager</th>
198
+ <th>Team Size</th>
199
+ <th>Progress</th>
200
+ <th>Priority</th>
201
+ <th>Due Date</th>
202
+ </tr>
203
+ </thead>
204
+ <tbody>
205
+ <tr>
206
+ <td>Website Redesign</td>
207
+ <td>John Smith</td>
208
+ <td>5 members</td>
209
+ <td>75%</td>
210
+ <td>High</td>
211
+ <td>2024-09-15</td>
212
+ </tr>
213
+ <tr>
214
+ <td>Mobile App</td>
215
+ <td>Jane Doe</td>
216
+ <td>8 members</td>
217
+ <td>45%</td>
218
+ <td>Medium</td>
219
+ <td>2024-10-30</td>
220
+ </tr>
221
+ <tr>
222
+ <td>API Integration</td>
223
+ <td>Bob Johnson</td>
224
+ <td>3 members</td>
225
+ <td>90%</td>
226
+ <td>High</td>
227
+ <td>2024-08-30</td>
228
+ </tr>
229
+ </tbody>
230
+ </table>
231
+ </body>
232
+ </html>
@@ -0,0 +1,178 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Table Row Click Test</title>
7
+ <style>
8
+ body {
9
+ font-family: Arial, sans-serif;
10
+ margin: 20px;
11
+ }
12
+ table {
13
+ border-collapse: collapse;
14
+ width: 100%;
15
+ margin: 20px 0;
16
+ }
17
+ th, td {
18
+ border: 1px solid #ddd;
19
+ padding: 8px;
20
+ text-align: left;
21
+ }
22
+ th {
23
+ background-color: #f2f2f2;
24
+ }
25
+ .action-btn {
26
+ background-color: #007bff;
27
+ color: white;
28
+ border: none;
29
+ padding: 5px 10px;
30
+ cursor: pointer;
31
+ border-radius: 3px;
32
+ margin: 2px;
33
+ }
34
+ .action-btn:hover {
35
+ background-color: #0056b3;
36
+ }
37
+ .edit-btn { background-color: #28a745; }
38
+ .delete-btn { background-color: #dc3545; }
39
+ .view-btn { background-color: #17a2b8; }
40
+ #result {
41
+ margin-top: 20px;
42
+ padding: 10px;
43
+ background-color: #f8f9fa;
44
+ border: 1px solid #dee2e6;
45
+ border-radius: 4px;
46
+ }
47
+ </style>
48
+ </head>
49
+ <body>
50
+ <h1>Table Row Click Test Page</h1>
51
+ <p>This page demonstrates clicking specific text within table rows for automated testing.</p>
52
+
53
+ <h2>Users Table</h2>
54
+ <table id="users-table">
55
+ <thead>
56
+ <tr>
57
+ <th>Name</th>
58
+ <th>Email</th>
59
+ <th>Role</th>
60
+ <th>Actions</th>
61
+ </tr>
62
+ </thead>
63
+ <tbody>
64
+ <tr>
65
+ <td>John Smith</td>
66
+ <td>john.smith@example.com</td>
67
+ <td>Admin</td>
68
+ <td>
69
+ <button class="action-btn edit-btn" onclick="performAction('edit', 'John Smith')">Edit</button>
70
+ <button class="action-btn view-btn" onclick="performAction('view', 'John Smith')">View Details</button>
71
+ <button class="action-btn delete-btn" onclick="performAction('delete', 'John Smith')">Delete</button>
72
+ </td>
73
+ </tr>
74
+ <tr>
75
+ <td>Jane Doe</td>
76
+ <td>jane.doe@example.com</td>
77
+ <td>User</td>
78
+ <td>
79
+ <button class="action-btn edit-btn" onclick="performAction('edit', 'Jane Doe')">Edit</button>
80
+ <button class="action-btn view-btn" onclick="performAction('view', 'Jane Doe')">View Details</button>
81
+ <button class="action-btn delete-btn" onclick="performAction('delete', 'Jane Doe')">Delete</button>
82
+ </td>
83
+ </tr>
84
+ <tr>
85
+ <td>Bob Johnson</td>
86
+ <td>bob.johnson@example.com</td>
87
+ <td>Manager</td>
88
+ <td>
89
+ <button class="action-btn edit-btn" onclick="performAction('edit', 'Bob Johnson')">Edit</button>
90
+ <button class="action-btn view-btn" onclick="performAction('view', 'Bob Johnson')">View Details</button>
91
+ <button class="action-btn delete-btn" onclick="performAction('delete', 'Bob Johnson')">Delete</button>
92
+ </td>
93
+ </tr>
94
+ </tbody>
95
+ </table>
96
+
97
+ <h2>Products Table</h2>
98
+ <table id="products-table">
99
+ <thead>
100
+ <tr>
101
+ <th>Product Name</th>
102
+ <th>Price</th>
103
+ <th>Stock</th>
104
+ <th>Actions</th>
105
+ </tr>
106
+ </thead>
107
+ <tbody>
108
+ <tr>
109
+ <td>Product A</td>
110
+ <td>$29.99</td>
111
+ <td>150</td>
112
+ <td>
113
+ <a href="#" class="action-btn" onclick="performAction('edit', 'Product A')">Edit</a>
114
+ <a href="#" class="action-btn" onclick="performAction('download', 'Product A')">Download</a>
115
+ </td>
116
+ </tr>
117
+ <tr>
118
+ <td>Product B</td>
119
+ <td>$49.99</td>
120
+ <td>75</td>
121
+ <td>
122
+ <a href="#" class="action-btn" onclick="performAction('edit', 'Product B')">Edit</a>
123
+ <a href="#" class="action-btn" onclick="performAction('download', 'Product B')">Download</a>
124
+ </td>
125
+ </tr>
126
+ </tbody>
127
+ </table>
128
+
129
+ <h2>Orders Table</h2>
130
+ <table id="orders-table">
131
+ <thead>
132
+ <tr>
133
+ <th>Order ID</th>
134
+ <th>Customer</th>
135
+ <th>Status</th>
136
+ <th>Actions</th>
137
+ </tr>
138
+ </thead>
139
+ <tbody>
140
+ <tr>
141
+ <td>Order #12345</td>
142
+ <td>Alice Cooper</td>
143
+ <td>Processing</td>
144
+ <td>
145
+ <span class="action-btn" onclick="performAction('view', 'Order #12345')">View Details</span>
146
+ <span class="action-btn" onclick="performAction('cancel', 'Order #12345')">Cancel</span>
147
+ </td>
148
+ </tr>
149
+ <tr>
150
+ <td>Order #67890</td>
151
+ <td>David Wilson</td>
152
+ <td>Shipped</td>
153
+ <td>
154
+ <span class="action-btn" onclick="performAction('view', 'Order #67890')">View Details</span>
155
+ <span class="action-btn" onclick="performAction('track', 'Order #67890')">Track</span>
156
+ </td>
157
+ </tr>
158
+ </tbody>
159
+ </table>
160
+
161
+ <div id="result">
162
+ <h3>Action Result:</h3>
163
+ <p id="action-message">No action performed yet.</p>
164
+ </div>
165
+
166
+ <script>
167
+ function performAction(action, identifier) {
168
+ const resultElement = document.getElementById('action-message');
169
+ const timestamp = new Date().toLocaleTimeString();
170
+ resultElement.innerHTML = "Performed (${action}) action on (${identifier})";
171
+
172
+ // Prevent default link behavior
173
+ event.preventDefault();
174
+ return false;
175
+ }
176
+ </script>
177
+ </body>
178
+ </html>
package/package.json CHANGED
@@ -1,13 +1,12 @@
1
1
  {
2
2
  "name": "webship-js",
3
- "version": "1.0.42",
3
+ "version": "1.0.43",
4
4
  "description": "Webship JS automated functional testing.",
5
5
  "main": "index.js",
6
6
  "directories": {
7
7
  "test": "test"
8
8
  },
9
9
  "engines": {
10
- "yarn": ">= 1.6",
11
10
  "node": ">= 20.0"
12
11
  },
13
12
  "scripts": {
@@ -28,23 +27,24 @@
28
27
  },
29
28
  "homepage": "https://github.com/webship/webship-js",
30
29
  "dependencies": {
31
- "nightwatch": "~3",
32
30
  "@cucumber/cucumber": "*",
33
31
  "@cucumber/pretty-formatter": "~1",
32
+ "argparse": "~2",
34
33
  "args-parser": "~1",
35
- "cucumber-html-reporter": "~7",
34
+ "axios": "~1",
35
+ "chromedriver": "*",
36
+ "cucumber-html-reporter": "^6.0.0",
36
37
  "eslint": "~8",
37
38
  "eslint-config-airbnb-base": "~15",
38
39
  "eslint-plugin-import": "~2",
40
+ "geckodriver": "*",
39
41
  "lodash": "~4",
42
+ "nightwatch": "^3.12.2",
40
43
  "webpack": "~5",
41
- "chromedriver": "*",
42
- "geckodriver": "*",
43
44
  "webpack-cli": "~5",
44
- "webpack-dev-server": "~4",
45
- "axios": "~1"
45
+ "webpack-dev-server": "^5.2.2"
46
46
  },
47
47
  "bin": {
48
48
  "steplist": "./steplist.js"
49
49
  }
50
- }
50
+ }
@@ -0,0 +1,96 @@
1
+ Feature: Assert text visibility in table rows
2
+ As a test automation engineer
3
+ I want to verify text content within specific table rows
4
+ So that I can validate data accuracy and proper display in tables
5
+
6
+ Background:
7
+ Given I am on "/test--then--i-should-see-text-in-table-row.html"
8
+
9
+ Scenario: Verify employee information is displayed correctly
10
+ Then I should see "Admin" in the "John Smith" row
11
+ And I should see "john.smith@company.com" in the "John Smith" row
12
+ And I should see "Engineering" in the "John Smith" row
13
+ And I should see "Active" in the "John Smith" row
14
+ And I should see "$85,000" in the "John Smith" row
15
+
16
+ Scenario: Verify different employee roles are displayed
17
+ Then I should see "User" in the "Jane Doe" row
18
+ And I should see "Manager" in the "Bob Johnson" row
19
+ And I should see "User" in the "Alice Cooper" row
20
+ And I should not see "Admin" in the "Jane Doe" row
21
+ And I should not see "Admin" in the "Bob Johnson" row
22
+
23
+ Scenario: Verify employee status visibility
24
+ Then I should see "Active" in the "John Smith" row
25
+ And I should see "Active" in the "Jane Doe" row
26
+ And I should see "On Leave" in the "Bob Johnson" row
27
+ And I should see "Inactive" in the "Alice Cooper" row
28
+ And I should not see "Inactive" in the "John Smith" row
29
+ And I should not see "Active" in the "Alice Cooper" row
30
+
31
+ Scenario: Verify product inventory information
32
+ Then I should see "Wireless Headphones" in the "WH-2024-001" row
33
+ And I should see "$199.99" in the "Wireless Headphones" row
34
+ And I should see "150" in the "Wireless Headphones" row
35
+ And I should see "In Stock" in the "Wireless Headphones" row
36
+ And I should not see "Out of Stock" in the "Wireless Headphones" row
37
+
38
+ Scenario: Verify low stock and out of stock products
39
+ Then I should see "Low Stock" in the "Gaming Mouse" row
40
+ And I should see "5" in the "Gaming Mouse" row
41
+ And I should see "Out of Stock" in the "Office Chair" row
42
+ And I should see "0" in the "Office Chair" row
43
+ And I should not see "In Stock" in the "Gaming Mouse" row
44
+ And I should not see "In Stock" in the "Office Chair" row
45
+
46
+ Scenario: Verify order status information
47
+ Then I should see "Completed" in the "ORD-2024-001" row
48
+ And I should see "Michael Chen" in the "ORD-2024-001" row
49
+ And I should see "Processing" in the "ORD-2024-002" row
50
+ And I should see "Sarah Wilson" in the "ORD-2024-002" row
51
+ And I should see "Cancelled" in the "ORD-2024-003" row
52
+ And I should see "Shipped" in the "ORD-2024-004" row
53
+
54
+ Scenario: Verify negative assertions for order status
55
+ Then I should not see "Processing" in the "ORD-2024-001" row
56
+ And I should not see "Completed" in the "ORD-2024-002" row
57
+ And I should not see "Shipped" in the "ORD-2024-003" row
58
+ And I should not see "Cancelled" in the "ORD-2024-004" row
59
+
60
+ Scenario: Verify project information
61
+ Then I should see "Website Redesign" in the "John Smith" row
62
+ And I should see "75%" in the "Website Redesign" row
63
+ And I should see "High" in the "Website Redesign" row
64
+ And I should see "Mobile App" in the "Jane Doe" row
65
+ And I should see "45%" in the "Mobile App" row
66
+ And I should see "Medium" in the "Mobile App" row
67
+
68
+ Scenario: Verify project progress and priorities
69
+ Then I should see "90%" in the "API Integration" row
70
+ And I should see "High" in the "API Integration" row
71
+ And I should see "3 members" in the "API Integration" row
72
+ And I should not see "Low" in the "API Integration" row
73
+ And I should not see "100%" in the "API Integration" row
74
+
75
+ Scenario: Cross-table data verification
76
+ Then I should see "John Smith" in the "john.smith@company.com" row
77
+ And I should see "John Smith" in the "Website Redesign" row
78
+ And I should see "Jane Doe" in the "jane.doe@company.com" row
79
+ And I should see "Jane Doe" in the "Mobile App" row
80
+ And I should not see "Bob Johnson" in the "Website Redesign" row
81
+ And I should not see "Alice Cooper" in the "Mobile App" row
82
+
83
+ Scenario: Verify currency and numeric data
84
+ Then I should see "$199.99" in the "Wireless Headphones" row
85
+ And I should see "$79.99" in the "Gaming Mouse" row
86
+ And I should see "$299.99" in the "Office Chair" row
87
+ And I should see "$49.99" in the "Laptop Stand" row
88
+ And I should not see "$0.00" in the "Wireless Headphones" row
89
+ And I should not see "$999.99" in the "Gaming Mouse" row
90
+
91
+ Scenario: Verify date and timestamp information
92
+ Then I should see "2024-08-15" in the "ORD-2024-001" row
93
+ And I should see "2024-08-16" in the "ORD-2024-002" row
94
+ And I should see "2024-09-15" in the "Website Redesign" row
95
+ And I should see "2024-10-30" in the "Mobile App" row
96
+ And I should not see "2023-01-01" in the "ORD-2024-001" row
@@ -0,0 +1,37 @@
1
+ Feature: Click specific text in table rows
2
+ As a test automation engineer
3
+ I want to be able to click on specific text within table rows
4
+ So that I can interact with table actions based on row content
5
+
6
+ Background:
7
+ Given I am on "/test--when--i-click-text-in-table-row.html"
8
+
9
+ Scenario: Click Edit button in John Smith row
10
+ When I click "Edit" in the "John Smith" row
11
+ Then I should see "Performed (edit) action on (John Smith)" in the "#action-message" element by attr
12
+
13
+ Scenario: Click View Details button in Jane Doe row
14
+ When I click "View Details" in the "Jane Doe" row
15
+ Then I should see "Performed (view) action on (Jane Doe)" in the "#action-message" element by attr
16
+
17
+ Scenario: Click Delete button in Bob Johnson row
18
+ When I click "Delete" in the "Bob Johnson" row
19
+ Then I should see "Performed (delete) action on (Bob Johnson)" in the "#action-message" element by attr
20
+
21
+ Scenario: Click Download link in Product A row
22
+ When I click "Download" in the "Product A" row
23
+ Then I should see "Performed (download) action on (Product A)" in the "#action-message" element by attr
24
+
25
+ Scenario: Click View Details in Order #12345 row
26
+ When I click "View Details" in the "Order #12345" row
27
+ Then I should see "Performed (view) action on (Order #12345)" in the "#action-message" element by attr
28
+
29
+ Scenario: Click Track in Order #67890 row
30
+ When I click "Track" in the "Order #67890" row
31
+ Then I should see "Performed (track) action on (Order #67890)" in the "#action-message" element by attr
32
+
33
+ Scenario: Multiple table interaction
34
+ When I click "Edit" in the "John Smith" row
35
+ And I wait 1 second
36
+ And I click "Download" in the "Product B" row
37
+ Then I should see "Performed (download) action on (Product B)" in the "#action-message" element by attr
@@ -253,6 +253,165 @@ When(/^(I |we )*click "([^"]*)?" by( its)*( "([^"]*)?")* (attribute|attr)$/, fun
253
253
 
254
254
  });
255
255
 
256
+ /**
257
+ * Clicks on specific text within a table row that contains a specified identifier text.
258
+ * This step finds a table, locates a row containing the identifier text, then clicks on the target text within that row.
259
+ *
260
+ * Example #1: When I click "Edit" in the "John Smith" row
261
+ * Example #2: When I click "Delete" in the "Product A" row
262
+ * Example #3: When we click "View Details" in the "Order #12345" row
263
+ * Example #4: And I click "Download" in the "Report 2024" row
264
+ *
265
+ */
266
+ When(/^(I |we )*click "([^"]*)?" in( the)* "([^"]*)?" row$/, function (pronounCase, clickText, theCase, rowIdentifier) {
267
+
268
+ // First, find all table elements on the page
269
+ return browser.elements('css selector', 'table', function (tableResult) {
270
+ if (tableResult.value.length === 0) {
271
+ throw new Error('No tables found on the page');
272
+ }
273
+
274
+ // Search through each table for the row containing the identifier
275
+ let foundElement = false;
276
+
277
+ tableResult.value.forEach(function (table, tableIndex) {
278
+ if (foundElement) return; // Skip if already found
279
+
280
+ // Get all rows in this table
281
+ browser.elements('css selector', 'tr', table, function (rowResult) {
282
+ if (rowResult.value.length === 0) return;
283
+
284
+ rowResult.value.forEach(function (row, rowIndex) {
285
+ if (foundElement) return; // Skip if already found
286
+
287
+ // Check if this row contains the identifier text
288
+ browser.getText(row, function (rowText) {
289
+ if (rowText.value && rowText.value.includes(rowIdentifier)) {
290
+
291
+ // Found the correct row, now look for the clickable text within this row
292
+ browser.elements('css selector', '*', row, function (cellElements) {
293
+ cellElements.value.forEach(function (element) {
294
+ if (foundElement) return; // Skip if already found
295
+
296
+ browser.getText(element, function (elementText) {
297
+ if (elementText.value && elementText.value.trim() === clickText) {
298
+ // Found the target text, click it
299
+ browser.click(element);
300
+ foundElement = true;
301
+ return;
302
+ }
303
+ });
304
+
305
+ // Also check if element is a link or button with the text
306
+ browser.getAttribute(element, 'tagName', function (tagName) {
307
+ if (foundElement) return;
308
+
309
+ if (tagName.value && (tagName.value.toLowerCase() === 'a' || tagName.value.toLowerCase() === 'button')) {
310
+ browser.getText(element, function (linkText) {
311
+ if (linkText.value && linkText.value.trim() === clickText) {
312
+ browser.click(element);
313
+ foundElement = true;
314
+ return;
315
+ }
316
+ });
317
+ }
318
+ });
319
+ });
320
+ });
321
+ }
322
+ });
323
+ });
324
+ });
325
+ });
326
+
327
+ // Add a small pause to ensure the operation completes
328
+ browser.pause(1000);
329
+
330
+ // If we didn't find the element, throw an error
331
+ if (!foundElement) {
332
+ throw new Error(`Could not find "${clickText}" in the "${rowIdentifier}" row. Please verify the table structure and text content.`);
333
+ }
334
+ });
335
+ });
336
+
337
+ /**
338
+ * Asserts that specific text is visible within a table row that contains a specified identifier text.
339
+ * This step finds a table, locates a row containing the identifier text, then verifies the target text is visible within that row.
340
+ *
341
+ * Example #1: Then I should see "Active" in the "John Smith" row
342
+ * Example #2: Then I should see "In Stock" in the "Product A" row
343
+ * Example #3: Then we should see "Processing" in the "Order #12345" row
344
+ * Example #4: And I should see "Admin" in the "john.smith@example.com" row
345
+ *
346
+ */
347
+ Then(/^(I |we )*should see "([^"]*)?" in( the)* "([^"]*)?" row$/, function (pronounCase, expectedText, theCase, rowIdentifier) {
348
+
349
+ return browser.execute(function(rowId, expectedTxt) {
350
+ // Find all tables
351
+ const tables = document.querySelectorAll('table');
352
+ if (tables.length === 0) {
353
+ throw new Error('No tables found on the page');
354
+ }
355
+
356
+ // Search through each table for the row containing the identifier
357
+ for (let table of tables) {
358
+ const rows = table.querySelectorAll('tr');
359
+ for (let row of rows) {
360
+ const rowText = row.textContent || row.innerText;
361
+ if (rowText.includes(rowId)) {
362
+ // Found the correct row, now check if it contains the expected text
363
+ if (rowText.includes(expectedTxt)) {
364
+ return true; // Found the text
365
+ }
366
+ }
367
+ }
368
+ }
369
+ return false; // Text not found
370
+ }, [rowIdentifier, expectedText], function(result) {
371
+ if (!result.value) {
372
+ throw new Error(`Could not find "${expectedText}" in the "${rowIdentifier}" row. Please verify the table structure and text content.`);
373
+ }
374
+ });
375
+ });
376
+
377
+ /**
378
+ * Asserts that specific text is NOT visible within a table row that contains a specified identifier text.
379
+ *
380
+ * Example #1: Then I should not see "Admin" in the "Jane Doe" row
381
+ * Example #2: Then I should not see "Out of Stock" in the "Product A" row
382
+ * Example #3: And I should not see "Inactive" in the "john.smith@example.com" row
383
+ *
384
+ */
385
+ Then(/^(I |we )*should not see "([^"]*)?" in( the)* "([^"]*)?" row$/, function (pronounCase, expectedText, theCase, rowIdentifier) {
386
+
387
+ return browser.execute(function(rowId, expectedTxt) {
388
+ // Find all tables
389
+ const tables = document.querySelectorAll('table');
390
+ if (tables.length === 0) {
391
+ throw new Error('No tables found on the page');
392
+ }
393
+
394
+ // Search through each table for the row containing the identifier
395
+ for (let table of tables) {
396
+ const rows = table.querySelectorAll('tr');
397
+ for (let row of rows) {
398
+ const rowText = row.textContent || row.innerText;
399
+ if (rowText.includes(rowId)) {
400
+ // Found the correct row, now check if it contains the expected text
401
+ if (rowText.includes(expectedTxt)) {
402
+ return true; // Found the text (this is bad for "should not see")
403
+ }
404
+ }
405
+ }
406
+ }
407
+ return false; // Text not found (this is good for "should not see")
408
+ }, [rowIdentifier, expectedText], function(result) {
409
+ if (result.value) {
410
+ throw new Error(`Found "${expectedText}" in the "${rowIdentifier}" row, but it should not be there.`);
411
+ }
412
+ });
413
+ });
414
+
256
415
  /**
257
416
  * Reloads current page.
258
417
  *
Binary file