webship-js 2.0.5 → 2.0.7
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/.drone.yml +0 -0
- package/.harness/webship-js-pipeline.yml +0 -0
- package/.semaphore/semaphore.yml +0 -0
- package/.teamcity/pom.xml +0 -0
- package/.teamcity/settings.kts +0 -0
- package/.travis.yml +0 -0
- package/AGENTS.md +1 -1
- package/CLAUDE.md +5 -5
- package/Jenkinsfile +0 -0
- package/azure-pipelines.yml +0 -0
- package/bamboo-specs/bamboo.yml +0 -0
- package/bin/generate-reports.js +0 -0
- package/bin/init-webship.js +9 -10
- package/bin/postinstall.js +0 -0
- package/buildspec.yml +0 -0
- package/cloudbuild.yaml +0 -0
- package/codefresh.yml +0 -0
- package/cucumber.js +3 -1
- package/docs/00-quick-start.md +0 -0
- package/docs/01-getting-started.md +0 -0
- package/docs/02-bbr-smart-waits.md +24 -1
- package/docs/03-selector-registry.md +0 -0
- package/docs/04-step-reference.md +4 -0
- package/docs/05-web-first-assertions.md +2 -0
- package/docs/06-network-and-dialogs.md +0 -0
- package/docs/07-auth-state.md +0 -0
- package/docs/08-clock-mocking.md +0 -0
- package/docs/09-api-testing.md +0 -0
- package/docs/10-accessibility.md +24 -3
- package/docs/11-debugging.md +0 -0
- package/docs/12-ai-agent-guide.md +0 -0
- package/docs/13-faq.md +0 -0
- package/docs/14-recipes-cookbook.md +0 -0
- package/docs/15-tag-conventions.md +0 -0
- package/docs/16-ci-cd.md +0 -0
- package/docs/README.md +2 -2
- package/docs/advanced-screenshots/then-i-save-fullscreen-screenshot.md +0 -0
- package/docs/advanced-screenshots/then-i-save-width-x-height-screenshot.md +0 -0
- package/docs/advanced-screenshots/when-i-save-screenshot-name-filename.md +0 -0
- package/docs/advanced-screenshots.md +0 -0
- package/docs/advanced-selectors.md +0 -0
- package/docs/api-step-definitions.md +0 -0
- package/docs/global-settings.md +5 -2
- package/docs/install-webship-js/ddev-webship-js.md +0 -0
- package/docs/step-definitions/given-i-am-anonymous-user.md +0 -0
- package/docs/step-definitions/given-i-am-homepage.md +0 -0
- package/docs/step-definitions/given-i-am-specific-page.md +0 -0
- package/docs/step-definitions/then-i-should-be.md +0 -0
- package/docs/step-definitions/then-i-should-see.md +6 -0
- package/docs/step-definitions/then-item-checkbox.md +0 -0
- package/docs/step-definitions/then-item-link-should-contain-url.md +0 -0
- package/docs/step-definitions/then-item-should-contain.md +0 -0
- package/docs/step-definitions/then-radio-button-value-should-be-selected.md +0 -0
- package/docs/step-definitions/then-response-status-code-should-be-number.md +0 -0
- package/docs/step-definitions/then-value-radio-button-selected.md +0 -0
- package/docs/step-definitions/when-i-attach-file-file-name-element.md +0 -0
- package/docs/step-definitions/when-i-check-checkbox.md +0 -0
- package/docs/step-definitions/when-i-click-link.md +0 -0
- package/docs/step-definitions/when-i-click-operation-text-row.md +0 -0
- package/docs/step-definitions/when-i-fill.md +0 -0
- package/docs/step-definitions/when-i-go-homepage.md +0 -0
- package/docs/step-definitions/when-i-go-specific-page.md +0 -0
- package/docs/step-definitions/when-i-move-backward-one-page.md +0 -0
- package/docs/step-definitions/when-i-move-forward-one-page.md +0 -0
- package/docs/step-definitions/when-i-press-button.md +0 -0
- package/docs/step-definitions/when-i-reload-page.md +0 -0
- package/docs/step-definitions/when-i-scroll.md +0 -0
- package/docs/step-definitions/when-i-select-option-select-list.md +0 -0
- package/docs/step-definitions/when-i-select-radio-button-value.md +0 -0
- package/docs/step-definitions/when-i-uncheck-checkbox.md +0 -0
- package/docs/step-definitions/when-i-wait-ajax-finish.md +0 -0
- package/docs/step-definitions/when-i-wait.md +0 -0
- package/docs/step-definitions.md +0 -0
- package/examples/a11y.html +8 -0
- package/examples/account.html +0 -0
- package/examples/ajax-wait-examples.html +0 -0
- package/examples/cookies.html +0 -0
- package/examples/date.html +0 -0
- package/examples/dynamic-examples.html +0 -0
- package/examples/element-visibility.html +17 -0
- package/examples/element.html +0 -0
- package/examples/field.html +0 -0
- package/examples/keyboard.html +0 -0
- package/examples/links.html +0 -0
- package/examples/modal.html +0 -0
- package/examples/native-dialogs.html +22 -0
- package/examples/never-settles.html +32 -0
- package/examples/path.html +0 -0
- package/examples/table.html +0 -0
- package/examples/test--modal-dialogs.html +0 -0
- package/examples/test--when--i-additionally-select.html +0 -0
- package/examples/test--when--i-select-radio-button.html +0 -0
- package/examples/video-demo.html +0 -0
- package/examples/web-first-text.html +18 -0
- package/package.json +2 -2
- package/playwright.config.ts +0 -0
- package/tests/assets/test-document.pdf +0 -0
- package/tests/features/a11y.feature +22 -0
- package/tests/features/ajax-wait-examples.feature +0 -0
- package/tests/features/cookie.feature +0 -0
- package/tests/features/date.feature +0 -0
- package/tests/features/dynamic-content-examples.feature +0 -0
- package/tests/features/element.feature +0 -0
- package/tests/features/field.feature +0 -0
- package/tests/features/keyboard.feature +0 -0
- package/tests/features/link.feature +0 -0
- package/tests/features/modal-advanced-example.feature +0 -0
- package/tests/features/modal-basic-example.feature +0 -0
- package/tests/features/modal-error-handling-example.feature +0 -0
- package/tests/features/modal.feature +0 -0
- package/tests/features/path.feature +0 -0
- package/tests/features/pronoun-prefix-steps.feature +81 -0
- package/tests/features/response.feature +0 -0
- package/tests/features/responsive.feature +0 -0
- package/tests/features/smart-settle-budget.feature +12 -0
- package/tests/features/table.feature +0 -0
- package/tests/features/test--given--i-am-an-anonymous-user.feature +0 -0
- package/tests/features/test--then--i-save-screenshot.feature +0 -0
- package/tests/features/test--then--i-see-locator.feature +0 -0
- package/tests/features/test--then--i-should-not-see-an-element.feature +11 -1
- package/tests/features/test--then--i-should-see-n-elements.feature +0 -0
- package/tests/features/test--then--print-current-url-and-response.feature +0 -0
- package/tests/features/test--when--i-additionally-select.feature +0 -0
- package/tests/features/test--when--i-follow.feature +0 -0
- package/tests/features/test--when--i-select-radio-button.feature +0 -0
- package/tests/features/video.feature +0 -0
- package/tests/features/wait.feature +0 -0
- package/tests/features/web-first-text.feature +21 -0
- package/tests/features/yaml.feature +0 -0
- package/tests/reports/README.md +0 -0
- package/tests/selectors/_canonical-keys.json +0 -0
- package/tests/selectors/back-end-selectors.json +0 -0
- package/tests/selectors/cms-contentful-admin.json +0 -0
- package/tests/selectors/cms-craft-admin.json +0 -0
- package/tests/selectors/cms-drupal-cms-gin.json +0 -0
- package/tests/selectors/cms-drupal-core-claro.json +0 -0
- package/tests/selectors/cms-generic-admin.json +0 -0
- package/tests/selectors/cms-ghost-admin.json +0 -0
- package/tests/selectors/cms-joomla-admin.json +0 -0
- package/tests/selectors/cms-magento2-admin.json +0 -0
- package/tests/selectors/cms-prestashop-admin.json +0 -0
- package/tests/selectors/cms-shopify-admin.json +0 -0
- package/tests/selectors/cms-strapi-admin.json +0 -0
- package/tests/selectors/cms-typo3-admin.json +0 -0
- package/tests/selectors/cms-woocommerce-front.json +0 -0
- package/tests/selectors/cms-wordpress-admin.json +0 -0
- package/tests/selectors/framework-ant-design.json +0 -0
- package/tests/selectors/framework-bootstrap.json +0 -0
- package/tests/selectors/framework-bulma.json +0 -0
- package/tests/selectors/framework-chakra.json +0 -0
- package/tests/selectors/framework-foundation.json +0 -0
- package/tests/selectors/framework-material-ui.json +0 -0
- package/tests/selectors/framework-shadcn.json +0 -0
- package/tests/selectors/framework-tailwind.json +0 -0
- package/tests/selectors/framework-vuetify.json +0 -0
- package/tests/selectors/front-end-selectors.json +0 -0
- package/tests/selectors/homepage-selectors.json +0 -0
- package/tests/step-definitions/a11y.steps.js +340 -114
- package/tests/step-definitions/action.steps.js +0 -0
- package/tests/step-definitions/api.steps.js +0 -0
- package/tests/step-definitions/assertion.steps.js +18 -3
- package/tests/step-definitions/auth.steps.js +1 -1
- package/tests/step-definitions/clock.steps.js +2 -2
- package/tests/step-definitions/cookie.steps.js +0 -0
- package/tests/step-definitions/debug.steps.js +0 -0
- package/tests/step-definitions/dialog.steps.js +4 -4
- package/tests/step-definitions/element.steps.js +0 -0
- package/tests/step-definitions/field.steps.js +0 -0
- package/tests/step-definitions/file-download.steps.js +0 -0
- package/tests/step-definitions/form.steps.js +0 -0
- package/tests/step-definitions/iframe.steps.js +1 -1
- package/tests/step-definitions/input.steps.js +0 -0
- package/tests/step-definitions/javascript.steps.js +0 -0
- package/tests/step-definitions/keyboard.steps.js +0 -0
- package/tests/step-definitions/link.steps.js +0 -0
- package/tests/step-definitions/metatag.steps.js +0 -0
- package/tests/step-definitions/modal.steps.js +0 -0
- package/tests/step-definitions/navigation.steps.js +0 -0
- package/tests/step-definitions/network.steps.js +1 -1
- package/tests/step-definitions/path.steps.js +0 -0
- package/tests/step-definitions/response.steps.js +0 -0
- package/tests/step-definitions/responsive.steps.js +0 -0
- package/tests/step-definitions/rest.steps.js +0 -0
- package/tests/step-definitions/screenshot.steps.js +0 -0
- package/tests/step-definitions/scroll.steps.js +0 -0
- package/tests/step-definitions/selectors.steps.js +0 -0
- package/tests/step-definitions/storage.steps.js +0 -0
- package/tests/step-definitions/table.steps.js +0 -0
- package/tests/step-definitions/video.steps.js +0 -0
- package/tests/step-definitions/wait.steps.js +3 -3
- package/tests/step-definitions/web-first.steps.js +14 -3
- package/tests/step-definitions/webship.js +57 -20
- package/tests/step-definitions/xml.steps.js +1 -1
- package/tests/step-definitions/yaml.steps.js +1 -1
- package/tsconfig.json +0 -0
- package/videos/README.md +0 -0
|
File without changes
|
|
@@ -59,7 +59,7 @@ function attach(world, action, promptInput, once) {
|
|
|
59
59
|
* Then the last dialog type should be "confirm"
|
|
60
60
|
*
|
|
61
61
|
*/
|
|
62
|
-
Given(/^(I |we )*will accept the next dialog$/, function () {
|
|
62
|
+
Given(/^(I |we )*will accept the next dialog$/, function (pronoun) {
|
|
63
63
|
attach(this, 'accept', undefined, true);
|
|
64
64
|
});
|
|
65
65
|
|
|
@@ -80,7 +80,7 @@ Given(/^(I |we )*will accept the next dialog$/, function () {
|
|
|
80
80
|
* When I close the tab
|
|
81
81
|
*
|
|
82
82
|
*/
|
|
83
|
-
Given(/^(I |we )*will dismiss the next dialog$/, function () {
|
|
83
|
+
Given(/^(I |we )*will dismiss the next dialog$/, function (pronoun) {
|
|
84
84
|
attach(this, 'dismiss', undefined, true);
|
|
85
85
|
});
|
|
86
86
|
|
|
@@ -171,7 +171,7 @@ Then(/^the last dialog type should be "([^"]*)"$/, function (type) {
|
|
|
171
171
|
* When I follow "Discard changes"
|
|
172
172
|
*
|
|
173
173
|
*/
|
|
174
|
-
Given(/^(I |we )*accept all confirmation dialogs$/, function () {
|
|
174
|
+
Given(/^(I |we )*accept all confirmation dialogs$/, function (pronoun) {
|
|
175
175
|
attach(this, 'accept', undefined, false);
|
|
176
176
|
});
|
|
177
177
|
|
|
@@ -188,6 +188,6 @@ Given(/^(I |we )*accept all confirmation dialogs$/, function () {
|
|
|
188
188
|
* When I follow "Leave page"
|
|
189
189
|
*
|
|
190
190
|
*/
|
|
191
|
-
Given(/^(I |we )*do not accept any confirmation dialogs$/, function () {
|
|
191
|
+
Given(/^(I |we )*do not accept any confirmation dialogs$/, function (pronoun) {
|
|
192
192
|
attach(this, 'dismiss', undefined, false);
|
|
193
193
|
});
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -77,7 +77,7 @@ When(/^(I |we )*switch to iframe with locator "([^"]*)"$/, async function (prono
|
|
|
77
77
|
* And I press "Refresh"
|
|
78
78
|
*
|
|
79
79
|
*/
|
|
80
|
-
When(/^(I |we )*switch to the root document$/, async function () {
|
|
80
|
+
When(/^(I |we )*switch to the root document$/, async function (pronoun) {
|
|
81
81
|
this.frame = null;
|
|
82
82
|
});
|
|
83
83
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -216,7 +216,7 @@ Given(/^the network is online$/, async function () {
|
|
|
216
216
|
* Then a GET request to "**\/api/feed/page=2" should have been made
|
|
217
217
|
*
|
|
218
218
|
*/
|
|
219
|
-
Given(/^(I |we )*start recording network requests$/, function () {
|
|
219
|
+
Given(/^(I |we )*start recording network requests$/, function (pronounCase) {
|
|
220
220
|
ensureRequestLog(this);
|
|
221
221
|
});
|
|
222
222
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -324,7 +324,7 @@ When(/^(I |we )*wait until at least (\d+) elements? match(?:es)? "([^"]*)"$/, as
|
|
|
324
324
|
* And I wait until requests are complete
|
|
325
325
|
*
|
|
326
326
|
*/
|
|
327
|
-
When(/^(I |we )*wait until (the network is idle|requests are complete|network goes quiet)$/, async function () {
|
|
327
|
+
When(/^(I |we )*wait until (the network is idle|requests are complete|network goes quiet)$/, async function (pronounCase, phrasing) {
|
|
328
328
|
await smartSettle(this.page, 10000);
|
|
329
329
|
});
|
|
330
330
|
|
|
@@ -344,7 +344,7 @@ When(/^(I |we )*wait until (the network is idle|requests are complete|network go
|
|
|
344
344
|
* Then "<#root>" should be attached
|
|
345
345
|
*
|
|
346
346
|
*/
|
|
347
|
-
When(/^(I |we )*wait until( the)* page is interactive$/, async function () {
|
|
347
|
+
When(/^(I |we )*wait until( the)* page is interactive$/, async function (pronounCase, theCase) {
|
|
348
348
|
await this.page.waitForSelector('body', { state: 'attached', timeout: 10000 });
|
|
349
349
|
await this.page.waitForLoadState('domcontentloaded', { timeout: 10000 });
|
|
350
350
|
});
|
|
@@ -368,7 +368,7 @@ When(/^(I |we )*wait until( the)* page is interactive$/, async function () {
|
|
|
368
368
|
* Then I should not see "Saved"
|
|
369
369
|
*
|
|
370
370
|
*/
|
|
371
|
-
When(/^(I |we )*wait until pending timers settle$/, async function () {
|
|
371
|
+
When(/^(I |we )*wait until pending timers settle$/, async function (pronounCase) {
|
|
372
372
|
await this.page.waitForFunction(
|
|
373
373
|
() => {
|
|
374
374
|
const t = window.__webshipPendingTimers;
|
|
@@ -17,6 +17,13 @@ function parseTimeout(secondsStr) {
|
|
|
17
17
|
return n > 0 ? n * 1000 : 5000;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
+
// Collapse every run of whitespace (line breaks, tabs, non-breaking spaces) to
|
|
21
|
+
// one space and trim, so markup that wraps a line does not change the text a
|
|
22
|
+
// visitor reads.
|
|
23
|
+
function normalizeText(value) {
|
|
24
|
+
return String(value || '').replace(/\s+/g, ' ').trim();
|
|
25
|
+
}
|
|
26
|
+
|
|
20
27
|
// Poll fn() until it returns truthy, or timeout. fn() returns a value;
|
|
21
28
|
// `predicate` decides pass/fail. Returns the last value seen.
|
|
22
29
|
async function poll(fn, predicate, timeout, message) {
|
|
@@ -184,7 +191,10 @@ Then(/^"([^"]*)" should have text "([^"]*)"(?: within (\d+) seconds?)?$/, async
|
|
|
184
191
|
});
|
|
185
192
|
|
|
186
193
|
/**
|
|
187
|
-
* Assert an element's textContent contains an expected substring.
|
|
194
|
+
* Assert an element's textContent contains an expected substring. Runs of
|
|
195
|
+
* whitespace are collapsed to one space and trimmed on both sides first, so
|
|
196
|
+
* markup that wraps a line still matches. Use `should have text` for the
|
|
197
|
+
* exact match.
|
|
188
198
|
*
|
|
189
199
|
* Example #1: Then "h1" should contain text "Welcome"
|
|
190
200
|
* Example #2: Then ".badge" should contain text "unread" within 3 seconds
|
|
@@ -195,9 +205,10 @@ Then(/^"([^"]*)" should have text "([^"]*)"(?: within (\d+) seconds?)?$/, async
|
|
|
195
205
|
*/
|
|
196
206
|
Then(/^"([^"]*)" should contain text "([^"]*)"(?: within (\d+) seconds?)?$/, async function (selector, text, sec) {
|
|
197
207
|
const loc = this.page.locator(selector).first();
|
|
208
|
+
const expected = normalizeText(text);
|
|
198
209
|
await poll(
|
|
199
|
-
() => loc.textContent(),
|
|
200
|
-
(v) =>
|
|
210
|
+
async () => normalizeText(await loc.textContent()),
|
|
211
|
+
(v) => v.includes(expected),
|
|
201
212
|
parseTimeout(sec),
|
|
202
213
|
`Expected "${selector}" to contain text "${text}"`
|
|
203
214
|
);
|
|
@@ -69,10 +69,27 @@ if (process.env.WEBSHIP_FILTER_HOOK_LINES !== 'off') {
|
|
|
69
69
|
// late-firing setTimeout that mutates the DOM re-arms the wait correctly.
|
|
70
70
|
// ---------------------------------------------------------------------------
|
|
71
71
|
|
|
72
|
+
/**
|
|
73
|
+
* Smallest timeout worth handing to Playwright. Playwright reads `timeout: 0`
|
|
74
|
+
* as "no timeout at all", so a spent budget must never reach it as a zero —
|
|
75
|
+
* that is how a settle could wait forever instead of giving up.
|
|
76
|
+
*
|
|
77
|
+
* @type {number}
|
|
78
|
+
*/
|
|
79
|
+
const SETTLE_MIN_MS = 25;
|
|
80
|
+
|
|
72
81
|
/**
|
|
73
82
|
* Wait for the page to reach an "edge" of activity — DOM ready, network
|
|
74
83
|
* idle, no pending AJAX or timers, and no DOM mutations for ≥250 ms.
|
|
75
84
|
*
|
|
85
|
+
* Each stage gets a share of the budget rather than "whatever is left", so a
|
|
86
|
+
* stage that can never resolve cannot starve the ones after it. On a page with
|
|
87
|
+
* analytics, a chat widget or a self-rescheduling timer, `networkidle` never
|
|
88
|
+
* arrives; capping it at half the budget keeps the AJAX / pending-timer /
|
|
89
|
+
* DOM-quiet probe — the useful one — running.
|
|
90
|
+
*
|
|
91
|
+
* Returns within `timeout` ms even when nothing on the page ever settles.
|
|
92
|
+
*
|
|
76
93
|
* @param {import('playwright').Page} page - Page being probed.
|
|
77
94
|
* @param {number} [timeout=10000] - Total budget in ms.
|
|
78
95
|
* @returns {Promise<void>}
|
|
@@ -80,26 +97,38 @@ if (process.env.WEBSHIP_FILTER_HOOK_LINES !== 'off') {
|
|
|
80
97
|
async function smartSettle(page, timeout) {
|
|
81
98
|
const total = typeof timeout === 'number' && timeout > 0 ? timeout : 10000;
|
|
82
99
|
const deadline = Date.now() + total;
|
|
83
|
-
const remaining = () => Math.max(0, deadline - Date.now());
|
|
84
100
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
101
|
+
// Milliseconds left in the budget. Never handed to Playwright directly: a
|
|
102
|
+
// zero there means "no timeout", not "return immediately".
|
|
103
|
+
const left = () => deadline - Date.now();
|
|
104
|
+
|
|
105
|
+
// Run one stage with at most `share` of the original budget, and never more
|
|
106
|
+
// than what is actually left. Returns false once the budget is spent, so the
|
|
107
|
+
// caller stops instead of calling Playwright with a useless timeout.
|
|
108
|
+
const stage = async (share, fn) => {
|
|
109
|
+
const remaining = left();
|
|
110
|
+
if (remaining < SETTLE_MIN_MS) return false;
|
|
111
|
+
const budget = Math.max(SETTLE_MIN_MS, Math.min(remaining, Math.round(total * share)));
|
|
112
|
+
try { await fn(budget); } catch { /* a stage timing out is not a failure */ }
|
|
113
|
+
return left() >= SETTLE_MIN_MS;
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
if (!await stage(0.25, (t) => page.waitForSelector('body', { state: 'attached', timeout: t }))) return;
|
|
117
|
+
if (!await stage(0.25, (t) => page.waitForLoadState('domcontentloaded', { timeout: t }))) return;
|
|
118
|
+
if (!await stage(0.5, (t) => page.waitForLoadState('networkidle', { timeout: t }))) return;
|
|
119
|
+
await stage(0.5, (t) => page.waitForFunction(
|
|
120
|
+
(quietMs) => {
|
|
121
|
+
const ajax = window.__webshipAjaxCount;
|
|
122
|
+
const timers = window.__webshipPendingTimers;
|
|
123
|
+
const last = window.__webshipLastMutation;
|
|
124
|
+
if (typeof ajax === 'number' && ajax > 0) return false;
|
|
125
|
+
if (typeof timers === 'number' && timers > 0) return false;
|
|
126
|
+
if (typeof last === 'number' && Date.now() - last < quietMs) return false;
|
|
127
|
+
return true;
|
|
128
|
+
},
|
|
129
|
+
250,
|
|
130
|
+
{ timeout: t, polling: 50 }
|
|
131
|
+
));
|
|
103
132
|
}
|
|
104
133
|
|
|
105
134
|
/**
|
|
@@ -620,7 +649,15 @@ if (!global.__WEBSHIP_AUTO_REPORT__) {
|
|
|
620
649
|
// (e.g. click() with no match) reach our try/catch wrappers BEFORE cucumber
|
|
621
650
|
// trips its own timeout — otherwise testers see "function timed out" instead
|
|
622
651
|
// of the friendly Why/Hint message.
|
|
623
|
-
|
|
652
|
+
//
|
|
653
|
+
// setDefaultTimeout() runs at load time and overrides whatever `timeout` a
|
|
654
|
+
// consumer set in their own cucumber.js, so WEBSHIP_STEP_TIMEOUT is the
|
|
655
|
+
// way to raise (or lower) it from outside. 45s stays the default.
|
|
656
|
+
const STEP_TIMEOUT = (() => {
|
|
657
|
+
const raw = parseInt(process.env.WEBSHIP_STEP_TIMEOUT, 10);
|
|
658
|
+
return Number.isFinite(raw) && raw > 0 ? raw : 45 * 1000;
|
|
659
|
+
})();
|
|
660
|
+
setDefaultTimeout(STEP_TIMEOUT);
|
|
624
661
|
|
|
625
662
|
class PlaywrightWorld extends World {
|
|
626
663
|
constructor(options) {
|
|
@@ -406,6 +406,6 @@ Then('the XML should not use the namespace {string}', async function (ns) {
|
|
|
406
406
|
* Example #5: When I print last XML response
|
|
407
407
|
*
|
|
408
408
|
*/
|
|
409
|
-
When(/^(I |we )*print last XML response$/, async function () {
|
|
409
|
+
When(/^(I |we )*print last XML response$/, async function (pronounCase) {
|
|
410
410
|
console.log(this._rawResponse || '(no response)');
|
|
411
411
|
});
|
|
@@ -908,6 +908,6 @@ Then('the YAML should not use the namespace {string}', function (ns) {
|
|
|
908
908
|
* And we print last YAML response
|
|
909
909
|
*
|
|
910
910
|
*/
|
|
911
|
-
When(/^(I |we )*print last YAML response$/, async function () {
|
|
911
|
+
When(/^(I |we )*print last YAML response$/, async function (pronounCase) {
|
|
912
912
|
console.log(this._rawYamlResponse || '(no response)');
|
|
913
913
|
});
|
package/tsconfig.json
CHANGED
|
File without changes
|
package/videos/README.md
CHANGED
|
File without changes
|