@stablyai/internal-playwright 0.1.0 → 0.1.2
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/lib/index.js +8 -6
- package/lib/matchers/toMatchSnapshot.js +1 -1
- package/package.json +2 -2
- package/types/test.d.ts +14 -2
package/lib/index.js
CHANGED
|
@@ -134,7 +134,7 @@ const playwrightFixtures = {
|
|
|
134
134
|
actionTimeout: [0, { option: true, box: true }],
|
|
135
135
|
testIdAttribute: ["data-testid", { option: true, box: true }],
|
|
136
136
|
navigationTimeout: [0, { option: true, box: true }],
|
|
137
|
-
|
|
137
|
+
autoHeal: [void 0, { option: true, box: true }],
|
|
138
138
|
baseURL: [async ({}, use) => {
|
|
139
139
|
await use(process.env.PLAYWRIGHT_TEST_BASE_URL);
|
|
140
140
|
}, { option: true, box: true }],
|
|
@@ -215,19 +215,21 @@ const playwrightFixtures = {
|
|
|
215
215
|
...options
|
|
216
216
|
});
|
|
217
217
|
}, { box: true }],
|
|
218
|
-
_setupContextOptions: [async ({ playwright, _combinedContextOptions, actionTimeout, navigationTimeout, testIdAttribute,
|
|
218
|
+
_setupContextOptions: [async ({ playwright, _combinedContextOptions, actionTimeout, navigationTimeout, testIdAttribute, autoHeal }, use, testInfo) => {
|
|
219
219
|
if (testIdAttribute)
|
|
220
220
|
playwrightLibrary.selectors.setTestIdAttribute(testIdAttribute);
|
|
221
221
|
testInfo.snapshotSuffix = process.platform;
|
|
222
222
|
if ((0, import_utils.debugMode)() === "inspector")
|
|
223
223
|
testInfo._setDebugMode();
|
|
224
|
-
if (
|
|
224
|
+
if (autoHeal) {
|
|
225
225
|
try {
|
|
226
226
|
const { setHealingConfig } = require("playwright-core/lib/server/stably/autohealing/healingService");
|
|
227
227
|
setHealingConfig({
|
|
228
|
-
enabled:
|
|
229
|
-
model:
|
|
230
|
-
timeout:
|
|
228
|
+
enabled: autoHeal.enabled,
|
|
229
|
+
model: autoHeal.model,
|
|
230
|
+
timeout: autoHeal.timeout,
|
|
231
|
+
locators: autoHeal.locators,
|
|
232
|
+
screenshots: autoHeal.screenshots
|
|
231
233
|
});
|
|
232
234
|
} catch (error) {
|
|
233
235
|
}
|
|
@@ -303,7 +303,7 @@ async function toHaveScreenshot(pageOrLocator, nameOrOptions = {}, optOptions =
|
|
|
303
303
|
header2 += " Failed to re-generate expected.\n";
|
|
304
304
|
return helper.handleDifferent(actual, expectScreenshotOptions.expected, previous, diff, header2, errorMessage, log, this._stepInfo);
|
|
305
305
|
}
|
|
306
|
-
if (helper.options.autoheal ?? (0, import_healingService.
|
|
306
|
+
if (helper.options.autoheal ?? (0, import_healingService.isScreenshotHealingEnabled)()) {
|
|
307
307
|
if (actual && expected) {
|
|
308
308
|
try {
|
|
309
309
|
const aiScreenshotMatchJudgement = await (0, import_healingService.attemptToHaveScreenshotHealing)({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stablyai/internal-playwright",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "A high-level API to automate web browsers",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
},
|
|
67
67
|
"license": "Apache-2.0",
|
|
68
68
|
"dependencies": {
|
|
69
|
-
"@stablyai/internal-playwright-core": "0.1.
|
|
69
|
+
"@stablyai/internal-playwright-core": "0.1.2"
|
|
70
70
|
},
|
|
71
71
|
"optionalDependencies": {
|
|
72
72
|
"fsevents": "2.3.2"
|
package/types/test.d.ts
CHANGED
|
@@ -7493,6 +7493,8 @@ export interface PlaywrightTestOptions {
|
|
|
7493
7493
|
testIdAttribute: string;
|
|
7494
7494
|
}
|
|
7495
7495
|
|
|
7496
|
+
type STABLY_AUTOHEAL_MODELS = 'claude-sonnet-4-5';
|
|
7497
|
+
|
|
7496
7498
|
/**
|
|
7497
7499
|
* Playwright Test provides many options to configure test environment,
|
|
7498
7500
|
* [Browser](https://playwright.dev/docs/api/class-browser),
|
|
@@ -7532,10 +7534,20 @@ export interface PlaywrightTestOptions {
|
|
|
7532
7534
|
*
|
|
7533
7535
|
*/
|
|
7534
7536
|
export interface StablyTestOptions {
|
|
7535
|
-
|
|
7537
|
+
autoHeal?: {
|
|
7536
7538
|
enabled: boolean;
|
|
7537
|
-
model?:
|
|
7539
|
+
model?: STABLY_AUTOHEAL_MODELS;
|
|
7538
7540
|
timeout?: number;
|
|
7541
|
+
locators?: {
|
|
7542
|
+
enabled?: boolean;
|
|
7543
|
+
model?: STABLY_AUTOHEAL_MODELS;
|
|
7544
|
+
timeout?: number;
|
|
7545
|
+
};
|
|
7546
|
+
screenshots?: {
|
|
7547
|
+
enabled?: boolean;
|
|
7548
|
+
model?: STABLY_AUTOHEAL_MODELS;
|
|
7549
|
+
timeout?: number;
|
|
7550
|
+
};
|
|
7539
7551
|
};
|
|
7540
7552
|
}
|
|
7541
7553
|
|