webship-js 1.0.47 → 2.0.0-alpha1
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 +15 -63
- package/.claude/settings.local.json +128 -4
- package/.github/workflows/github-actions.yml +7 -37
- package/.gitlab-ci.yml +11 -35
- package/.travis-ci.yml +12 -23
- package/.travis.yml +17 -0
- package/README.md +8 -8
- package/bitbucket-pipelines.yml +3 -7
- package/cucumber.js +36 -0
- package/examples/dynamic-examples.html +1 -2
- package/examples/index.html +0 -1
- package/examples/test--modal-dialogs.html +252 -0
- package/examples/test--when--i-click-text-in-table-row.html +1 -1
- package/examples/test--when--i-scroll-functionality.html +34 -33
- package/examples/test--when--i-scroll-left-right-functionality.html +115 -173
- package/package.json +10 -21
- package/playwright.config.ts +37 -0
- package/tests/assets/test-document.pdf +14 -0
- package/tests/step-definitions/webship-api.js +5 -31
- package/tests/step-definitions/webship.js +849 -2498
- package/tsconfig.json +10 -0
- package/.eslintignore +0 -3
- package/.eslintrc.json +0 -34
- package/assets/config_templates/circleci-linux-chrome.conf.js +0 -130
- package/assets/config_templates/github-linux-chrome.conf.js +0 -136
- package/dist/nightwatch.conf.dev.js +0 -93
- package/examples/main.js +0 -17
- package/lib/custom-assertions/checkboxChecked.js +0 -87
- package/lib/custom-assertions/elementContainsCss.js +0 -94
- package/lib/custom-assertions/elementContainsText.js +0 -86
- package/lib/custom-assertions/responseStatus.js +0 -31
- package/lib/custom-assertions/shouldVisible.js +0 -8
- package/lib/custom-assertions/textMatching.js +0 -44
- package/lib/custom-commands/checkItem.js +0 -4
- package/lib/custom-commands/clickLink.js +0 -23
- package/lib/custom-commands/fileUpload.js +0 -37
- package/lib/custom-commands/fillTextInput.js +0 -56
- package/lib/custom-commands/press.js +0 -3
- package/lib/custom-commands/selectOption.js +0 -11
- package/lib/custom-commands/uncheckItem.js +0 -4
- package/lib/custom-commands/wait.js +0 -12
- package/nightwatch.conf.js +0 -136
- package/src/index.js +0 -10
- package/steplist.js +0 -245
- package/webpack.config.js +0 -17
- package/webship-init.js +0 -75
package/cucumber.js
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
default: {
|
|
3
|
+
timeout: 30000,
|
|
4
|
+
requireModule: ['ts-node/register'],
|
|
5
|
+
require: [
|
|
6
|
+
'tests/step-definitions/**/*.js',
|
|
7
|
+
],
|
|
8
|
+
paths: ['tests/features/**/*.feature'],
|
|
9
|
+
format: [
|
|
10
|
+
'@cucumber/pretty-formatter',
|
|
11
|
+
'json:tests/reports/cucumber_report.json',
|
|
12
|
+
],
|
|
13
|
+
formatOptions: {
|
|
14
|
+
colorsEnabled: true,
|
|
15
|
+
theme: {
|
|
16
|
+
'feature keyword': ['bold', 'blue'],
|
|
17
|
+
'feature name': ['blue', 'underline'],
|
|
18
|
+
'feature description': ['blueBright'],
|
|
19
|
+
'scenario keyword': ['bold', 'magenta'],
|
|
20
|
+
'scenario name': ['magenta', 'underline'],
|
|
21
|
+
'step keyword': ['bold', 'green'],
|
|
22
|
+
'step text': ['greenBright', 'italic'],
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
worldParameters: {
|
|
26
|
+
launchUrl: process.env.LAUNCH_URL || 'http://localhost:8080',
|
|
27
|
+
minWaitTime: {
|
|
28
|
+
page: 3000,
|
|
29
|
+
before_scenario: 0,
|
|
30
|
+
after_scenario: 0,
|
|
31
|
+
before_step: 0,
|
|
32
|
+
after_step: 0,
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
};
|
|
@@ -452,7 +452,7 @@
|
|
|
452
452
|
itemCount++;
|
|
453
453
|
document.getElementById('items-list').innerHTML += `<p>Item ${itemCount}</p>`;
|
|
454
454
|
}
|
|
455
|
-
},
|
|
455
|
+
}, 3000);
|
|
456
456
|
}
|
|
457
457
|
});
|
|
458
458
|
|
|
@@ -472,7 +472,6 @@
|
|
|
472
472
|
count++;
|
|
473
473
|
setTimeout(() => {
|
|
474
474
|
document.getElementById('counter').textContent = count;
|
|
475
|
-
document.getElementById('react-app-container').querySelector('p:nth-child(2)').textContent = `Count: ${count}`;
|
|
476
475
|
}, 100);
|
|
477
476
|
}
|
|
478
477
|
|
package/examples/index.html
CHANGED
|
@@ -0,0 +1,252 @@
|
|
|
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>Modal Dialogs Test</title>
|
|
7
|
+
<style>
|
|
8
|
+
body { font-family: Arial, sans-serif; padding: 20px; }
|
|
9
|
+
button { margin: 5px; padding: 8px 16px; cursor: pointer; border-radius: 4px; border: 1px solid #ccc; }
|
|
10
|
+
.open-settings { background: #6c757d; color: white; border-color: #6c757d; }
|
|
11
|
+
table { border-collapse: collapse; width: 100%; margin: 20px 0; }
|
|
12
|
+
th, td { border: 1px solid #ddd; padding: 8px; text-align: left; }
|
|
13
|
+
th { background: #f2f2f2; }
|
|
14
|
+
#notification { margin-top: 10px; padding: 8px; display: none; color: green; }
|
|
15
|
+
|
|
16
|
+
/* Modal overlay */
|
|
17
|
+
.modal-overlay {
|
|
18
|
+
display: none;
|
|
19
|
+
position: fixed;
|
|
20
|
+
top: 0; left: 0; width: 100%; height: 100%;
|
|
21
|
+
background: rgba(0,0,0,0.5);
|
|
22
|
+
z-index: 1000;
|
|
23
|
+
justify-content: center;
|
|
24
|
+
align-items: center;
|
|
25
|
+
}
|
|
26
|
+
.modal-overlay.active {
|
|
27
|
+
display: flex;
|
|
28
|
+
}
|
|
29
|
+
.modal {
|
|
30
|
+
background: white;
|
|
31
|
+
border-radius: 8px;
|
|
32
|
+
padding: 24px;
|
|
33
|
+
max-width: 500px;
|
|
34
|
+
width: 90%;
|
|
35
|
+
position: relative;
|
|
36
|
+
box-shadow: 0 4px 20px rgba(0,0,0,0.3);
|
|
37
|
+
}
|
|
38
|
+
.modal-title { margin: 0 0 16px; font-size: 1.3em; }
|
|
39
|
+
.modal-body { margin-bottom: 16px; }
|
|
40
|
+
.modal-footer { display: flex; gap: 8px; justify-content: flex-end; }
|
|
41
|
+
.modal-footer button { padding: 8px 16px; }
|
|
42
|
+
.btn-primary { background: #007bff; color: white; border-color: #007bff; }
|
|
43
|
+
.btn-danger { background: #dc3545; color: white; border-color: #dc3545; }
|
|
44
|
+
.btn-secondary { background: #6c757d; color: white; border-color: #6c757d; }
|
|
45
|
+
.close {
|
|
46
|
+
position: absolute;
|
|
47
|
+
top: 12px; right: 16px;
|
|
48
|
+
font-size: 1.4em;
|
|
49
|
+
cursor: pointer;
|
|
50
|
+
background: none;
|
|
51
|
+
border: none;
|
|
52
|
+
color: #888;
|
|
53
|
+
}
|
|
54
|
+
.modal-success { color: green; margin-top: 10px; display: none; }
|
|
55
|
+
input[type="text"], input[type="email"], textarea {
|
|
56
|
+
width: 100%; padding: 6px; margin: 4px 0 10px; box-sizing: border-box;
|
|
57
|
+
border: 1px solid #ddd; border-radius: 4px;
|
|
58
|
+
}
|
|
59
|
+
</style>
|
|
60
|
+
</head>
|
|
61
|
+
<body>
|
|
62
|
+
<h1>Modal Dialogs Test Page</h1>
|
|
63
|
+
|
|
64
|
+
<!-- Trigger buttons -->
|
|
65
|
+
<button id="show-welcome-modal" onclick="openModal('welcome-modal')">Show Welcome Modal</button>
|
|
66
|
+
<button class="open-settings" onclick="openModal('settings-modal')">Open Settings</button>
|
|
67
|
+
<button id="contact-form-btn" onclick="openModal('contact-modal')">Contact Form</button>
|
|
68
|
+
<button id="show-modal" onclick="openModal('basic-modal')">Show Modal</button>
|
|
69
|
+
<button id="trigger-modal" onclick="openModal('confirm-modal')">Trigger Modal</button>
|
|
70
|
+
<button id="delete-btn" onclick="openModal('delete-confirmation-modal')">Delete Item</button>
|
|
71
|
+
|
|
72
|
+
<div id="notification">Project deleted successfully</div>
|
|
73
|
+
|
|
74
|
+
<!-- Projects table for modal-error-handling-example -->
|
|
75
|
+
<h2>Projects</h2>
|
|
76
|
+
<table id="projects-table">
|
|
77
|
+
<thead>
|
|
78
|
+
<tr><th>Project</th><th>Status</th><th>Actions</th></tr>
|
|
79
|
+
</thead>
|
|
80
|
+
<tbody>
|
|
81
|
+
<tr>
|
|
82
|
+
<td>Project Alpha</td>
|
|
83
|
+
<td>Active</td>
|
|
84
|
+
<td><button onclick="openDeleteModal('Project Alpha')">Delete</button></td>
|
|
85
|
+
</tr>
|
|
86
|
+
<tr>
|
|
87
|
+
<td>Project Beta</td>
|
|
88
|
+
<td>Active</td>
|
|
89
|
+
<td><button onclick="openDeleteModal('Project Beta')">Delete</button></td>
|
|
90
|
+
</tr>
|
|
91
|
+
</tbody>
|
|
92
|
+
</table>
|
|
93
|
+
|
|
94
|
+
<!-- Welcome Modal -->
|
|
95
|
+
<div id="welcome-modal-overlay" class="modal-overlay" role="dialog" aria-label="Welcome Message">
|
|
96
|
+
<div class="modal" id="welcome-modal">
|
|
97
|
+
<button class="close" onclick="closeModal('welcome-modal-overlay')">×</button>
|
|
98
|
+
<h2 class="modal-title">Welcome Message</h2>
|
|
99
|
+
<div class="modal-body">
|
|
100
|
+
<p>Thank you for joining us!</p>
|
|
101
|
+
<p>We're glad to have you here.</p>
|
|
102
|
+
</div>
|
|
103
|
+
<div class="modal-footer">
|
|
104
|
+
<button class="btn-primary" onclick="closeModal('welcome-modal-overlay')">OK</button>
|
|
105
|
+
</div>
|
|
106
|
+
</div>
|
|
107
|
+
</div>
|
|
108
|
+
|
|
109
|
+
<!-- Settings Modal -->
|
|
110
|
+
<div id="settings-modal-overlay" class="modal-overlay" role="dialog" aria-label="User Settings">
|
|
111
|
+
<div class="modal" id="settings-modal">
|
|
112
|
+
<button class="close" onclick="closeModal('settings-modal-overlay')">×</button>
|
|
113
|
+
<h2 class="modal-title">User Settings</h2>
|
|
114
|
+
<div class="modal-body">
|
|
115
|
+
<label>Username:</label>
|
|
116
|
+
<input type="text" id="username" name="username" placeholder="Enter username">
|
|
117
|
+
<label>Email:</label>
|
|
118
|
+
<input type="email" id="email" name="email" placeholder="Enter email">
|
|
119
|
+
<div class="modal-success" id="settings-success">Settings saved successfully</div>
|
|
120
|
+
</div>
|
|
121
|
+
<div class="modal-footer">
|
|
122
|
+
<button class="btn-primary" onclick="saveSettings()">Save Changes</button>
|
|
123
|
+
<button class="btn-secondary" onclick="closeModal('settings-modal-overlay')">Close</button>
|
|
124
|
+
</div>
|
|
125
|
+
</div>
|
|
126
|
+
</div>
|
|
127
|
+
|
|
128
|
+
<!-- Contact Modal -->
|
|
129
|
+
<div id="contact-modal-overlay" class="modal-overlay" role="dialog" aria-label="Contact Form">
|
|
130
|
+
<div class="modal" id="contact-modal">
|
|
131
|
+
<button class="close" onclick="closeModal('contact-modal-overlay')">×</button>
|
|
132
|
+
<h2 class="modal-title">Contact Us</h2>
|
|
133
|
+
<div class="modal-body">
|
|
134
|
+
<p>Enter payment details</p>
|
|
135
|
+
<input type="text" id="contact-name" name="contact-name" placeholder="Your name">
|
|
136
|
+
<input type="email" id="contact-email" name="contact-email" placeholder="Your email">
|
|
137
|
+
<textarea id="contact-message" name="contact-message" rows="3" placeholder="Message"></textarea>
|
|
138
|
+
<div class="modal-success" id="contact-success">Message sent successfully</div>
|
|
139
|
+
</div>
|
|
140
|
+
<div class="modal-footer">
|
|
141
|
+
<button class="btn-primary" onclick="submitContact()">Submit</button>
|
|
142
|
+
<button class="btn-secondary" onclick="closeModal('contact-modal-overlay')">Cancel</button>
|
|
143
|
+
</div>
|
|
144
|
+
</div>
|
|
145
|
+
</div>
|
|
146
|
+
|
|
147
|
+
<!-- Basic Modal -->
|
|
148
|
+
<div id="basic-modal-overlay" class="modal-overlay" role="dialog">
|
|
149
|
+
<div class="modal" id="basic-modal">
|
|
150
|
+
<button class="close" onclick="closeModal('basic-modal-overlay')">×</button>
|
|
151
|
+
<h2 class="modal-title">Welcome</h2>
|
|
152
|
+
<div class="modal-body">
|
|
153
|
+
<p>This is a sample modal dialog</p>
|
|
154
|
+
</div>
|
|
155
|
+
<div class="modal-footer">
|
|
156
|
+
<button class="btn-primary" onclick="closeModal('basic-modal-overlay')">OK</button>
|
|
157
|
+
</div>
|
|
158
|
+
</div>
|
|
159
|
+
</div>
|
|
160
|
+
|
|
161
|
+
<!-- Confirm Modal -->
|
|
162
|
+
<div id="confirm-modal-overlay" class="modal-overlay" role="dialog">
|
|
163
|
+
<div class="modal" id="confirm-modal">
|
|
164
|
+
<button class="close" onclick="closeModal('confirm-modal-overlay')">×</button>
|
|
165
|
+
<h2 class="modal-title">Confirm Action</h2>
|
|
166
|
+
<div class="modal-body">
|
|
167
|
+
<p>Are you sure you want to proceed?</p>
|
|
168
|
+
</div>
|
|
169
|
+
<div class="modal-footer">
|
|
170
|
+
<button class="btn-primary" onclick="closeModal('confirm-modal-overlay')">Confirm</button>
|
|
171
|
+
<button class="btn-secondary" onclick="closeModal('confirm-modal-overlay')">Cancel</button>
|
|
172
|
+
</div>
|
|
173
|
+
</div>
|
|
174
|
+
</div>
|
|
175
|
+
|
|
176
|
+
<!-- Delete Confirmation Modal -->
|
|
177
|
+
<div id="delete-confirmation-modal-overlay" class="modal-overlay" role="dialog">
|
|
178
|
+
<div class="modal" id="delete-confirmation-modal">
|
|
179
|
+
<button class="close" onclick="closeModal('delete-confirmation-modal-overlay')">×</button>
|
|
180
|
+
<h2 class="modal-title">Confirm Delete</h2>
|
|
181
|
+
<div class="modal-body">
|
|
182
|
+
<p>Are you sure you want to delete this item?</p>
|
|
183
|
+
<p>This action cannot be undone</p>
|
|
184
|
+
</div>
|
|
185
|
+
<div class="modal-footer">
|
|
186
|
+
<button class="btn-danger" onclick="confirmDelete()">Yes, Delete</button>
|
|
187
|
+
<button class="btn-secondary" onclick="closeModal('delete-confirmation-modal-overlay')">Cancel</button>
|
|
188
|
+
</div>
|
|
189
|
+
</div>
|
|
190
|
+
</div>
|
|
191
|
+
|
|
192
|
+
<!-- Project Delete Confirmation Modal -->
|
|
193
|
+
<div id="project-delete-modal-overlay" class="modal-overlay" role="dialog">
|
|
194
|
+
<div class="modal" id="project-delete-modal">
|
|
195
|
+
<button class="close" onclick="closeModal('project-delete-modal-overlay')">×</button>
|
|
196
|
+
<h2 class="modal-title">Confirm Delete</h2>
|
|
197
|
+
<div class="modal-body">
|
|
198
|
+
<p id="project-delete-message">Are you sure you want to delete this project?</p>
|
|
199
|
+
</div>
|
|
200
|
+
<div class="modal-footer">
|
|
201
|
+
<button class="btn-danger" onclick="confirmProjectDelete()">Yes, Delete</button>
|
|
202
|
+
<button class="btn-secondary" onclick="closeModal('project-delete-modal-overlay')">Cancel</button>
|
|
203
|
+
</div>
|
|
204
|
+
</div>
|
|
205
|
+
</div>
|
|
206
|
+
|
|
207
|
+
<script>
|
|
208
|
+
var currentProject = '';
|
|
209
|
+
|
|
210
|
+
function openModal(modalId) {
|
|
211
|
+
var overlay = document.getElementById(modalId + '-overlay');
|
|
212
|
+
if (overlay) overlay.classList.add('active');
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
function closeModal(overlayId) {
|
|
216
|
+
var overlay = document.getElementById(overlayId);
|
|
217
|
+
if (overlay) overlay.classList.remove('active');
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
function openDeleteModal(projectName) {
|
|
221
|
+
currentProject = projectName;
|
|
222
|
+
document.getElementById('project-delete-message').textContent =
|
|
223
|
+
'Are you sure you want to delete ' + projectName + '?';
|
|
224
|
+
openModal('project-delete-modal');
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
function confirmDelete() {
|
|
228
|
+
closeModal('delete-confirmation-modal-overlay');
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
function confirmProjectDelete() {
|
|
232
|
+
closeModal('project-delete-modal-overlay');
|
|
233
|
+
var n = document.getElementById('notification');
|
|
234
|
+
n.style.display = 'block';
|
|
235
|
+
setTimeout(function() { n.style.display = 'none'; }, 5000);
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
function saveSettings() {
|
|
239
|
+
var s = document.getElementById('settings-success');
|
|
240
|
+
s.style.display = 'block';
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
function submitContact() {
|
|
244
|
+
var s = document.getElementById('contact-success');
|
|
245
|
+
s.style.display = 'block';
|
|
246
|
+
setTimeout(function() {
|
|
247
|
+
closeModal('contact-modal-overlay');
|
|
248
|
+
}, 3000);
|
|
249
|
+
}
|
|
250
|
+
</script>
|
|
251
|
+
</body>
|
|
252
|
+
</html>
|
|
@@ -167,7 +167,7 @@
|
|
|
167
167
|
function performAction(action, identifier) {
|
|
168
168
|
const resultElement = document.getElementById('action-message');
|
|
169
169
|
const timestamp = new Date().toLocaleTimeString();
|
|
170
|
-
resultElement.innerHTML =
|
|
170
|
+
resultElement.innerHTML = `Performed (${action}) action on (${identifier})`;
|
|
171
171
|
|
|
172
172
|
// Prevent default link behavior
|
|
173
173
|
event.preventDefault();
|
|
@@ -128,41 +128,42 @@
|
|
|
128
128
|
}
|
|
129
129
|
|
|
130
130
|
// Add scroll event listeners to show appropriate indicators
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
// Track scroll direction
|
|
158
|
-
if (scrollY > (window.lastScrollY || 0)) {
|
|
159
|
-
window.lastScrollDirection = 'down';
|
|
131
|
+
var wasAtBottom = false;
|
|
132
|
+
var everScrolledDown = false;
|
|
133
|
+
var lastScrollY = 0;
|
|
134
|
+
|
|
135
|
+
window.addEventListener('scroll', function () {
|
|
136
|
+
var scrollY = window.scrollY;
|
|
137
|
+
var docHeight = document.documentElement.scrollHeight;
|
|
138
|
+
var winHeight = window.innerHeight;
|
|
139
|
+
var maxScroll = docHeight - winHeight;
|
|
140
|
+
var atBottom = scrollY >= maxScroll - 10;
|
|
141
|
+
var atTop = scrollY <= 0;
|
|
142
|
+
var goingDown = scrollY > lastScrollY;
|
|
143
|
+
|
|
144
|
+
document.querySelectorAll('.indicator').forEach(function (el) { el.style.display = 'none'; });
|
|
145
|
+
|
|
146
|
+
if (atTop && everScrolledDown) {
|
|
147
|
+
document.getElementById('scroll-to-top').style.display = 'block';
|
|
148
|
+
} else if (atBottom) {
|
|
149
|
+
wasAtBottom = true;
|
|
150
|
+
everScrolledDown = true;
|
|
151
|
+
} else if (wasAtBottom && !goingDown) {
|
|
152
|
+
var distFromBottom = maxScroll - scrollY;
|
|
153
|
+
if (distFromBottom >= 340) {
|
|
154
|
+
document.getElementById('basic-scroll-up').style.display = 'block';
|
|
160
155
|
} else {
|
|
161
|
-
|
|
156
|
+
document.getElementById('custom-scroll-up').style.display = 'block';
|
|
162
157
|
}
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
158
|
+
} else if (scrollY >= 450) {
|
|
159
|
+
document.getElementById('custom-scroll-down').style.display = 'block';
|
|
160
|
+
everScrolledDown = true;
|
|
161
|
+
} else if (scrollY > 0) {
|
|
162
|
+
document.getElementById('basic-scroll-down').style.display = 'block';
|
|
163
|
+
everScrolledDown = true;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
lastScrollY = scrollY;
|
|
166
167
|
});
|
|
167
168
|
|
|
168
169
|
// Add scroll event listener for the scrollable container
|