webship-js 1.0.41 → 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.
- package/.circleci/config.yml +8 -8
- package/.github/workflows/github-actions.yml +4 -4
- package/.gitlab-ci.yml +4 -5
- package/README.md +3 -3
- package/bitbucket-pipelines.yml +12 -18
- package/examples/test--then--i-should-see-text-in-table-row.html +232 -0
- package/examples/test--when--i-click-text-in-table-row.html +178 -0
- package/examples/test--when--i-scroll-left-right-functionality.html +207 -0
- package/package.json +10 -10
- package/steplist.js +1 -1
- package/tests/features/test--then--i-should-see-text-in-table-row.feature +96 -0
- package/tests/features/test--when--i-click-text-in-table-row.feature +37 -0
- package/tests/features/test--when--i-scroll-left-right.feature +48 -0
- package/tests/step-definitions/webship.js +360 -1
- package/lib/custom-hooks/before-after.js +0 -30
package/.circleci/config.yml
CHANGED
|
@@ -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,
|
|
26
|
+
## Install node js, npm, and gulp
|
|
27
27
|
- run:
|
|
28
28
|
name: Install node js
|
|
29
29
|
command: |
|
|
30
|
-
curl -sL https://deb.nodesource.com/
|
|
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
|
-
##
|
|
81
|
+
## Install npm dependencies
|
|
83
82
|
- run:
|
|
84
|
-
name: Install
|
|
83
|
+
name: Install npm dependencies
|
|
85
84
|
command: |
|
|
86
|
-
|
|
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
|
-
|
|
95
|
+
npm start
|
|
96
96
|
background: true
|
|
97
97
|
- run:
|
|
98
98
|
name: Test
|
|
99
99
|
command: |
|
|
100
|
-
|
|
100
|
+
npm test
|
|
101
101
|
workflows:
|
|
102
102
|
version: 2
|
|
103
103
|
webship-js-workflow:
|
|
@@ -36,7 +36,7 @@ jobs:
|
|
|
36
36
|
- name: Set up Node.js
|
|
37
37
|
uses: actions/setup-node@v3
|
|
38
38
|
with:
|
|
39
|
-
node-version: '
|
|
39
|
+
node-version: '20.x'
|
|
40
40
|
|
|
41
41
|
- name: Install Java
|
|
42
42
|
run: |
|
|
@@ -50,7 +50,7 @@ jobs:
|
|
|
50
50
|
|
|
51
51
|
|
|
52
52
|
- name: Install dependencies
|
|
53
|
-
run:
|
|
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
|
-
|
|
61
|
+
npm start &
|
|
62
62
|
|
|
63
63
|
- name: Run tests
|
|
64
|
-
run:
|
|
64
|
+
run: npm test
|
package/.gitlab-ci.yml
CHANGED
|
@@ -12,9 +12,8 @@ before_script:
|
|
|
12
12
|
- sudo apt-get upgrade -qqy
|
|
13
13
|
- sudo apt-get install -yqq vim links lynx git diffutils htop curl wget p7zip-full unzip zip sed gcc g++ make libfreetype6-dev libaio1 libaio-dev libonig-dev libpng-dev
|
|
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
|
-
- curl -sL https://deb.nodesource.com/
|
|
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
|
-
-
|
|
40
|
+
- npm install
|
|
42
41
|
- node webship-init -ci circleci -os linux -b chrome
|
|
43
42
|
- export NODE_OPTIONS=--openssl-legacy-provider
|
|
44
|
-
-
|
|
45
|
-
-
|
|
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
|
|
15
|
+
## Install webship-js using npm
|
|
16
16
|
|
|
17
17
|
```
|
|
18
|
-
|
|
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
|
-
|
|
30
|
+
npm test
|
|
31
31
|
```
|
package/bitbucket-pipelines.yml
CHANGED
|
@@ -1,26 +1,20 @@
|
|
|
1
|
-
image: node:
|
|
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
|
|
11
|
-
- npm
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
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
|
-
|
|
25
|
-
|
|
26
|
-
|
|
12
|
+
- npm install
|
|
13
|
+
- npm test
|
|
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>
|