webship-js 2.0.1 → 2.0.3
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/AGENTS.md +109 -0
- package/CLAUDE.md +317 -0
- package/bin/generate-reports.js +363 -0
- package/bin/init-webship.js +343 -0
- package/bin/postinstall.js +8 -74
- package/cucumber.js +66 -2
- package/docs/00-quick-start.md +102 -0
- package/docs/01-getting-started.md +102 -0
- package/docs/02-bbr-smart-waits.md +77 -0
- package/docs/03-selector-registry.md +95 -0
- package/docs/04-step-reference.md +728 -0
- package/docs/05-web-first-assertions.md +91 -0
- package/docs/06-network-and-dialogs.md +83 -0
- package/docs/07-auth-state.md +75 -0
- package/docs/08-clock-mocking.md +59 -0
- package/docs/09-api-testing.md +114 -0
- package/docs/10-accessibility.md +167 -0
- package/docs/11-debugging.md +129 -0
- package/docs/12-ai-agent-guide.md +338 -0
- package/docs/13-faq.md +236 -0
- package/docs/14-recipes-cookbook.md +255 -0
- package/docs/15-tag-conventions.md +76 -0
- package/docs/advanced-screenshots/then-i-save-fullscreen-screenshot.md +36 -0
- package/docs/advanced-screenshots/then-i-save-width-x-height-screenshot.md +34 -0
- package/docs/advanced-screenshots/when-i-save-screenshot-name-filename.md +45 -0
- package/docs/advanced-screenshots.md +52 -0
- package/docs/advanced-selectors.md +18 -0
- package/docs/api-step-definitions.md +45 -0
- package/docs/diffy-step-definitions/then-compare-diffy-env1-env2.md +30 -0
- package/docs/diffy-step-definitions/then-create-diffy-comparison-name-value.md +21 -0
- package/docs/diffy-step-definitions/then-create-diffy-comparison.md +25 -0
- package/docs/diffy-step-definitions/then-create-diffy-screenshot-environment-name.md +35 -0
- package/docs/diffy-step-definitions/then-i-take-screenshot.md +21 -0
- package/docs/diffy-step-definitions/then-i-take-screenshots-all-breakpoints.md +27 -0
- package/docs/diffy-step-definitions/then-send-screenshots-diffy-name-value.md +27 -0
- package/docs/diffy-step-definitions/then-upload-folder-url-diffy-snapshotname.md +28 -0
- package/docs/diffy-step-definitions/then-wait-diffy-comparison-complete.md +21 -0
- package/docs/diffy-step-definitions/when-i-resize-window-number.md +29 -0
- package/docs/diffy-step-definitions.md +21 -0
- package/docs/global-settings.md +244 -0
- package/docs/index.md +104 -0
- package/docs/install-webship-js/ddev-webship-js.md +52 -0
- package/docs/install-webship-js.md +35 -0
- package/docs/overview.md +41 -0
- package/docs/step-definitions/given-i-am-anonymous-user.md +67 -0
- package/docs/step-definitions/given-i-am-homepage.md +68 -0
- package/docs/step-definitions/given-i-am-specific-page.md +72 -0
- package/docs/step-definitions/then-i-should-be.md +56 -0
- package/docs/step-definitions/then-i-should-see.md +62 -0
- package/docs/step-definitions/then-item-checkbox.md +54 -0
- package/docs/step-definitions/then-item-link-should-contain-url.md +84 -0
- package/docs/step-definitions/then-item-should-contain.md +67 -0
- package/docs/step-definitions/then-radio-button-value-should-be-selected.md +68 -0
- package/docs/step-definitions/then-response-status-code-should-be-number.md +69 -0
- package/docs/step-definitions/then-value-radio-button-selected.md +62 -0
- package/docs/step-definitions/when-i-attach-file-file-name-element.md +71 -0
- package/docs/step-definitions/when-i-check-checkbox.md +60 -0
- package/docs/step-definitions/when-i-click-link.md +51 -0
- package/docs/step-definitions/when-i-click-operation-text-row.md +71 -0
- package/docs/step-definitions/when-i-fill.md +59 -0
- package/docs/step-definitions/when-i-go-homepage.md +60 -0
- package/docs/step-definitions/when-i-go-specific-page.md +67 -0
- package/docs/step-definitions/when-i-move-backward-one-page.md +49 -0
- package/docs/step-definitions/when-i-move-forward-one-page.md +58 -0
- package/docs/step-definitions/when-i-press-button.md +58 -0
- package/docs/step-definitions/when-i-reload-page.md +51 -0
- package/docs/step-definitions/when-i-scroll.md +73 -0
- package/docs/step-definitions/when-i-select-option-select-list.md +53 -0
- package/docs/step-definitions/when-i-select-radio-button-value.md +62 -0
- package/docs/step-definitions/when-i-uncheck-checkbox.md +57 -0
- package/docs/step-definitions/when-i-wait-ajax-finish.md +64 -0
- package/docs/step-definitions/when-i-wait.md +62 -0
- package/docs/step-definitions.md +50 -0
- package/examples/a11y.html +31 -0
- package/examples/cookies.html +10 -0
- package/examples/date.html +12 -0
- package/examples/diffy/baseline.html +54 -0
- package/examples/diffy/changed.html +63 -0
- package/examples/diffy/index.html +52 -0
- package/examples/element.html +11 -0
- package/examples/field.html +24 -0
- package/examples/index.html +6 -0
- package/examples/keyboard.html +11 -0
- package/examples/links.html +9 -0
- package/examples/modal.html +14 -0
- package/examples/path.html +3 -0
- package/examples/table.html +13 -0
- package/examples/test--when--i-additionally-select.html +27 -0
- package/package.json +19 -6
- package/playwright.config.ts +3 -2
- package/tests/features/a11y.feature +39 -0
- package/tests/features/cookie.feature +13 -0
- package/tests/features/date.feature +11 -0
- package/tests/features/diffy/test--diffy-01-example-demo.feature +22 -0
- package/tests/features/diffy/test--diffy-02-all-steps.feature +52 -0
- package/tests/features/diffy/test--diffy-03-real-api.feature +21 -0
- package/tests/features/element.feature +16 -0
- package/tests/features/field.feature +25 -0
- package/tests/features/keyboard.feature +10 -0
- package/tests/features/link.feature +11 -0
- package/tests/features/modal-advanced-example.feature +1 -1
- package/tests/features/modal.feature +11 -0
- package/tests/features/path.feature +16 -0
- package/tests/features/response.feature +8 -0
- package/tests/features/responsive.feature +10 -0
- package/tests/features/table.feature +18 -0
- package/tests/features/test--then--i-save-screenshot.feature +33 -0
- package/tests/features/test--then--i-see-locator.feature +320 -0
- package/tests/features/test--then--i-should-see-n-elements.feature +24 -0
- package/tests/features/test--then--print-current-url-and-response.feature +21 -0
- package/tests/features/test--when--i-additionally-select.feature +30 -0
- package/tests/features/test--when--i-follow.feature +22 -0
- package/tests/features/wait.feature +7 -0
- package/tests/features/yaml.feature +102 -0
- package/tests/reports/README.md +55 -0
- package/tests/selectors/_canonical-keys.json +113 -0
- package/tests/selectors/back-end-selectors.json +19 -0
- package/tests/selectors/cms-contentful-admin.json +35 -0
- package/tests/selectors/cms-craft-admin.json +39 -0
- package/tests/selectors/cms-drupal-cms-gin.json +56 -0
- package/tests/selectors/cms-drupal-core-claro.json +50 -0
- package/tests/selectors/cms-generic-admin.json +34 -0
- package/tests/selectors/cms-ghost-admin.json +34 -0
- package/tests/selectors/cms-joomla-admin.json +41 -0
- package/tests/selectors/cms-magento2-admin.json +32 -0
- package/tests/selectors/cms-prestashop-admin.json +38 -0
- package/tests/selectors/cms-shopify-admin.json +25 -0
- package/tests/selectors/cms-strapi-admin.json +42 -0
- package/tests/selectors/cms-typo3-admin.json +41 -0
- package/tests/selectors/cms-woocommerce-front.json +50 -0
- package/tests/selectors/cms-wordpress-admin.json +31 -0
- package/tests/selectors/framework-ant-design.json +80 -0
- package/tests/selectors/framework-bootstrap.json +86 -0
- package/tests/selectors/framework-bulma.json +74 -0
- package/tests/selectors/framework-chakra.json +58 -0
- package/tests/selectors/framework-foundation.json +51 -0
- package/tests/selectors/framework-material-ui.json +72 -0
- package/tests/selectors/framework-shadcn.json +51 -0
- package/tests/selectors/framework-tailwind.json +40 -0
- package/tests/selectors/framework-vuetify.json +61 -0
- package/tests/selectors/front-end-selectors.json +16 -0
- package/tests/selectors/homepage-selectors.json +13 -0
- package/tests/step-definitions/a11y.steps.js +798 -0
- package/tests/step-definitions/action.steps.js +167 -0
- package/tests/step-definitions/{webship-api.js → api.steps.js} +254 -44
- package/tests/step-definitions/assertion.steps.js +352 -0
- package/tests/step-definitions/auth.steps.js +124 -0
- package/tests/step-definitions/clock.steps.js +128 -0
- package/tests/step-definitions/cookie.steps.js +216 -0
- package/tests/step-definitions/debug.steps.js +31 -0
- package/tests/step-definitions/dialog.steps.js +193 -0
- package/tests/step-definitions/element.steps.js +314 -0
- package/tests/step-definitions/field.steps.js +653 -0
- package/tests/step-definitions/file-download.steps.js +193 -0
- package/tests/step-definitions/form.steps.js +333 -0
- package/tests/step-definitions/iframe.steps.js +178 -0
- package/tests/step-definitions/input.steps.js +163 -0
- package/tests/step-definitions/javascript.steps.js +71 -0
- package/tests/step-definitions/keyboard.steps.js +78 -0
- package/tests/step-definitions/link.steps.js +142 -0
- package/tests/step-definitions/metatag.steps.js +91 -0
- package/tests/step-definitions/modal.steps.js +219 -0
- package/tests/step-definitions/navigation.steps.js +218 -0
- package/tests/step-definitions/network.steps.js +238 -0
- package/tests/step-definitions/path.steps.js +141 -0
- package/tests/step-definitions/response.steps.js +98 -0
- package/tests/step-definitions/responsive.steps.js +123 -0
- package/tests/step-definitions/rest.steps.js +111 -0
- package/tests/step-definitions/screenshot.steps.js +423 -0
- package/tests/step-definitions/scroll.steps.js +189 -0
- package/tests/step-definitions/selectors.steps.js +996 -0
- package/tests/step-definitions/storage.steps.js +194 -0
- package/tests/step-definitions/table.steps.js +181 -0
- package/tests/step-definitions/wait.steps.js +400 -0
- package/tests/step-definitions/web-first.steps.js +296 -0
- package/tests/step-definitions/webship.js +567 -923
- package/tests/step-definitions/xml.steps.js +409 -0
- package/tests/step-definitions/yaml.steps.js +911 -0
- package/tests/step-definitions-diffy/README.md +329 -0
- package/tests/step-definitions-diffy/mock-diffy-api/server.js +84 -0
- package/tests/step-definitions-diffy/webship-diffy-mock.js +31 -0
- package/tests/step-definitions-diffy/webship-diffy.js +459 -0
- package/tsconfig.json +19 -3
- package/generate-reports.js +0 -22
- package/required/cucumber.js +0 -37
- package/required/generate-reports.js +0 -22
- package/required/package.json +0 -18
- package/required/playwright.config.ts +0 -37
- package/required/tests/features/README.md +0 -1
- package/required/tests/features/check-homepage.feature +0 -8
- package/required/tests/reports/README.md +0 -1
- package/required/tests/step-definitions/README.md +0 -1
- package/required/tests/step-definitions/custom.js +0 -4
- package/required/tsconfig.json +0 -12
|
@@ -0,0 +1,459 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// ---------------------------------------------------------------------------
|
|
4
|
+
// Webship-JS — Diffy visual-regression step definitions
|
|
5
|
+
//
|
|
6
|
+
// Talks directly to Diffy REST API (https://app.diffy.website/api/).
|
|
7
|
+
//
|
|
8
|
+
// Configuration: resolved per-scenario with this priority:
|
|
9
|
+
// 1. process.env.DIFFY_* (CI / shell — highest)
|
|
10
|
+
// 2. cucumber.js worldParameters.diffy.* (project-level defaults)
|
|
11
|
+
// 3. built-in defaults
|
|
12
|
+
//
|
|
13
|
+
// Supported env vars / worldParameters keys:
|
|
14
|
+
// DIFFY_API_KEY apiKey — https://app.diffy.website/#/keys
|
|
15
|
+
// DIFFY_PROJECT_ID projectId — Diffy project id
|
|
16
|
+
// DIFFY_BREAKPOINTS breakpoints — comma list, e.g. "640,1200"
|
|
17
|
+
// DIFFY_WINDOW_HEIGHT windowHeight — default 2000
|
|
18
|
+
// DIFFY_SCREENSHOTS_DIR screenshotsDir — on-disk copy of screenshots
|
|
19
|
+
// DIFFY_API_BASE_URL baseUrl — default app.diffy.website
|
|
20
|
+
// DIFFY_MAX_WAIT maxWait — diff polling timeout (s), default 1200
|
|
21
|
+
// DIFFY_ENV1_URL env1Url — custom URL for "compare diffy"
|
|
22
|
+
// DIFFY_ENV2_URL env2Url — custom URL for "compare diffy"
|
|
23
|
+
// ---------------------------------------------------------------------------
|
|
24
|
+
|
|
25
|
+
const { Given, When, Then, Before } = require('@cucumber/cucumber');
|
|
26
|
+
const axios = require('axios');
|
|
27
|
+
const fs = require('fs');
|
|
28
|
+
const path = require('path');
|
|
29
|
+
|
|
30
|
+
const WINDOW_PADDING = 8;
|
|
31
|
+
|
|
32
|
+
function pick(envVal, paramVal, fallback) {
|
|
33
|
+
if (envVal !== undefined && envVal !== '') return envVal;
|
|
34
|
+
if (paramVal !== undefined && paramVal !== '' && paramVal !== null) return paramVal;
|
|
35
|
+
return fallback;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function resolveConfig(parameters) {
|
|
39
|
+
const p = (parameters && parameters.diffy) || {};
|
|
40
|
+
const breakpointsRaw = pick(process.env.DIFFY_BREAKPOINTS, p.breakpoints, '1200');
|
|
41
|
+
return {
|
|
42
|
+
apiKey: pick(process.env.DIFFY_API_KEY, p.apiKey, ''),
|
|
43
|
+
projectId: parseInt(pick(process.env.DIFFY_PROJECT_ID, p.projectId, '0'), 10),
|
|
44
|
+
breakpoints: String(breakpointsRaw)
|
|
45
|
+
.split(',')
|
|
46
|
+
.map(s => parseInt(String(s).trim(), 10))
|
|
47
|
+
.filter(n => !Number.isNaN(n)),
|
|
48
|
+
windowHeight: parseInt(pick(process.env.DIFFY_WINDOW_HEIGHT, p.windowHeight, '2000'), 10),
|
|
49
|
+
screenshotsDir: pick(process.env.DIFFY_SCREENSHOTS_DIR, p.screenshotsDir, ''),
|
|
50
|
+
baseUrl: pick(process.env.DIFFY_API_BASE_URL, p.baseUrl, 'https://app.diffy.website/api/'),
|
|
51
|
+
maxWait: parseInt(pick(process.env.DIFFY_MAX_WAIT, p.maxWait, '1200'), 10),
|
|
52
|
+
env1Url: pick(process.env.DIFFY_ENV1_URL, p.env1Url, ''),
|
|
53
|
+
env2Url: pick(process.env.DIFFY_ENV2_URL, p.env2Url, ''),
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
let diffyToken = null;
|
|
58
|
+
|
|
59
|
+
async function refreshToken(cfg) {
|
|
60
|
+
if (!cfg.apiKey) {
|
|
61
|
+
throw new Error('Diffy API key missing. Set DIFFY_API_KEY env or worldParameters.diffy.apiKey.');
|
|
62
|
+
}
|
|
63
|
+
const res = await axios.post(
|
|
64
|
+
cfg.baseUrl + 'auth/key',
|
|
65
|
+
{ key: cfg.apiKey },
|
|
66
|
+
{ headers: { Accept: 'application/json', 'Content-Type': 'application/json' } }
|
|
67
|
+
);
|
|
68
|
+
if (!res.data || !res.data.token) {
|
|
69
|
+
throw new Error('Diffy auth/key did not return a token.');
|
|
70
|
+
}
|
|
71
|
+
diffyToken = res.data.token;
|
|
72
|
+
return diffyToken;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
async function diffyRequest(cfg, method, uri, opts = {}) {
|
|
76
|
+
if (!diffyToken) await refreshToken(cfg);
|
|
77
|
+
const headers = Object.assign(
|
|
78
|
+
{ Authorization: 'Bearer ' + diffyToken },
|
|
79
|
+
opts.headers || {}
|
|
80
|
+
);
|
|
81
|
+
const reqCfg = { method, url: cfg.baseUrl + uri, headers };
|
|
82
|
+
if (opts.json !== undefined) {
|
|
83
|
+
reqCfg.data = opts.json;
|
|
84
|
+
headers['Content-Type'] = 'application/json';
|
|
85
|
+
headers['Accept'] = 'application/json';
|
|
86
|
+
}
|
|
87
|
+
if (opts.form !== undefined) {
|
|
88
|
+
reqCfg.data = opts.form;
|
|
89
|
+
headers['Accept'] = 'application/json';
|
|
90
|
+
}
|
|
91
|
+
let res;
|
|
92
|
+
try {
|
|
93
|
+
res = await axios.request(reqCfg);
|
|
94
|
+
} catch (e) {
|
|
95
|
+
const body = e.response && e.response.data;
|
|
96
|
+
const bodyStr = typeof body === 'string' ? body : JSON.stringify(body);
|
|
97
|
+
const err = new Error(`Diffy API ${method} ${uri} failed: ${e.response?.status} ${bodyStr || e.message}`);
|
|
98
|
+
err.cause = e;
|
|
99
|
+
throw err;
|
|
100
|
+
}
|
|
101
|
+
return res.data;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
function ensureProjectId(cfg) {
|
|
105
|
+
if (!cfg.projectId) {
|
|
106
|
+
throw new Error('Diffy projectId missing. Set DIFFY_PROJECT_ID env or worldParameters.diffy.projectId.');
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
function currentPath(page, launchUrl) {
|
|
111
|
+
try {
|
|
112
|
+
const current = page.url();
|
|
113
|
+
if (launchUrl && current.startsWith(launchUrl)) {
|
|
114
|
+
return current.slice(launchUrl.length) || '/';
|
|
115
|
+
}
|
|
116
|
+
const u = new URL(current);
|
|
117
|
+
return u.pathname + u.search;
|
|
118
|
+
} catch {
|
|
119
|
+
return '/';
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
async function takeOneScreenshot(world) {
|
|
124
|
+
const cfg = world.diffyConfig;
|
|
125
|
+
const page = world.page;
|
|
126
|
+
const viewport = page.viewportSize() || { width: cfg.breakpoints[0] || 1200 };
|
|
127
|
+
const breakpoint = viewport.width - WINDOW_PADDING;
|
|
128
|
+
const buffer = await page.screenshot({ fullPage: true });
|
|
129
|
+
const url = currentPath(page, world.launchUrl);
|
|
130
|
+
|
|
131
|
+
if (cfg.screenshotsDir) {
|
|
132
|
+
if (!fs.existsSync(cfg.screenshotsDir)) {
|
|
133
|
+
fs.mkdirSync(cfg.screenshotsDir, { recursive: true });
|
|
134
|
+
}
|
|
135
|
+
const safe = encodeURIComponent(url);
|
|
136
|
+
const filename = `${Date.now()}__${safe}__${breakpoint}.png`;
|
|
137
|
+
fs.writeFileSync(path.join(cfg.screenshotsDir, filename), buffer);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
world.diffyScreenshots = world.diffyScreenshots || [];
|
|
141
|
+
world.diffyScreenshots.push({ buffer, url, breakpoint });
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
Before(async function () {
|
|
145
|
+
this.diffyConfig = resolveConfig(this.parameters);
|
|
146
|
+
this.diffyScreenshots = [];
|
|
147
|
+
this.diffyCreatedScreenshotIds = this.diffyCreatedScreenshotIds || [];
|
|
148
|
+
this.diffyCreatedDiffIds = this.diffyCreatedDiffIds || [];
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* Resize browser viewport to a breakpoint width (plus Diffy window padding).
|
|
153
|
+
*
|
|
154
|
+
* Example #1: When I resize window to "1200"
|
|
155
|
+
* Example #2: When we resize window to "640"
|
|
156
|
+
* Example #3: When I resize window to "320"
|
|
157
|
+
* Example #4: When we resize window to "768"
|
|
158
|
+
* Example #5: When I resize window to "1024"
|
|
159
|
+
* Example #6: When we resize window to "1440"
|
|
160
|
+
* Example #7: When I resize window to "1920"
|
|
161
|
+
* Example #8: When we resize window to "375"
|
|
162
|
+
*
|
|
163
|
+
*/
|
|
164
|
+
When(/^(?:I |we )?resize window to "([^"]*)"$/, async function (breakpoint) {
|
|
165
|
+
const cfg = this.diffyConfig;
|
|
166
|
+
const width = parseInt(breakpoint, 10) + WINDOW_PADDING;
|
|
167
|
+
await this.page.setViewportSize({ width, height: cfg.windowHeight });
|
|
168
|
+
});
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* Capture a full-page screenshot at current viewport.
|
|
172
|
+
* Held in-memory (and optionally written to DIFFY_SCREENSHOTS_DIR) until
|
|
173
|
+
* "send screenshots to diffy with name" uploads the batch.
|
|
174
|
+
*
|
|
175
|
+
* Example #1: Then I take screenshot
|
|
176
|
+
* Example #2: Then we take screenshot
|
|
177
|
+
* Example #3: And I take screenshot
|
|
178
|
+
* Example #4: And we take screenshot
|
|
179
|
+
* Example #5: But I take screenshot
|
|
180
|
+
* Example #6: Then take screenshot
|
|
181
|
+
* Example #7: And take screenshot
|
|
182
|
+
*
|
|
183
|
+
*/
|
|
184
|
+
Then(/^(?:I |we )?take screenshot$/, async function () {
|
|
185
|
+
await takeOneScreenshot(this);
|
|
186
|
+
});
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* Resize to each configured breakpoint and capture a screenshot per breakpoint.
|
|
190
|
+
* Breakpoints come from DIFFY_BREAKPOINTS env or worldParameters.diffy.breakpoints.
|
|
191
|
+
*
|
|
192
|
+
* Example #1: Then I take screenshots for all breakpoints
|
|
193
|
+
* Example #2: Then we take screenshots for all breakpoints
|
|
194
|
+
* Example #3: And I take screenshots for all breakpoints
|
|
195
|
+
* Example #4: And we take screenshots for all breakpoints
|
|
196
|
+
* Example #5: Then take screenshots for all breakpoints
|
|
197
|
+
* Example #6: And take screenshots for all breakpoints
|
|
198
|
+
*
|
|
199
|
+
*/
|
|
200
|
+
Then(/^(?:I |we )?take screenshots for all breakpoints$/, async function () {
|
|
201
|
+
const cfg = this.diffyConfig;
|
|
202
|
+
if (!cfg.breakpoints.length) {
|
|
203
|
+
throw new Error('Diffy breakpoints empty. Set DIFFY_BREAKPOINTS or worldParameters.diffy.breakpoints.');
|
|
204
|
+
}
|
|
205
|
+
for (const bp of cfg.breakpoints) {
|
|
206
|
+
await this.page.setViewportSize({
|
|
207
|
+
width: bp + WINDOW_PADDING,
|
|
208
|
+
height: cfg.windowHeight,
|
|
209
|
+
});
|
|
210
|
+
await takeOneScreenshot(this);
|
|
211
|
+
}
|
|
212
|
+
});
|
|
213
|
+
|
|
214
|
+
/**
|
|
215
|
+
* Upload all captured screenshots to Diffy as a named custom snapshot.
|
|
216
|
+
* Clears in-memory buffer + on-disk screenshotsDir on success.
|
|
217
|
+
*
|
|
218
|
+
* Example #1: Then send screenshots to diffy with name "baseline"
|
|
219
|
+
* Example #2: Then send screenshots to diffy with name "changed"
|
|
220
|
+
* Example #3: Then send screenshots to diffy with name "homepage-release-2.0"
|
|
221
|
+
* Example #4: Then send screenshots to diffy with name "after-deploy"
|
|
222
|
+
* Example #5: Then send screenshots to diffy with name "smoke-run"
|
|
223
|
+
* Example #6: Then send screenshots to diffy with name "webship.co-prod"
|
|
224
|
+
*
|
|
225
|
+
*/
|
|
226
|
+
Then(/^(I |we )*send screenshots to diffy with name "([^"]*)"$/, async function (pronounCase, snapshotName) {
|
|
227
|
+
const cfg = this.diffyConfig;
|
|
228
|
+
ensureProjectId(cfg);
|
|
229
|
+
const shots = this.diffyScreenshots || [];
|
|
230
|
+
if (!shots.length) {
|
|
231
|
+
throw new Error('No screenshots captured. Call "I take screenshot(s)" first.');
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
const form = new FormData();
|
|
235
|
+
form.append('snapshotName', snapshotName);
|
|
236
|
+
shots.forEach((s, i) => {
|
|
237
|
+
form.append(`files[${i}]`, new Blob([s.buffer], { type: 'image/png' }), `screenshot-${i}.png`);
|
|
238
|
+
form.append(`urls[${i}]`, s.url);
|
|
239
|
+
form.append(`breakpoints[${i}]`, String(s.breakpoint));
|
|
240
|
+
});
|
|
241
|
+
|
|
242
|
+
const data = await diffyRequest(
|
|
243
|
+
cfg,
|
|
244
|
+
'POST',
|
|
245
|
+
`projects/${cfg.projectId}/create-custom-snapshot`,
|
|
246
|
+
{ form }
|
|
247
|
+
);
|
|
248
|
+
|
|
249
|
+
const screenshotId = typeof data === 'object' ? (data.id || data.snapshotId || data) : data;
|
|
250
|
+
this.diffyCreatedScreenshotIds.push(screenshotId);
|
|
251
|
+
|
|
252
|
+
if (cfg.screenshotsDir && fs.existsSync(cfg.screenshotsDir)) {
|
|
253
|
+
for (const f of fs.readdirSync(cfg.screenshotsDir)) {
|
|
254
|
+
if (f.endsWith('.png')) fs.unlinkSync(path.join(cfg.screenshotsDir, f));
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
this.diffyScreenshots = [];
|
|
258
|
+
});
|
|
259
|
+
|
|
260
|
+
/**
|
|
261
|
+
* Create a Diffy comparison (Diff) from the last two uploaded snapshots.
|
|
262
|
+
*
|
|
263
|
+
* Example #1: Then create diffy comparison
|
|
264
|
+
* Example #2: And create diffy comparison
|
|
265
|
+
* Example #3: Then I create diffy comparison
|
|
266
|
+
* Example #4: Then we create diffy comparison
|
|
267
|
+
* Example #5: And I create diffy comparison
|
|
268
|
+
* Example #6: And we create diffy comparison
|
|
269
|
+
* Example #7: But I create diffy comparison
|
|
270
|
+
*
|
|
271
|
+
*/
|
|
272
|
+
Then(/^(I |we )*create diffy comparison$/, async function (pronounCase) {
|
|
273
|
+
const cfg = this.diffyConfig;
|
|
274
|
+
ensureProjectId(cfg);
|
|
275
|
+
const ids = this.diffyCreatedScreenshotIds || [];
|
|
276
|
+
if (ids.length < 2) {
|
|
277
|
+
throw new Error('Need at least two uploaded snapshots before creating a Diff.');
|
|
278
|
+
}
|
|
279
|
+
const data = await diffyRequest(cfg, 'POST', `projects/${cfg.projectId}/diffs`, {
|
|
280
|
+
json: { snapshot1: ids[0], snapshot2: ids[1], name: '' },
|
|
281
|
+
});
|
|
282
|
+
const diffId = typeof data === 'object' ? (data.id || data.diffId || data) : data;
|
|
283
|
+
this.diffyCreatedDiffIds.push(diffId);
|
|
284
|
+
});
|
|
285
|
+
|
|
286
|
+
/**
|
|
287
|
+
* Create a named Diffy comparison from the last two uploaded snapshots.
|
|
288
|
+
*
|
|
289
|
+
* Example #1: Then create diffy comparison with name "release-2.0"
|
|
290
|
+
* Example #2: Then create diffy comparison with name "nightly"
|
|
291
|
+
* Example #3: Then create diffy comparison with name "smoke-run-42"
|
|
292
|
+
* Example #4: Then create diffy comparison with name "webship.co-regression"
|
|
293
|
+
* Example #5: Then create diffy comparison with name "before-vs-after"
|
|
294
|
+
* Example #6: Then create diffy comparison with name "homepage-baseline-vs-changed"
|
|
295
|
+
*
|
|
296
|
+
*/
|
|
297
|
+
Then(/^(I |we )*create diffy comparison with name "([^"]*)"$/, async function (pronounCase, name) {
|
|
298
|
+
const cfg = this.diffyConfig;
|
|
299
|
+
ensureProjectId(cfg);
|
|
300
|
+
const ids = this.diffyCreatedScreenshotIds || [];
|
|
301
|
+
if (ids.length < 2) {
|
|
302
|
+
throw new Error('Need at least two uploaded snapshots before creating a Diff.');
|
|
303
|
+
}
|
|
304
|
+
const data = await diffyRequest(cfg, 'POST', `projects/${cfg.projectId}/diffs`, {
|
|
305
|
+
json: { snapshot1: ids[0], snapshot2: ids[1], name },
|
|
306
|
+
});
|
|
307
|
+
const diffId = typeof data === 'object' ? (data.id || data.diffId || data) : data;
|
|
308
|
+
this.diffyCreatedDiffIds.push(diffId);
|
|
309
|
+
});
|
|
310
|
+
|
|
311
|
+
/**
|
|
312
|
+
* Ask Diffy to capture a snapshot remotely from a named environment on the project.
|
|
313
|
+
* Accepts short (prod/stage/dev) or long (production/staging/development) forms, plus "custom".
|
|
314
|
+
*
|
|
315
|
+
* Example #1: Then create diffy screenshot from "production" environment
|
|
316
|
+
* Example #2: Then create diffy screenshot from "prod" environment
|
|
317
|
+
* Example #3: Then create diffy screenshot from "staging" environment
|
|
318
|
+
* Example #4: Then create diffy screenshot from "stage" environment
|
|
319
|
+
* Example #5: Then create diffy screenshot from "development" environment
|
|
320
|
+
* Example #6: Then create diffy screenshot from "dev" environment
|
|
321
|
+
* Example #7: Then create diffy screenshot from "custom" environment
|
|
322
|
+
*
|
|
323
|
+
*/
|
|
324
|
+
Then(/^(I |we )*create diffy screenshot from "([^"]*)" environment$/, async function (pronounCase, environment) {
|
|
325
|
+
const cfg = this.diffyConfig;
|
|
326
|
+
ensureProjectId(cfg);
|
|
327
|
+
const map = { prod: 'production', stage: 'staging', dev: 'development' };
|
|
328
|
+
const env = map[environment] || environment;
|
|
329
|
+
const allowed = ['production', 'staging', 'development', 'custom'];
|
|
330
|
+
if (!allowed.includes(env)) {
|
|
331
|
+
throw new Error(`Invalid Diffy environment "${environment}". Expected one of ${allowed.join(', ')}.`);
|
|
332
|
+
}
|
|
333
|
+
const data = await diffyRequest(
|
|
334
|
+
cfg,
|
|
335
|
+
'POST',
|
|
336
|
+
`projects/${cfg.projectId}/screenshots`,
|
|
337
|
+
{ json: { environment: env } }
|
|
338
|
+
);
|
|
339
|
+
const screenshotId = typeof data === 'object' ? (data.id || data.snapshotId || data) : data;
|
|
340
|
+
this.diffyCreatedScreenshotIds.push(screenshotId);
|
|
341
|
+
});
|
|
342
|
+
|
|
343
|
+
/**
|
|
344
|
+
* Kick off a Diffy comparison between two project environments.
|
|
345
|
+
* Uses DIFFY_ENV1_URL / DIFFY_ENV2_URL when either side is "custom".
|
|
346
|
+
*
|
|
347
|
+
* Example #1: Then compare diffy "prod" with "stage"
|
|
348
|
+
* Example #2: Then compare diffy "production" with "staging"
|
|
349
|
+
* Example #3: Then compare diffy "prod" with "dev"
|
|
350
|
+
* Example #4: Then compare diffy "stage" with "dev"
|
|
351
|
+
* Example #5: Then compare diffy "prod" with "baseline"
|
|
352
|
+
* Example #6: Then compare diffy "baseline" with "custom"
|
|
353
|
+
* Example #7: Then compare diffy "custom" with "custom"
|
|
354
|
+
* Example #8: Then compare diffy "production" with "development"
|
|
355
|
+
*
|
|
356
|
+
*/
|
|
357
|
+
Then(/^(I |we )*compare diffy "([^"]*)" with "([^"]*)"$/, async function (pronounCase, env1, env2) {
|
|
358
|
+
const cfg = this.diffyConfig;
|
|
359
|
+
ensureProjectId(cfg);
|
|
360
|
+
const toShort = { production: 'prod', staging: 'stage', development: 'dev' };
|
|
361
|
+
const e1 = toShort[env1] || env1;
|
|
362
|
+
const e2 = toShort[env2] || env2;
|
|
363
|
+
const allowed = ['prod', 'stage', 'dev', 'baseline', 'custom'];
|
|
364
|
+
if (!allowed.includes(e1) || !allowed.includes(e2)) {
|
|
365
|
+
throw new Error(`Invalid env. Allowed: ${allowed.join(', ')}.`);
|
|
366
|
+
}
|
|
367
|
+
const args = { env1: e1, env2: e2 };
|
|
368
|
+
if (e1 === 'custom') args.env1Url = cfg.env1Url;
|
|
369
|
+
if (e2 === 'custom') args.env2Url = cfg.env2Url;
|
|
370
|
+
const data = await diffyRequest(cfg, 'POST', `projects/${cfg.projectId}/compare`, { json: args });
|
|
371
|
+
const diffId = typeof data === 'object' ? (data.id || data.diffId || data) : data;
|
|
372
|
+
this.diffyCreatedDiffIds.push(diffId);
|
|
373
|
+
});
|
|
374
|
+
|
|
375
|
+
/**
|
|
376
|
+
* Upload every PNG/WebP under a local folder as a named Diffy custom snapshot.
|
|
377
|
+
* Breakpoint is read from the PNG width; URL slug is derived from file name.
|
|
378
|
+
*
|
|
379
|
+
* Example #1: Then upload folder "./screenshots/baseline" to diffy as "baseline"
|
|
380
|
+
* Example #2: Then upload folder "./screenshots/changed" to diffy as "changed"
|
|
381
|
+
* Example #3: Then upload folder "./reports/screenshots" to diffy as "nightly"
|
|
382
|
+
* Example #4: Then upload folder "/tmp/webship-shots" to diffy as "webship.co-snapshot"
|
|
383
|
+
* Example #5: Then upload folder "./out/homepage" to diffy as "homepage-release-2.0"
|
|
384
|
+
* Example #6: Then upload folder "./diffy/before" to diffy as "before-deploy"
|
|
385
|
+
*
|
|
386
|
+
*/
|
|
387
|
+
Then(/^(I |we )*upload folder "([^"]*)" to diffy as "([^"]*)"$/, async function (pronounCase, folderPath, snapshotName) {
|
|
388
|
+
const cfg = this.diffyConfig;
|
|
389
|
+
ensureProjectId(cfg);
|
|
390
|
+
if (!fs.existsSync(folderPath) || !fs.statSync(folderPath).isDirectory()) {
|
|
391
|
+
throw new Error(`Folder not found: ${folderPath}`);
|
|
392
|
+
}
|
|
393
|
+
const files = [];
|
|
394
|
+
(function walk(dir) {
|
|
395
|
+
for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {
|
|
396
|
+
const full = path.join(dir, entry.name);
|
|
397
|
+
if (entry.isDirectory()) walk(full);
|
|
398
|
+
else if (/\.(png|webp)$/i.test(entry.name)) files.push(full);
|
|
399
|
+
}
|
|
400
|
+
})(folderPath);
|
|
401
|
+
if (!files.length) throw new Error(`No PNG/WebP images in ${folderPath}.`);
|
|
402
|
+
files.sort();
|
|
403
|
+
|
|
404
|
+
const form = new FormData();
|
|
405
|
+
form.append('snapshotName', snapshotName);
|
|
406
|
+
form.append('functionalTest', '1');
|
|
407
|
+
files.forEach((filepath, i) => {
|
|
408
|
+
const buffer = fs.readFileSync(filepath);
|
|
409
|
+
const rel = path.relative(folderPath, filepath).replace(/[\\/]/g, '-');
|
|
410
|
+
const slug = '/' + path.parse(rel).name.toLowerCase().replace(/[^a-z0-9]+/g, '-');
|
|
411
|
+
const width = detectPngWidth(buffer);
|
|
412
|
+
if (!width) throw new Error(`Cannot read width: ${filepath}`);
|
|
413
|
+
form.append(`files[${i}]`, new Blob([buffer], { type: 'image/png' }), path.basename(filepath));
|
|
414
|
+
form.append(`urls[${i}]`, slug);
|
|
415
|
+
form.append(`breakpoints[${i}]`, String(width));
|
|
416
|
+
});
|
|
417
|
+
|
|
418
|
+
const data = await diffyRequest(
|
|
419
|
+
cfg,
|
|
420
|
+
'POST',
|
|
421
|
+
`projects/${cfg.projectId}/create-custom-snapshot`,
|
|
422
|
+
{ form }
|
|
423
|
+
);
|
|
424
|
+
const screenshotId = typeof data === 'object' ? (data.id || data.snapshotId || data) : data;
|
|
425
|
+
this.diffyCreatedScreenshotIds.push(screenshotId);
|
|
426
|
+
});
|
|
427
|
+
|
|
428
|
+
function detectPngWidth(buffer) {
|
|
429
|
+
if (buffer.length < 24 || buffer[0] !== 0x89 || buffer[1] !== 0x50) return 0;
|
|
430
|
+
return buffer.readUInt32BE(16);
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
/**
|
|
434
|
+
* Poll the last created Diffy comparison until it reaches a terminal state.
|
|
435
|
+
* Timeout is DIFFY_MAX_WAIT seconds (default 1200).
|
|
436
|
+
*
|
|
437
|
+
* Example #1: Then wait for diffy comparison to complete
|
|
438
|
+
* Example #2: And wait for diffy comparison to complete
|
|
439
|
+
* Example #3: Then I wait for diffy comparison to complete
|
|
440
|
+
* Example #4: Then we wait for diffy comparison to complete
|
|
441
|
+
* Example #5: And I wait for diffy comparison to complete
|
|
442
|
+
* Example #6: And we wait for diffy comparison to complete
|
|
443
|
+
* Example #7: But I wait for diffy comparison to complete
|
|
444
|
+
*
|
|
445
|
+
*/
|
|
446
|
+
Then(/^(I |we )*wait for diffy comparison to complete$/, { timeout: 60 * 60 * 1000 }, async function (pronounCase) {
|
|
447
|
+
const cfg = this.diffyConfig;
|
|
448
|
+
const ids = this.diffyCreatedDiffIds || [];
|
|
449
|
+
if (!ids.length) throw new Error('No Diffy comparison created yet.');
|
|
450
|
+
const diffId = ids[ids.length - 1];
|
|
451
|
+
const step = 10;
|
|
452
|
+
const completed = new Set([2, 3, 4, 7]);
|
|
453
|
+
for (let i = 0; i < cfg.maxWait; i += step) {
|
|
454
|
+
const data = await diffyRequest(cfg, 'GET', `diffs/${diffId}`);
|
|
455
|
+
if (data && completed.has(Number(data.state))) return;
|
|
456
|
+
await new Promise(r => setTimeout(r, step * 1000));
|
|
457
|
+
}
|
|
458
|
+
throw new Error(`Diffy comparison ${diffId} did not complete in ${cfg.maxWait}s.`);
|
|
459
|
+
});
|
package/tsconfig.json
CHANGED
|
@@ -1,10 +1,26 @@
|
|
|
1
1
|
{
|
|
2
2
|
"compilerOptions": {
|
|
3
|
-
"target": "
|
|
4
|
-
"module": "
|
|
3
|
+
"target": "ES2022",
|
|
4
|
+
"module": "NodeNext",
|
|
5
|
+
"moduleResolution": "NodeNext",
|
|
6
|
+
"lib": ["ES2022", "DOM"],
|
|
5
7
|
"strict": true,
|
|
8
|
+
"noImplicitAny": false,
|
|
6
9
|
"esModuleInterop": true,
|
|
10
|
+
"resolveJsonModule": true,
|
|
11
|
+
"allowJs": true,
|
|
12
|
+
"checkJs": false,
|
|
13
|
+
"skipLibCheck": true,
|
|
14
|
+
"isolatedModules": true,
|
|
15
|
+
"verbatimModuleSyntax": false,
|
|
7
16
|
"types": ["node"]
|
|
8
17
|
},
|
|
9
|
-
"include": [
|
|
18
|
+
"include": [
|
|
19
|
+
"playwright.config.ts",
|
|
20
|
+
"tests/**/*.ts",
|
|
21
|
+
"tests/**/*.js",
|
|
22
|
+
"bin/**/*.ts",
|
|
23
|
+
"bin/**/*.js"
|
|
24
|
+
],
|
|
25
|
+
"exclude": ["node_modules", "tests/reports", "screenshots"]
|
|
10
26
|
}
|
package/generate-reports.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
var reporter = require('cucumber-html-reporter');
|
|
2
|
-
|
|
3
|
-
var options = {
|
|
4
|
-
theme: 'bootstrap',
|
|
5
|
-
jsonFile: 'tests/reports/cucumber_report.json',
|
|
6
|
-
output: 'tests/reports/cucumber_report.html',
|
|
7
|
-
reportSuiteAsScenarios: true,
|
|
8
|
-
scenarioTimestamp: true,
|
|
9
|
-
launchReport: false,
|
|
10
|
-
brandTitle: "Test Report",
|
|
11
|
-
metadata: {
|
|
12
|
-
"App Version": "7.1.0",
|
|
13
|
-
"Test Environment": "development",
|
|
14
|
-
"Browser": "Google Chrome",
|
|
15
|
-
"Platform": "Linux",
|
|
16
|
-
"Parallel": "Scenarios",
|
|
17
|
-
"Executed": "Remote"
|
|
18
|
-
},
|
|
19
|
-
failedSummaryReport: true,
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
reporter.generate(options);
|
package/required/cucumber.js
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
default: {
|
|
3
|
-
timeout: 30000,
|
|
4
|
-
requireModule: ['ts-node/register'],
|
|
5
|
-
require: [
|
|
6
|
-
'node_modules/webship-js/tests/step-definitions/**/*.js',
|
|
7
|
-
'tests/step-definitions/**/*.js',
|
|
8
|
-
],
|
|
9
|
-
paths: ['tests/features/**/*.feature'],
|
|
10
|
-
format: [
|
|
11
|
-
'@cucumber/pretty-formatter',
|
|
12
|
-
'json:tests/reports/cucumber_report.json',
|
|
13
|
-
],
|
|
14
|
-
formatOptions: {
|
|
15
|
-
colorsEnabled: true,
|
|
16
|
-
theme: {
|
|
17
|
-
'feature keyword': ['bold', 'blue'],
|
|
18
|
-
'feature name': ['blue', 'underline'],
|
|
19
|
-
'feature description': ['blueBright'],
|
|
20
|
-
'scenario keyword': ['bold', 'magenta'],
|
|
21
|
-
'scenario name': ['magenta', 'underline'],
|
|
22
|
-
'step keyword': ['bold', 'green'],
|
|
23
|
-
'step text': ['greenBright', 'italic'],
|
|
24
|
-
},
|
|
25
|
-
},
|
|
26
|
-
worldParameters: {
|
|
27
|
-
launchUrl: process.env.LAUNCH_URL || 'http://localhost:8080',
|
|
28
|
-
minWaitTime: {
|
|
29
|
-
page: 3000,
|
|
30
|
-
before_scenario: 0,
|
|
31
|
-
after_scenario: 0,
|
|
32
|
-
before_step: 0,
|
|
33
|
-
after_step: 0,
|
|
34
|
-
},
|
|
35
|
-
},
|
|
36
|
-
},
|
|
37
|
-
};
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
var reporter = require('cucumber-html-reporter');
|
|
2
|
-
|
|
3
|
-
var options = {
|
|
4
|
-
theme: 'bootstrap',
|
|
5
|
-
jsonFile: 'tests/reports/cucumber_report.json',
|
|
6
|
-
output: 'tests/reports/cucumber_report.html',
|
|
7
|
-
reportSuiteAsScenarios: true,
|
|
8
|
-
scenarioTimestamp: true,
|
|
9
|
-
launchReport: false,
|
|
10
|
-
brandTitle: "Test Report",
|
|
11
|
-
metadata: {
|
|
12
|
-
"App Version": "7.1.0",
|
|
13
|
-
"Test Environment": "development",
|
|
14
|
-
"Browser": "Google Chrome",
|
|
15
|
-
"Platform": "Linux",
|
|
16
|
-
"Parallel": "Scenarios",
|
|
17
|
-
"Executed": "Remote"
|
|
18
|
-
},
|
|
19
|
-
failedSummaryReport: true,
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
reporter.generate(options);
|
package/required/package.json
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "project-name",
|
|
3
|
-
"version": "2.0.0",
|
|
4
|
-
"description": "",
|
|
5
|
-
"main": "index.js",
|
|
6
|
-
"author": "",
|
|
7
|
-
"license": "MIT",
|
|
8
|
-
"private": false,
|
|
9
|
-
"scripts": {
|
|
10
|
-
"test": "cucumber-js --config cucumber.js; node generate-reports.js;",
|
|
11
|
-
"test:firefox": "BROWSER=firefox cucumber-js --config cucumber.js; node generate-reports.js;",
|
|
12
|
-
"test:webkit": "BROWSER=webkit cucumber-js --config cucumber.js; node generate-reports.js;"
|
|
13
|
-
},
|
|
14
|
-
"homepage": "https://github.com/webship/webship-js",
|
|
15
|
-
"dependencies": {
|
|
16
|
-
"webship-js": "~2.0.0"
|
|
17
|
-
}
|
|
18
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import type { LaunchOptions, BrowserContextOptions } from 'playwright';
|
|
2
|
-
|
|
3
|
-
type BrowserName = 'chromium' | 'firefox' | 'webkit';
|
|
4
|
-
|
|
5
|
-
const browser = (process.env.BROWSER || 'chromium') as BrowserName;
|
|
6
|
-
|
|
7
|
-
const chromiumArgs: string[] = [
|
|
8
|
-
'--no-sandbox',
|
|
9
|
-
'--disable-dev-shm-usage',
|
|
10
|
-
'--disable-setuid-sandbox',
|
|
11
|
-
'--disable-web-security',
|
|
12
|
-
'--ignore-certificate-errors',
|
|
13
|
-
'--disable-extensions',
|
|
14
|
-
'--incognito',
|
|
15
|
-
'--disable-infobars',
|
|
16
|
-
];
|
|
17
|
-
|
|
18
|
-
interface PlaywrightConfig {
|
|
19
|
-
browser: BrowserName;
|
|
20
|
-
launchOptions: LaunchOptions;
|
|
21
|
-
contextOptions: BrowserContextOptions;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
const config: PlaywrightConfig = {
|
|
25
|
-
browser,
|
|
26
|
-
launchOptions: {
|
|
27
|
-
headless: true,
|
|
28
|
-
slowMo: 300,
|
|
29
|
-
args: browser === 'chromium' ? chromiumArgs : [],
|
|
30
|
-
},
|
|
31
|
-
contextOptions: {
|
|
32
|
-
viewport: { width: 1600, height: 1200 },
|
|
33
|
-
ignoreHTTPSErrors: true,
|
|
34
|
-
},
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
export = config;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
# Features
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
Feature: Check the home page
|
|
2
|
-
As a nonymouse user
|
|
3
|
-
I want to be able to visit the home page
|
|
4
|
-
So that I know that the site is working
|
|
5
|
-
|
|
6
|
-
Scenario: Check homepage
|
|
7
|
-
Given I am on the homepage
|
|
8
|
-
Then I should see "Love to help in speeding up the work of having Automated Functional Acceptance Testing for products to ship websites in a swift way."
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
# Reports
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
# Step Definitions
|