@quickpickle/playwright 0.9.4 → 0.9.5
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/dist/PlaywrightWorld.cjs +26 -7
- package/dist/PlaywrightWorld.cjs.map +1 -1
- package/dist/PlaywrightWorld.d.ts +20 -6
- package/dist/PlaywrightWorld.mjs +28 -9
- package/dist/PlaywrightWorld.mjs.map +1 -1
- package/dist/actions.steps.cjs +32 -24
- package/dist/actions.steps.cjs.map +1 -1
- package/dist/actions.steps.mjs +32 -24
- package/dist/actions.steps.mjs.map +1 -1
- package/dist/outcomes.steps.cjs +61 -24
- package/dist/outcomes.steps.cjs.map +1 -1
- package/dist/outcomes.steps.d.ts +1 -1
- package/dist/outcomes.steps.mjs +61 -24
- package/dist/outcomes.steps.mjs.map +1 -1
- package/dist/snapshotMatcher.cjs +88 -0
- package/dist/snapshotMatcher.cjs.map +1 -0
- package/dist/snapshotMatcher.d.ts +23 -0
- package/dist/snapshotMatcher.mjs +86 -0
- package/dist/snapshotMatcher.mjs.map +1 -0
- package/package.json +9 -2
package/dist/PlaywrightWorld.cjs
CHANGED
|
@@ -4,27 +4,40 @@ var playwright = require('playwright');
|
|
|
4
4
|
var quickpickle = require('quickpickle');
|
|
5
5
|
var lodashEs = require('lodash-es');
|
|
6
6
|
|
|
7
|
+
const browsers = { chromium: playwright.chromium, firefox: playwright.firefox, webkit: playwright.webkit };
|
|
7
8
|
const defaultPlaywrightWorldConfig = {
|
|
9
|
+
host: 'http://localhost',
|
|
10
|
+
screenshotDir: 'screenshots',
|
|
8
11
|
nojsTags: ['@nojs', '@noscript'],
|
|
12
|
+
showBrowserTags: ['@browser', '@show-browser', '@showbrowser'],
|
|
13
|
+
slowMoTags: ['@slowmo'],
|
|
9
14
|
headless: true,
|
|
10
|
-
slowMo:
|
|
15
|
+
slowMo: false,
|
|
16
|
+
slowMoMs: 500,
|
|
11
17
|
};
|
|
12
18
|
class PlaywrightWorld extends quickpickle.QuickPickleWorld {
|
|
13
|
-
constructor(context, info, worldConfig) {
|
|
19
|
+
constructor(context, info, worldConfig = {}) {
|
|
14
20
|
super(context, info);
|
|
15
21
|
this.playwrightConfig = defaultPlaywrightWorldConfig;
|
|
16
|
-
let newConfig = lodashEs.
|
|
22
|
+
let newConfig = lodashEs.defaultsDeep(worldConfig || {}, defaultPlaywrightWorldConfig);
|
|
17
23
|
newConfig.nojsTags = quickpickle.normalizeTags(newConfig.nojsTags);
|
|
24
|
+
newConfig.showBrowserTags = quickpickle.normalizeTags(newConfig.showBrowserTags);
|
|
25
|
+
newConfig.slowMoTags = quickpickle.normalizeTags(newConfig.slowMoTags);
|
|
26
|
+
if (typeof newConfig.slowMo === 'number') {
|
|
27
|
+
newConfig.slowMoMs = newConfig.slowMo;
|
|
28
|
+
newConfig.slowMo = newConfig.slowMoMs > 0;
|
|
29
|
+
}
|
|
18
30
|
this.playwrightConfig = newConfig;
|
|
19
31
|
}
|
|
20
32
|
async init() {
|
|
21
|
-
this.
|
|
22
|
-
|
|
23
|
-
|
|
33
|
+
let browserName = this.info.tags.find(t => t.match(/^@(?:chromium|firefox|webkit)$/))?.replace(/^@/, '') ?? 'chromium';
|
|
34
|
+
this.browser = await browsers[browserName].launch({
|
|
35
|
+
headless: this.tagsMatch(this.playwrightConfig.showBrowserTags) ? false : this.playwrightConfig.headless,
|
|
36
|
+
slowMo: (this.playwrightConfig.slowMo || this.tagsMatch(this.playwrightConfig.slowMoTags)) ? this.playwrightConfig.slowMoMs : 0
|
|
24
37
|
});
|
|
25
38
|
this.browserContext = await this.browser.newContext({
|
|
26
39
|
serviceWorkers: 'block',
|
|
27
|
-
javaScriptEnabled:
|
|
40
|
+
javaScriptEnabled: this.tagsMatch(this.playwrightConfig.nojsTags) ? false : true,
|
|
28
41
|
});
|
|
29
42
|
this.page = await this.browserContext.newPage();
|
|
30
43
|
}
|
|
@@ -39,6 +52,12 @@ class PlaywrightWorld extends quickpickle.QuickPickleWorld {
|
|
|
39
52
|
async close() {
|
|
40
53
|
await this.browser.close();
|
|
41
54
|
}
|
|
55
|
+
get baseUrl() {
|
|
56
|
+
if (this.playwrightConfig.port)
|
|
57
|
+
return new URL(`${this.playwrightConfig.host}:${this.playwrightConfig.port}`);
|
|
58
|
+
else
|
|
59
|
+
return new URL(this.playwrightConfig.host);
|
|
60
|
+
}
|
|
42
61
|
}
|
|
43
62
|
quickpickle.After(async (world) => {
|
|
44
63
|
await world.browserContext.close();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PlaywrightWorld.cjs","sources":["../src/PlaywrightWorld.ts"],"sourcesContent":[null],"names":["
|
|
1
|
+
{"version":3,"file":"PlaywrightWorld.cjs","sources":["../src/PlaywrightWorld.ts"],"sourcesContent":[null],"names":["chromium","firefox","webkit","QuickPickleWorld","defaultsDeep","normalizeTags","After"],"mappings":";;;;;;AAMA,MAAM,QAAQ,GAAG,YAAEA,mBAAQ,WAAEC,kBAAO,UAAEC,iBAAM,EAAE,CAAA;AAcjC,MAAA,4BAA4B,GAAG;AAC1C,IAAA,IAAI,EAAE,kBAAkB;AACxB,IAAA,aAAa,EAAE,aAAa;AAC5B,IAAA,QAAQ,EAAE,CAAC,OAAO,EAAE,WAAW,CAAC;AAChC,IAAA,eAAe,EAAE,CAAC,UAAU,EAAC,eAAe,EAAC,cAAc,CAAC;IAC5D,UAAU,EAAE,CAAC,SAAS,CAAC;AACvB,IAAA,QAAQ,EAAE,IAAI;AACd,IAAA,MAAM,EAAE,KAAK;AACb,IAAA,QAAQ,EAAE,GAAG;EACd;AAIK,MAAO,eAAgB,SAAQC,4BAAgB,CAAA;AAMnD,IAAA,WAAA,CAAY,OAAmB,EAAE,IAAgD,EAAE,cAA2C,EAAE,EAAA;AAC9H,QAAA,KAAK,CAAC,OAAO,EAAE,IAAI,CAAC,CAAA;QAHtB,IAAgB,CAAA,gBAAA,GAAyB,4BAA4B,CAAA;QAInE,IAAI,SAAS,GAAGC,qBAAY,CAAC,WAAW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
|
2
2
|
import { QuickPickleWorld, QuickPickleWorldInterface } from 'quickpickle';
|
|
3
3
|
import type { TestContext } from 'vitest';
|
|
4
|
-
export type PlaywrightWorldConfigSetting = {
|
|
5
|
-
|
|
4
|
+
export type PlaywrightWorldConfigSetting = Partial<{
|
|
5
|
+
host: string;
|
|
6
|
+
port: number;
|
|
7
|
+
screenshotDir: string;
|
|
8
|
+
nojsTags: string | string[];
|
|
9
|
+
showBrowserTags: string | string[];
|
|
10
|
+
slowMoTags: string | string[];
|
|
6
11
|
headless: boolean;
|
|
7
|
-
|
|
8
|
-
|
|
12
|
+
slowMo: boolean | number;
|
|
13
|
+
slowMoMs: number;
|
|
14
|
+
}>;
|
|
9
15
|
export declare const defaultPlaywrightWorldConfig: {
|
|
16
|
+
host: string;
|
|
17
|
+
screenshotDir: string;
|
|
10
18
|
nojsTags: string[];
|
|
19
|
+
showBrowserTags: string[];
|
|
20
|
+
slowMoTags: string[];
|
|
11
21
|
headless: boolean;
|
|
12
|
-
slowMo:
|
|
22
|
+
slowMo: boolean;
|
|
23
|
+
slowMoMs: number;
|
|
24
|
+
};
|
|
25
|
+
export type PlaywrightWorldConfig = typeof defaultPlaywrightWorldConfig & {
|
|
26
|
+
port?: number;
|
|
13
27
|
};
|
|
14
|
-
export type PlaywrightWorldConfig = typeof defaultPlaywrightWorldConfig;
|
|
15
28
|
export declare class PlaywrightWorld extends QuickPickleWorld {
|
|
16
29
|
browser: Browser;
|
|
17
30
|
browserContext: BrowserContext;
|
|
@@ -21,4 +34,5 @@ export declare class PlaywrightWorld extends QuickPickleWorld {
|
|
|
21
34
|
init(): Promise<void>;
|
|
22
35
|
reset(): Promise<void>;
|
|
23
36
|
close(): Promise<void>;
|
|
37
|
+
get baseUrl(): URL;
|
|
24
38
|
}
|
package/dist/PlaywrightWorld.mjs
CHANGED
|
@@ -1,28 +1,41 @@
|
|
|
1
|
-
import { chromium } from 'playwright';
|
|
1
|
+
import { chromium, firefox, webkit } from 'playwright';
|
|
2
2
|
import { After, QuickPickleWorld, normalizeTags } from 'quickpickle';
|
|
3
|
-
import {
|
|
3
|
+
import { defaultsDeep } from 'lodash-es';
|
|
4
4
|
|
|
5
|
+
const browsers = { chromium, firefox, webkit };
|
|
5
6
|
const defaultPlaywrightWorldConfig = {
|
|
7
|
+
host: 'http://localhost',
|
|
8
|
+
screenshotDir: 'screenshots',
|
|
6
9
|
nojsTags: ['@nojs', '@noscript'],
|
|
10
|
+
showBrowserTags: ['@browser', '@show-browser', '@showbrowser'],
|
|
11
|
+
slowMoTags: ['@slowmo'],
|
|
7
12
|
headless: true,
|
|
8
|
-
slowMo:
|
|
13
|
+
slowMo: false,
|
|
14
|
+
slowMoMs: 500,
|
|
9
15
|
};
|
|
10
16
|
class PlaywrightWorld extends QuickPickleWorld {
|
|
11
|
-
constructor(context, info, worldConfig) {
|
|
17
|
+
constructor(context, info, worldConfig = {}) {
|
|
12
18
|
super(context, info);
|
|
13
19
|
this.playwrightConfig = defaultPlaywrightWorldConfig;
|
|
14
|
-
let newConfig =
|
|
20
|
+
let newConfig = defaultsDeep(worldConfig || {}, defaultPlaywrightWorldConfig);
|
|
15
21
|
newConfig.nojsTags = normalizeTags(newConfig.nojsTags);
|
|
22
|
+
newConfig.showBrowserTags = normalizeTags(newConfig.showBrowserTags);
|
|
23
|
+
newConfig.slowMoTags = normalizeTags(newConfig.slowMoTags);
|
|
24
|
+
if (typeof newConfig.slowMo === 'number') {
|
|
25
|
+
newConfig.slowMoMs = newConfig.slowMo;
|
|
26
|
+
newConfig.slowMo = newConfig.slowMoMs > 0;
|
|
27
|
+
}
|
|
16
28
|
this.playwrightConfig = newConfig;
|
|
17
29
|
}
|
|
18
30
|
async init() {
|
|
19
|
-
this.
|
|
20
|
-
|
|
21
|
-
|
|
31
|
+
let browserName = this.info.tags.find(t => t.match(/^@(?:chromium|firefox|webkit)$/))?.replace(/^@/, '') ?? 'chromium';
|
|
32
|
+
this.browser = await browsers[browserName].launch({
|
|
33
|
+
headless: this.tagsMatch(this.playwrightConfig.showBrowserTags) ? false : this.playwrightConfig.headless,
|
|
34
|
+
slowMo: (this.playwrightConfig.slowMo || this.tagsMatch(this.playwrightConfig.slowMoTags)) ? this.playwrightConfig.slowMoMs : 0
|
|
22
35
|
});
|
|
23
36
|
this.browserContext = await this.browser.newContext({
|
|
24
37
|
serviceWorkers: 'block',
|
|
25
|
-
javaScriptEnabled:
|
|
38
|
+
javaScriptEnabled: this.tagsMatch(this.playwrightConfig.nojsTags) ? false : true,
|
|
26
39
|
});
|
|
27
40
|
this.page = await this.browserContext.newPage();
|
|
28
41
|
}
|
|
@@ -37,6 +50,12 @@ class PlaywrightWorld extends QuickPickleWorld {
|
|
|
37
50
|
async close() {
|
|
38
51
|
await this.browser.close();
|
|
39
52
|
}
|
|
53
|
+
get baseUrl() {
|
|
54
|
+
if (this.playwrightConfig.port)
|
|
55
|
+
return new URL(`${this.playwrightConfig.host}:${this.playwrightConfig.port}`);
|
|
56
|
+
else
|
|
57
|
+
return new URL(this.playwrightConfig.host);
|
|
58
|
+
}
|
|
40
59
|
}
|
|
41
60
|
After(async (world) => {
|
|
42
61
|
await world.browserContext.close();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PlaywrightWorld.mjs","sources":["../src/PlaywrightWorld.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"PlaywrightWorld.mjs","sources":["../src/PlaywrightWorld.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;AAMA,MAAM,QAAQ,GAAG,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,CAAA;AAcjC,MAAA,4BAA4B,GAAG;AAC1C,IAAA,IAAI,EAAE,kBAAkB;AACxB,IAAA,aAAa,EAAE,aAAa;AAC5B,IAAA,QAAQ,EAAE,CAAC,OAAO,EAAE,WAAW,CAAC;AAChC,IAAA,eAAe,EAAE,CAAC,UAAU,EAAC,eAAe,EAAC,cAAc,CAAC;IAC5D,UAAU,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AI,CAAA,CAAA,EAAI,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAA,CAAE,CAAC,CAAA;;YACxG,OAAO,IAAI,GAAG,CAAC,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAA;KAChD;AACF,CAAA;AAED,KAAK,CAAC,OAAO,KAAqB,KAAI;AACpC,IAAA,MAAM,KAAK,CAAC,cAAc,CAAC,KAAK,EAAE,CAAA;AACpC,CAAC,CAAC;;;;"}
|
package/dist/actions.steps.cjs
CHANGED
|
@@ -7,34 +7,41 @@ var url = require('node:url');
|
|
|
7
7
|
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
|
|
8
8
|
const projectRoot = path.resolve(path.dirname(url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('actions.steps.cjs', document.baseURI).href)))), '..');
|
|
9
9
|
quickpickle.Given('I am on {string}', async function (world, path) {
|
|
10
|
-
let url = new URL(path,
|
|
10
|
+
let url = new URL(path, world.baseUrl);
|
|
11
11
|
await world.page.goto(url.href);
|
|
12
|
-
await world.page.waitForTimeout(80);
|
|
13
12
|
});
|
|
14
13
|
quickpickle.When(`I visit {string}`, async function (world, path) {
|
|
15
|
-
let url = new URL(path,
|
|
14
|
+
let url = new URL(path, world.baseUrl);
|
|
16
15
|
await world.page.goto(url.href);
|
|
17
|
-
await world.page.waitForTimeout(80);
|
|
18
16
|
});
|
|
19
17
|
quickpickle.When(`I navigate/go to {string}`, async function (world, path) {
|
|
20
|
-
let url = new URL(path,
|
|
18
|
+
let url = new URL(path, world.baseUrl);
|
|
21
19
|
await world.page.goto(url.href);
|
|
22
|
-
|
|
20
|
+
});
|
|
21
|
+
quickpickle.When('I load the file {string}', async (world, path) => {
|
|
22
|
+
await world.page.goto(`file://${projectRoot}/${path}`);
|
|
23
23
|
});
|
|
24
24
|
quickpickle.When('I click/press/tap/touch (on ){string}', async function (world, identifier) {
|
|
25
|
-
|
|
26
|
-
await locator.click();
|
|
25
|
+
await world.page.getByText(identifier, { exact: true }).click();
|
|
27
26
|
});
|
|
28
27
|
quickpickle.When('I click/press/tap/touch (on )the {string} {word}', async function (world, identifier, role) {
|
|
29
|
-
let locator
|
|
28
|
+
let locator;
|
|
29
|
+
if (role === 'element')
|
|
30
|
+
locator = await world.page.getByText(identifier, { exact: true }).or(world.page.locator(identifier));
|
|
31
|
+
else
|
|
32
|
+
locator = await world.page.getByRole(role, { name: identifier });
|
|
30
33
|
await locator.click();
|
|
31
34
|
});
|
|
32
35
|
quickpickle.When('I focus/select/activate (on ){string}', async function (world, identifier) {
|
|
33
|
-
let locator = await world.page.locator(identifier);
|
|
36
|
+
let locator = await world.page.getByText(identifier, { exact: true }).or(world.page.locator(identifier));
|
|
34
37
|
await locator.focus();
|
|
35
38
|
});
|
|
36
39
|
quickpickle.When('I focus/select/activate (on )the {string} {word}', async function (world, identifier, role) {
|
|
37
|
-
let locator
|
|
40
|
+
let locator;
|
|
41
|
+
if (role === 'element')
|
|
42
|
+
locator = await world.page.getByText(identifier, { exact: true }).or(world.page.locator(identifier));
|
|
43
|
+
else
|
|
44
|
+
locator = await world.page.getByRole(role, { name: identifier });
|
|
38
45
|
await locator.focus();
|
|
39
46
|
});
|
|
40
47
|
quickpickle.When("for (the ){string} I enter/fill (in ){string}", async function (world, identifier, text) {
|
|
@@ -42,7 +49,7 @@ quickpickle.When("for (the ){string} I enter/fill (in ){string}", async function
|
|
|
42
49
|
await locator.fill(text);
|
|
43
50
|
});
|
|
44
51
|
quickpickle.When("for (the ){string} I enter/fill (in )the following( text):", async function (world, identifier, text) {
|
|
45
|
-
let locator = await world.page.getByLabel(identifier).or(
|
|
52
|
+
let locator = await world.page.getByLabel(identifier).or(world.page.getByPlaceholder(identifier)).or(world.page.locator(identifier));
|
|
46
53
|
await locator.fill(text);
|
|
47
54
|
});
|
|
48
55
|
quickpickle.When('I enter/fill (in )the following( fields):', async function (world, table) {
|
|
@@ -63,19 +70,21 @@ quickpickle.When('I enter/fill (in )the following( fields):', async function (wo
|
|
|
63
70
|
}
|
|
64
71
|
}
|
|
65
72
|
});
|
|
66
|
-
quickpickle.When(
|
|
67
|
-
let
|
|
73
|
+
quickpickle.When('I wait for {string} to be attached/detatched/visible/hidden', async function (world, identifier) {
|
|
74
|
+
let state = world.info.step?.match(/(attached|detatched|visible|hidden)$/)[0];
|
|
75
|
+
let locator = await world.page.getByText(identifier, { exact: true }).or(world.page.getByLabel(identifier)).or(world.page.locator(identifier));
|
|
68
76
|
await locator.waitFor({ state });
|
|
69
77
|
});
|
|
70
|
-
quickpickle.When(
|
|
78
|
+
quickpickle.When('I scroll down/up/left/right', async function (world) {
|
|
79
|
+
let direction = world.info.step?.match(/(down|up|left|right)$/)[0];
|
|
71
80
|
let num = 100;
|
|
72
81
|
let horiz = direction.includes('t');
|
|
73
82
|
if (horiz)
|
|
74
83
|
await world.page.mouse.wheel(direction === 'right' ? num : -num, 0);
|
|
75
84
|
await world.page.mouse.wheel(0, direction === 'down' ? num : -num);
|
|
76
85
|
});
|
|
77
|
-
quickpickle.When(
|
|
78
|
-
let
|
|
86
|
+
quickpickle.When('I scroll down/up/left/right {int}(px)( pixels)', async function (world, num) {
|
|
87
|
+
let direction = world.info.step?.match(/(down|up|left|right)(?= \d)/)[0];
|
|
79
88
|
let horiz = direction.includes('t');
|
|
80
89
|
if (horiz)
|
|
81
90
|
await world.page.mouse.wheel(direction === 'right' ? num : -num, 0);
|
|
@@ -87,19 +96,18 @@ quickpickle.When('I type the following keys: {}', async function (world, keys) {
|
|
|
87
96
|
await world.page.keyboard.press(key);
|
|
88
97
|
}
|
|
89
98
|
});
|
|
90
|
-
quickpickle.When(
|
|
99
|
+
quickpickle.When('I go back/forwards?', async function (world) {
|
|
100
|
+
let direction = world.info.step?.match(/(back|forwards?)$/)[0];
|
|
91
101
|
if (direction === 'back')
|
|
92
102
|
await world.page.goBack();
|
|
93
103
|
else
|
|
94
104
|
await world.page.goForward();
|
|
95
105
|
});
|
|
96
|
-
quickpickle.Then('(I )take (a )screenshot', async function (world
|
|
97
|
-
await world.page.
|
|
98
|
-
await world.page.screenshot({ path: `${projectRoot}/screenshots/${world.info.scenario}__${world.info.line}.png`.replace(/\/\//g, '/') });
|
|
106
|
+
quickpickle.Then('(I )take (a )screenshot', async function (world) {
|
|
107
|
+
await world.page.screenshot({ path: `${projectRoot}/${world.playwrightConfig.screenshotDir}/${world.info.rule ? world.info.rule + '__' + world.info.scenario : world.info.scenario}__${world.info.line}.png`.replace(/\/\//g, '/') });
|
|
99
108
|
});
|
|
100
|
-
quickpickle.Then('(I )take (a )screenshot
|
|
101
|
-
await world.page.
|
|
102
|
-
await world.page.screenshot({ path: `${projectRoot}/${dir}/${world.info.scenario}__${world.info.line}.png`.replace(/\/\//g, '/') });
|
|
109
|
+
quickpickle.Then('(I )take (a )screenshot named {string}', async function (world, name) {
|
|
110
|
+
await world.page.screenshot({ path: `${projectRoot}/${world.playwrightConfig.screenshotDir}/${name}.png`.replace(/\/\//g, '/') });
|
|
103
111
|
});
|
|
104
112
|
|
|
105
113
|
exports.projectRoot = projectRoot;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"actions.steps.cjs","sources":["../src/actions.steps.ts"],"sourcesContent":[null],"names":["Given","When","Then"],"mappings":";;;;;;;
|
|
1
|
+
{"version":3,"file":"actions.steps.cjs","sources":["../src/actions.steps.ts"],"sourcesContent":[null],"names":["Given","When","Then"],"mappings":";;;;;;;AAMa,MAAA,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,mQAAe,CAAC,CAAC,EAAE,IAAI,EAAC;AAE/FA,iBAAK,CAAC,kBAAkB,EAAE,gBAAgB,KAAqB,EAAE,IAAI,EAAA;IACnE,IAAI,GAAG,GAAG,IAAI,GAAG,CAAC,IAAI,EAAE,KAAK,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E,IAAW,EAAA;AAC/F,IAAA,MAAM,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,IAAI,EAAE,CAAA,EAAG,WAAW,CAAA,CAAA,EAAI,KAAK,CAAC,gBAAgB,CAAC,aAAa,CAAA,CAAA,EAAI,IAAI,CAAA,IAAA,CAAM,CAAC,OAAO,CAAC,OAAO,EAAC,GAAG,CAAC,EAAE,CAAC,CAAA;AAClI,CAAC,CAAC;;;;"}
|
package/dist/actions.steps.mjs
CHANGED
|
@@ -4,34 +4,41 @@ import url from 'node:url';
|
|
|
4
4
|
|
|
5
5
|
const projectRoot = path.resolve(path.dirname(url.fileURLToPath(import.meta.url)), '..');
|
|
6
6
|
Given('I am on {string}', async function (world, path) {
|
|
7
|
-
let url = new URL(path,
|
|
7
|
+
let url = new URL(path, world.baseUrl);
|
|
8
8
|
await world.page.goto(url.href);
|
|
9
|
-
await world.page.waitForTimeout(80);
|
|
10
9
|
});
|
|
11
10
|
When(`I visit {string}`, async function (world, path) {
|
|
12
|
-
let url = new URL(path,
|
|
11
|
+
let url = new URL(path, world.baseUrl);
|
|
13
12
|
await world.page.goto(url.href);
|
|
14
|
-
await world.page.waitForTimeout(80);
|
|
15
13
|
});
|
|
16
14
|
When(`I navigate/go to {string}`, async function (world, path) {
|
|
17
|
-
let url = new URL(path,
|
|
15
|
+
let url = new URL(path, world.baseUrl);
|
|
18
16
|
await world.page.goto(url.href);
|
|
19
|
-
|
|
17
|
+
});
|
|
18
|
+
When('I load the file {string}', async (world, path) => {
|
|
19
|
+
await world.page.goto(`file://${projectRoot}/${path}`);
|
|
20
20
|
});
|
|
21
21
|
When('I click/press/tap/touch (on ){string}', async function (world, identifier) {
|
|
22
|
-
|
|
23
|
-
await locator.click();
|
|
22
|
+
await world.page.getByText(identifier, { exact: true }).click();
|
|
24
23
|
});
|
|
25
24
|
When('I click/press/tap/touch (on )the {string} {word}', async function (world, identifier, role) {
|
|
26
|
-
let locator
|
|
25
|
+
let locator;
|
|
26
|
+
if (role === 'element')
|
|
27
|
+
locator = await world.page.getByText(identifier, { exact: true }).or(world.page.locator(identifier));
|
|
28
|
+
else
|
|
29
|
+
locator = await world.page.getByRole(role, { name: identifier });
|
|
27
30
|
await locator.click();
|
|
28
31
|
});
|
|
29
32
|
When('I focus/select/activate (on ){string}', async function (world, identifier) {
|
|
30
|
-
let locator = await world.page.locator(identifier);
|
|
33
|
+
let locator = await world.page.getByText(identifier, { exact: true }).or(world.page.locator(identifier));
|
|
31
34
|
await locator.focus();
|
|
32
35
|
});
|
|
33
36
|
When('I focus/select/activate (on )the {string} {word}', async function (world, identifier, role) {
|
|
34
|
-
let locator
|
|
37
|
+
let locator;
|
|
38
|
+
if (role === 'element')
|
|
39
|
+
locator = await world.page.getByText(identifier, { exact: true }).or(world.page.locator(identifier));
|
|
40
|
+
else
|
|
41
|
+
locator = await world.page.getByRole(role, { name: identifier });
|
|
35
42
|
await locator.focus();
|
|
36
43
|
});
|
|
37
44
|
When("for (the ){string} I enter/fill (in ){string}", async function (world, identifier, text) {
|
|
@@ -39,7 +46,7 @@ When("for (the ){string} I enter/fill (in ){string}", async function (world, ide
|
|
|
39
46
|
await locator.fill(text);
|
|
40
47
|
});
|
|
41
48
|
When("for (the ){string} I enter/fill (in )the following( text):", async function (world, identifier, text) {
|
|
42
|
-
let locator = await world.page.getByLabel(identifier).or(
|
|
49
|
+
let locator = await world.page.getByLabel(identifier).or(world.page.getByPlaceholder(identifier)).or(world.page.locator(identifier));
|
|
43
50
|
await locator.fill(text);
|
|
44
51
|
});
|
|
45
52
|
When('I enter/fill (in )the following( fields):', async function (world, table) {
|
|
@@ -60,19 +67,21 @@ When('I enter/fill (in )the following( fields):', async function (world, table)
|
|
|
60
67
|
}
|
|
61
68
|
}
|
|
62
69
|
});
|
|
63
|
-
When(
|
|
64
|
-
let
|
|
70
|
+
When('I wait for {string} to be attached/detatched/visible/hidden', async function (world, identifier) {
|
|
71
|
+
let state = world.info.step?.match(/(attached|detatched|visible|hidden)$/)[0];
|
|
72
|
+
let locator = await world.page.getByText(identifier, { exact: true }).or(world.page.getByLabel(identifier)).or(world.page.locator(identifier));
|
|
65
73
|
await locator.waitFor({ state });
|
|
66
74
|
});
|
|
67
|
-
When(
|
|
75
|
+
When('I scroll down/up/left/right', async function (world) {
|
|
76
|
+
let direction = world.info.step?.match(/(down|up|left|right)$/)[0];
|
|
68
77
|
let num = 100;
|
|
69
78
|
let horiz = direction.includes('t');
|
|
70
79
|
if (horiz)
|
|
71
80
|
await world.page.mouse.wheel(direction === 'right' ? num : -num, 0);
|
|
72
81
|
await world.page.mouse.wheel(0, direction === 'down' ? num : -num);
|
|
73
82
|
});
|
|
74
|
-
When(
|
|
75
|
-
let
|
|
83
|
+
When('I scroll down/up/left/right {int}(px)( pixels)', async function (world, num) {
|
|
84
|
+
let direction = world.info.step?.match(/(down|up|left|right)(?= \d)/)[0];
|
|
76
85
|
let horiz = direction.includes('t');
|
|
77
86
|
if (horiz)
|
|
78
87
|
await world.page.mouse.wheel(direction === 'right' ? num : -num, 0);
|
|
@@ -84,19 +93,18 @@ When('I type the following keys: {}', async function (world, keys) {
|
|
|
84
93
|
await world.page.keyboard.press(key);
|
|
85
94
|
}
|
|
86
95
|
});
|
|
87
|
-
When(
|
|
96
|
+
When('I go back/forwards?', async function (world) {
|
|
97
|
+
let direction = world.info.step?.match(/(back|forwards?)$/)[0];
|
|
88
98
|
if (direction === 'back')
|
|
89
99
|
await world.page.goBack();
|
|
90
100
|
else
|
|
91
101
|
await world.page.goForward();
|
|
92
102
|
});
|
|
93
|
-
Then('(I )take (a )screenshot', async function (world
|
|
94
|
-
await world.page.
|
|
95
|
-
await world.page.screenshot({ path: `${projectRoot}/screenshots/${world.info.scenario}__${world.info.line}.png`.replace(/\/\//g, '/') });
|
|
103
|
+
Then('(I )take (a )screenshot', async function (world) {
|
|
104
|
+
await world.page.screenshot({ path: `${projectRoot}/${world.playwrightConfig.screenshotDir}/${world.info.rule ? world.info.rule + '__' + world.info.scenario : world.info.scenario}__${world.info.line}.png`.replace(/\/\//g, '/') });
|
|
96
105
|
});
|
|
97
|
-
Then('(I )take (a )screenshot
|
|
98
|
-
await world.page.
|
|
99
|
-
await world.page.screenshot({ path: `${projectRoot}/${dir}/${world.info.scenario}__${world.info.line}.png`.replace(/\/\//g, '/') });
|
|
106
|
+
Then('(I )take (a )screenshot named {string}', async function (world, name) {
|
|
107
|
+
await world.page.screenshot({ path: `${projectRoot}/${world.playwrightConfig.screenshotDir}/${name}.png`.replace(/\/\//g, '/') });
|
|
100
108
|
});
|
|
101
109
|
|
|
102
110
|
export { projectRoot };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"actions.steps.mjs","sources":["../src/actions.steps.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"actions.steps.mjs","sources":["../src/actions.steps.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;AAMa,MAAA,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAC;AAE/F,KAAK,CAAC,kBAAkB,EAAE,gBAAgB,KAAqB,EAAE,IAAI,EAAA;IACnE,IAAI,GAAG,GAAG,IAAI,GAAG,CAAC,IAAI,EAAE,KAAK,CAAC,OAAO,CAAC,CAAA;IACtC,MAAM,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;AACjC,CAAC,CAAC,CAAA;AACF,IAAI,CAAC,CAAkB,gBAAA,CAAA,EAAE,gBAAgB,KAAqB,EAAE,IAAI,EAAA;IAClE,IAAI,GAAG,GAAG,IAAI,GAAG,CAAC,IAAI,EAAE,KAAK,CAAC,OAAO,CAAC,CAAA;IACtC,MAAM,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;AACjC,CAA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|
+
require('./snapshotMatcher.cjs');
|
|
6
|
+
require('pngjs');
|
|
7
|
+
require('node:fs');
|
|
8
|
+
require('node:path');
|
|
9
|
+
require('pixelmatch');
|
|
10
|
+
require('lodash-es');
|
|
5
11
|
|
|
6
|
-
quickpickle.Then('I should see {string}', async function (world, text) {
|
|
7
|
-
await world.page.waitForTimeout(50);
|
|
12
|
+
quickpickle.Then('I should see {string}( somewhere)( on the page)', async function (world, text) {
|
|
8
13
|
await test.expect(world.page.getByText(text)).toBeVisible();
|
|
9
14
|
});
|
|
10
|
-
quickpickle.Then('I should not see {string}', async function (world, text) {
|
|
11
|
-
await world.page.waitForTimeout(50);
|
|
15
|
+
quickpickle.Then('I should not see {string}( anywhere)( on the page)', async function (world, text) {
|
|
12
16
|
await test.expect(world.page.getByText(text)).not.toBeVisible();
|
|
13
17
|
});
|
|
18
|
+
quickpickle.Then('I should see a(n)/the {string} with (the )(text ){string}', async function (world, identifier, text) {
|
|
19
|
+
await test.expect(world.page.locator(identifier).filter({ hasText: text })).toBeVisible();
|
|
20
|
+
});
|
|
21
|
+
quickpickle.Then('I should not see a(n)/the {string} with (the )(text ){string}', async function (world, identifier, text) {
|
|
22
|
+
await test.expect(world.page.locator(identifier).filter({ hasText: text })).not.toBeVisible();
|
|
23
|
+
});
|
|
24
|
+
quickpickle.Then('I should see a(n)/the {string} {word} with (the )(text ){string}', async function (world, identifier, role, text) {
|
|
25
|
+
let locator;
|
|
26
|
+
if (role === 'element')
|
|
27
|
+
locator = await world.page.locator(identifier).filter({ hasText: text });
|
|
28
|
+
else
|
|
29
|
+
locator = await world.page.getByRole(role, { name: identifier }).filter({ hasText: text });
|
|
30
|
+
await test.expect(locator).toBeVisible();
|
|
31
|
+
});
|
|
32
|
+
quickpickle.Then('I should not see a(n)/the {string} {word} with (the )(text ){string}', async function (world, identifier, role, text) {
|
|
33
|
+
let locator;
|
|
34
|
+
if (role === 'element')
|
|
35
|
+
locator = await world.page.locator(identifier).filter({ hasText: text });
|
|
36
|
+
else
|
|
37
|
+
locator = await world.page.getByRole(role, { name: identifier }).filter({ hasText: text });
|
|
38
|
+
await test.expect(locator).not.toBeVisible();
|
|
39
|
+
});
|
|
14
40
|
quickpickle.Then('I should see a(n)/the {string} {word}', async function (world, identifier, role) {
|
|
15
|
-
await world.page.waitForTimeout(50);
|
|
16
41
|
if (role === 'element')
|
|
17
42
|
await test.expect(world.page.locator(identifier)).toBeVisible();
|
|
18
43
|
else
|
|
19
44
|
await test.expect(world.page.getByRole(role, { name: identifier })).toBeVisible();
|
|
20
45
|
});
|
|
21
46
|
quickpickle.Then('I should not see a(n)/the {string} {word}', async function (world, identifier, role) {
|
|
22
|
-
await world.page.waitForTimeout(50);
|
|
23
47
|
if (role === 'element')
|
|
24
48
|
await test.expect(world.page.locator(identifier)).not.toBeVisible();
|
|
25
49
|
else
|
|
26
50
|
await test.expect(world.page.getByRole(role, { name: identifier })).not.toBeVisible();
|
|
27
51
|
});
|
|
28
|
-
quickpickle.Then('I should see a(n)/the {string} with the text {string}', async function (world, identifier, text) {
|
|
29
|
-
await world.page.waitForTimeout(50);
|
|
30
|
-
await test.expect(world.page.locator(identifier).filter({ hasText: text })).toBeVisible();
|
|
31
|
-
});
|
|
32
|
-
quickpickle.Then('I should not see a(n)/the {string} with the text {string}', async function (world, identifier, text) {
|
|
33
|
-
await world.page.waitForTimeout(50);
|
|
34
|
-
await test.expect(world.page.locator(identifier).filter({ hasText: text })).not.toBeVisible();
|
|
35
|
-
});
|
|
36
52
|
quickpickle.Then('the (value of ){string} (value )should contain/include/be/equal {string}', async function (world, identifier, val) {
|
|
37
53
|
let exact = world.info.step?.match(/should not (?:be|equal) ["']/) ? true : false;
|
|
38
|
-
await world.page.waitForTimeout(50);
|
|
39
54
|
let value = await (await world.page.locator(identifier)).inputValue();
|
|
40
55
|
if (exact)
|
|
41
56
|
await test.expect(value).toEqual(val);
|
|
@@ -44,7 +59,6 @@ quickpickle.Then('the (value of ){string} (value )should contain/include/be/equa
|
|
|
44
59
|
});
|
|
45
60
|
quickpickle.Then('the (value of ){string} (value )should not contain/include/be/equal {string}', async function (world, identifier, val) {
|
|
46
61
|
let exact = world.info.step?.match(/should not (?:be|equal) ["']/) ? true : false;
|
|
47
|
-
await world.page.waitForTimeout(50);
|
|
48
62
|
let value = await (await world.page.locator(identifier)).inputValue();
|
|
49
63
|
if (exact)
|
|
50
64
|
await test.expect(value).not.toEqual(val);
|
|
@@ -52,7 +66,6 @@ quickpickle.Then('the (value of ){string} (value )should not contain/include/be/
|
|
|
52
66
|
await test.expect(value).not.toContain(val);
|
|
53
67
|
});
|
|
54
68
|
quickpickle.Then(/^the metatag for "([^"]+)" should (be|equal|contain) "(.*)"$/, async function (world, name, eq, value) {
|
|
55
|
-
await world.page.waitForTimeout(50);
|
|
56
69
|
let val;
|
|
57
70
|
if (name === 'title')
|
|
58
71
|
val = await world.page.title();
|
|
@@ -65,14 +78,38 @@ quickpickle.Then(/^the metatag for "([^"]+)" should (be|equal|contain) "(.*)"$/,
|
|
|
65
78
|
else
|
|
66
79
|
await test.expect(val).toBe(value);
|
|
67
80
|
});
|
|
68
|
-
quickpickle.Then('the active element should be {string}', async function (world, identifier) {
|
|
69
|
-
await world.page.waitForTimeout(50);
|
|
81
|
+
quickpickle.Then('the active element should be a/an/the {string}', async function (world, identifier) {
|
|
70
82
|
let locator = await world.page.locator(identifier);
|
|
71
|
-
|
|
83
|
+
try {
|
|
84
|
+
await test.expect(locator).toBeFocused();
|
|
85
|
+
}
|
|
86
|
+
catch (err) {
|
|
87
|
+
throw new Error(`The active element should be ${identifier} but it is not.`);
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
quickpickle.Then('the active element should be a/an/the {string} {word}', async function (world, identifier, role) {
|
|
91
|
+
try {
|
|
92
|
+
let locator;
|
|
93
|
+
if (role === 'element')
|
|
94
|
+
locator = await world.page.getByText(identifier, { exact: true }).or(world.page.locator(identifier));
|
|
95
|
+
else
|
|
96
|
+
locator = await world.page.getByRole(role, { name: identifier });
|
|
97
|
+
await test.expect(locator).toBeFocused();
|
|
98
|
+
}
|
|
99
|
+
catch (err) {
|
|
100
|
+
throw new Error(`The active element should be ${identifier} but it is not.`);
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
quickpickle.Then('the user agent should contain/be {string}', async function (world, ua) {
|
|
104
|
+
await test.expect(world.browser.browserType().name()).toContain(ua);
|
|
105
|
+
});
|
|
106
|
+
quickpickle.Then('(the )screenshot should match', async function (world) {
|
|
107
|
+
await test.expect(world.page).toMatchScreenshot(`${world.playwrightConfig.screenshotDir}/${world.info.rule ? world.info.rule + '__' + world.info.scenario : world.info.scenario}__${world.info.line}.png`);
|
|
108
|
+
});
|
|
109
|
+
quickpickle.Then('(the )screenshot {string} should match', async function (world, name) {
|
|
110
|
+
await test.expect(world.page).toMatchScreenshot(`${world.playwrightConfig.screenshotDir}/${name}.png`);
|
|
72
111
|
});
|
|
73
|
-
quickpickle.Then('the
|
|
74
|
-
await world.page.
|
|
75
|
-
let locator = await world.page.getByRole(role, { name: identifier });
|
|
76
|
-
await test.expect(locator).toBeFocused();
|
|
112
|
+
quickpickle.Then('the url should contain {string}', async function (world, url) {
|
|
113
|
+
await test.expect(world.page.url()).toContain(url);
|
|
77
114
|
});
|
|
78
115
|
//# sourceMappingURL=outcomes.steps.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"outcomes.steps.cjs","sources":["../src/outcomes.steps.ts"],"sourcesContent":[null],"names":["Then","expect"],"mappings":"
|
|
1
|
+
{"version":3,"file":"outcomes.steps.cjs","sources":["../src/outcomes.steps.ts"],"sourcesContent":[null],"names":["Then","expect"],"mappings":";;;;;;;;;;;AAKAA,gBAAI,CAAC,iDAAiD,EAAE,gBAAgB,KAAqB,EAAE,IAAI,EAAA;AACjG,IAAA,MAAMC,WAAM,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,WAAW,EAAE,CAAA;AACxD,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,KAAqB,EAAE,IAAW,EAAA;AAC/F,IAAA,MAAMC,WAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,iBAAiB,CAAC,GAAG,KAAK,CAAC,gBAAgB,CAAC,aAAa,IAAI,IAAI,CAAA,IAAA,CAAM,CAAC,CAAA;AACnG,CAAC,CAAC,CAAA;AAEFD,gBAAI,CAAC,iCAAiC,EAAE,gBAAgB,KAAqB,EAAE,GAAG,EAAA;AAChF,IAAA,MAAMC,WAAM,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,CAAA;AAC/C,CAAC,CAAC;;"}
|
package/dist/outcomes.steps.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import './snapshotMatcher';
|
package/dist/outcomes.steps.mjs
CHANGED
|
@@ -1,39 +1,54 @@
|
|
|
1
1
|
import { Then } from 'quickpickle';
|
|
2
2
|
import { expect } from '@playwright/test';
|
|
3
|
+
import './snapshotMatcher.mjs';
|
|
4
|
+
import 'pngjs';
|
|
5
|
+
import 'node:fs';
|
|
6
|
+
import 'node:path';
|
|
7
|
+
import 'pixelmatch';
|
|
8
|
+
import 'lodash-es';
|
|
3
9
|
|
|
4
|
-
Then('I should see {string}', async function (world, text) {
|
|
5
|
-
await world.page.waitForTimeout(50);
|
|
10
|
+
Then('I should see {string}( somewhere)( on the page)', async function (world, text) {
|
|
6
11
|
await expect(world.page.getByText(text)).toBeVisible();
|
|
7
12
|
});
|
|
8
|
-
Then('I should not see {string}', async function (world, text) {
|
|
9
|
-
await world.page.waitForTimeout(50);
|
|
13
|
+
Then('I should not see {string}( anywhere)( on the page)', async function (world, text) {
|
|
10
14
|
await expect(world.page.getByText(text)).not.toBeVisible();
|
|
11
15
|
});
|
|
16
|
+
Then('I should see a(n)/the {string} with (the )(text ){string}', async function (world, identifier, text) {
|
|
17
|
+
await expect(world.page.locator(identifier).filter({ hasText: text })).toBeVisible();
|
|
18
|
+
});
|
|
19
|
+
Then('I should not see a(n)/the {string} with (the )(text ){string}', async function (world, identifier, text) {
|
|
20
|
+
await expect(world.page.locator(identifier).filter({ hasText: text })).not.toBeVisible();
|
|
21
|
+
});
|
|
22
|
+
Then('I should see a(n)/the {string} {word} with (the )(text ){string}', async function (world, identifier, role, text) {
|
|
23
|
+
let locator;
|
|
24
|
+
if (role === 'element')
|
|
25
|
+
locator = await world.page.locator(identifier).filter({ hasText: text });
|
|
26
|
+
else
|
|
27
|
+
locator = await world.page.getByRole(role, { name: identifier }).filter({ hasText: text });
|
|
28
|
+
await expect(locator).toBeVisible();
|
|
29
|
+
});
|
|
30
|
+
Then('I should not see a(n)/the {string} {word} with (the )(text ){string}', async function (world, identifier, role, text) {
|
|
31
|
+
let locator;
|
|
32
|
+
if (role === 'element')
|
|
33
|
+
locator = await world.page.locator(identifier).filter({ hasText: text });
|
|
34
|
+
else
|
|
35
|
+
locator = await world.page.getByRole(role, { name: identifier }).filter({ hasText: text });
|
|
36
|
+
await expect(locator).not.toBeVisible();
|
|
37
|
+
});
|
|
12
38
|
Then('I should see a(n)/the {string} {word}', async function (world, identifier, role) {
|
|
13
|
-
await world.page.waitForTimeout(50);
|
|
14
39
|
if (role === 'element')
|
|
15
40
|
await expect(world.page.locator(identifier)).toBeVisible();
|
|
16
41
|
else
|
|
17
42
|
await expect(world.page.getByRole(role, { name: identifier })).toBeVisible();
|
|
18
43
|
});
|
|
19
44
|
Then('I should not see a(n)/the {string} {word}', async function (world, identifier, role) {
|
|
20
|
-
await world.page.waitForTimeout(50);
|
|
21
45
|
if (role === 'element')
|
|
22
46
|
await expect(world.page.locator(identifier)).not.toBeVisible();
|
|
23
47
|
else
|
|
24
48
|
await expect(world.page.getByRole(role, { name: identifier })).not.toBeVisible();
|
|
25
49
|
});
|
|
26
|
-
Then('I should see a(n)/the {string} with the text {string}', async function (world, identifier, text) {
|
|
27
|
-
await world.page.waitForTimeout(50);
|
|
28
|
-
await expect(world.page.locator(identifier).filter({ hasText: text })).toBeVisible();
|
|
29
|
-
});
|
|
30
|
-
Then('I should not see a(n)/the {string} with the text {string}', async function (world, identifier, text) {
|
|
31
|
-
await world.page.waitForTimeout(50);
|
|
32
|
-
await expect(world.page.locator(identifier).filter({ hasText: text })).not.toBeVisible();
|
|
33
|
-
});
|
|
34
50
|
Then('the (value of ){string} (value )should contain/include/be/equal {string}', async function (world, identifier, val) {
|
|
35
51
|
let exact = world.info.step?.match(/should not (?:be|equal) ["']/) ? true : false;
|
|
36
|
-
await world.page.waitForTimeout(50);
|
|
37
52
|
let value = await (await world.page.locator(identifier)).inputValue();
|
|
38
53
|
if (exact)
|
|
39
54
|
await expect(value).toEqual(val);
|
|
@@ -42,7 +57,6 @@ Then('the (value of ){string} (value )should contain/include/be/equal {string}',
|
|
|
42
57
|
});
|
|
43
58
|
Then('the (value of ){string} (value )should not contain/include/be/equal {string}', async function (world, identifier, val) {
|
|
44
59
|
let exact = world.info.step?.match(/should not (?:be|equal) ["']/) ? true : false;
|
|
45
|
-
await world.page.waitForTimeout(50);
|
|
46
60
|
let value = await (await world.page.locator(identifier)).inputValue();
|
|
47
61
|
if (exact)
|
|
48
62
|
await expect(value).not.toEqual(val);
|
|
@@ -50,7 +64,6 @@ Then('the (value of ){string} (value )should not contain/include/be/equal {strin
|
|
|
50
64
|
await expect(value).not.toContain(val);
|
|
51
65
|
});
|
|
52
66
|
Then(/^the metatag for "([^"]+)" should (be|equal|contain) "(.*)"$/, async function (world, name, eq, value) {
|
|
53
|
-
await world.page.waitForTimeout(50);
|
|
54
67
|
let val;
|
|
55
68
|
if (name === 'title')
|
|
56
69
|
val = await world.page.title();
|
|
@@ -63,14 +76,38 @@ Then(/^the metatag for "([^"]+)" should (be|equal|contain) "(.*)"$/, async funct
|
|
|
63
76
|
else
|
|
64
77
|
await expect(val).toBe(value);
|
|
65
78
|
});
|
|
66
|
-
Then('the active element should be {string}', async function (world, identifier) {
|
|
67
|
-
await world.page.waitForTimeout(50);
|
|
79
|
+
Then('the active element should be a/an/the {string}', async function (world, identifier) {
|
|
68
80
|
let locator = await world.page.locator(identifier);
|
|
69
|
-
|
|
81
|
+
try {
|
|
82
|
+
await expect(locator).toBeFocused();
|
|
83
|
+
}
|
|
84
|
+
catch (err) {
|
|
85
|
+
throw new Error(`The active element should be ${identifier} but it is not.`);
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
Then('the active element should be a/an/the {string} {word}', async function (world, identifier, role) {
|
|
89
|
+
try {
|
|
90
|
+
let locator;
|
|
91
|
+
if (role === 'element')
|
|
92
|
+
locator = await world.page.getByText(identifier, { exact: true }).or(world.page.locator(identifier));
|
|
93
|
+
else
|
|
94
|
+
locator = await world.page.getByRole(role, { name: identifier });
|
|
95
|
+
await expect(locator).toBeFocused();
|
|
96
|
+
}
|
|
97
|
+
catch (err) {
|
|
98
|
+
throw new Error(`The active element should be ${identifier} but it is not.`);
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
Then('the user agent should contain/be {string}', async function (world, ua) {
|
|
102
|
+
await expect(world.browser.browserType().name()).toContain(ua);
|
|
103
|
+
});
|
|
104
|
+
Then('(the )screenshot should match', async function (world) {
|
|
105
|
+
await expect(world.page).toMatchScreenshot(`${world.playwrightConfig.screenshotDir}/${world.info.rule ? world.info.rule + '__' + world.info.scenario : world.info.scenario}__${world.info.line}.png`);
|
|
106
|
+
});
|
|
107
|
+
Then('(the )screenshot {string} should match', async function (world, name) {
|
|
108
|
+
await expect(world.page).toMatchScreenshot(`${world.playwrightConfig.screenshotDir}/${name}.png`);
|
|
70
109
|
});
|
|
71
|
-
Then('the
|
|
72
|
-
await world.page.
|
|
73
|
-
let locator = await world.page.getByRole(role, { name: identifier });
|
|
74
|
-
await expect(locator).toBeFocused();
|
|
110
|
+
Then('the url should contain {string}', async function (world, url) {
|
|
111
|
+
await expect(world.page.url()).toContain(url);
|
|
75
112
|
});
|
|
76
113
|
//# sourceMappingURL=outcomes.steps.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"outcomes.steps.mjs","sources":["../src/outcomes.steps.ts"],"sourcesContent":[null],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"outcomes.steps.mjs","sources":["../src/outcomes.steps.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;;;AAKA,IAAI,CAAC,iDAAiD,EAAE,gBAAgB,KAAqB,EAAE,IAAI,EAAA;AACjG,IAAA,MAAM,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,WAAW,EAAE,CAAA;AACxD,CAAC,CAAC,CAAA;AACF,IAAI,CAAC,oDAAoD,EAAE,gBAAgB,KAAqB,EAAE,IAAI,EAAA;AACpG,IAAA,MAAM,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,WAAW,EAAE,CAAA;AAC5D,CAAC,CAAC,CAAA;AAEF,IAAI,CAAC,2DAA2D,EAAE,gBAAgB,KAAqB,EAAE,UAAU,EAAE,IAAI,EAAA;IACvH,MAAM,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,CAAA;AACtF,CAAC,CAAC,CAAA;AACF,IAAI,CAAC,+DAA+D,EAAE,gBAAgB,KAAqB,EAAE,UAAU,EAAE,IAAI,EAAA;IAC3H,MAAM,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,WAAW,EAAE,CAAA;AAC1F,CAAC,CAAC,CAAA;AAEF,IAAI,CAAC,kEAAkE,EAAE,gBAAgB,KAAqB,EAAE,UAAU,EAAE,IAAI,EAAE,IAAI,EAAA;AACpI,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AAa,CAAI,CAAA,EAAA,KAAK,CAAC,IAAI,CAAC,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,GAAG,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAK,EAAA,EAAA,KAAK,CAAC,IAAI,CAAC,IAAI,CAAM,IAAA,CAAA,CAAC,CAAA;AACvM,CAAC,CAAC,CAAA;AACF,IAAI,CAAC,wCAAwC,EAAE,gBAAgB,KAAqB,EAAE,IAAW,EAAA;AAC/F,IAAA,MAAM,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,iBAAiB,CAAC,GAAG,KAAK,CAAC,gBAAgB,CAAC,aAAa,IAAI,IAAI,CAAA,IAAA,CAAM,CAAC,CAAA;AACnG,CAAC,CAAC,CAAA;AAEF,IAAI,CAAC,iCAAiC,EAAE,gBAAgB,KAAqB,EAAE,GAAG,EAAA;AAChF,IAAA,MAAM,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,CAAA;AAC/C,CAAC,CAAC"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var test = require('@playwright/test');
|
|
4
|
+
var pngjs = require('pngjs');
|
|
5
|
+
var node_fs = require('node:fs');
|
|
6
|
+
var path = require('node:path');
|
|
7
|
+
var pixelmatch = require('pixelmatch');
|
|
8
|
+
var lodashEs = require('lodash-es');
|
|
9
|
+
|
|
10
|
+
const defaultOptions = {
|
|
11
|
+
// Options for the comparison
|
|
12
|
+
maxDiffPercentage: 0,
|
|
13
|
+
// Options for the screenshot
|
|
14
|
+
fullPage: true,
|
|
15
|
+
omitBackground: false,
|
|
16
|
+
mask: [],
|
|
17
|
+
maskColor: 'rgb(255,255,255)',
|
|
18
|
+
timeout: 5000,
|
|
19
|
+
// Options for pixelmatch
|
|
20
|
+
threshold: 0.1,
|
|
21
|
+
alpha: 0.6,
|
|
22
|
+
};
|
|
23
|
+
async function compareImages(actual, expected, opts) {
|
|
24
|
+
const actualImage = pngjs.PNG.sync.read(actual);
|
|
25
|
+
const expectedImage = pngjs.PNG.sync.read(expected);
|
|
26
|
+
const { width, height } = actualImage;
|
|
27
|
+
const diffImage = new pngjs.PNG({ width, height });
|
|
28
|
+
const mismatchedPixels = pixelmatch(actualImage.data, expectedImage.data, diffImage.data, width, height, opts);
|
|
29
|
+
const totalPixels = width * height;
|
|
30
|
+
const diffPercentage = (mismatchedPixels / totalPixels) * 100;
|
|
31
|
+
const pass = diffPercentage <= opts.maxDiffPercentage;
|
|
32
|
+
return { pass, diffPercentage, image: diffImage };
|
|
33
|
+
}
|
|
34
|
+
async function customToHaveScreenshot(pageOrLocator, snapshotPath, opts) {
|
|
35
|
+
const options = lodashEs.defaultsDeep(opts, defaultOptions);
|
|
36
|
+
const pathparts = snapshotPath.split('/');
|
|
37
|
+
const name = pathparts.pop();
|
|
38
|
+
const screenshotDir = pathparts.join('/');
|
|
39
|
+
const filepath = path.join(screenshotDir, name || '');
|
|
40
|
+
const actualScreenshot = await pageOrLocator.screenshot(options);
|
|
41
|
+
try {
|
|
42
|
+
let expectedScreenshot;
|
|
43
|
+
try {
|
|
44
|
+
expectedScreenshot = await node_fs.promises.readFile(snapshotPath);
|
|
45
|
+
}
|
|
46
|
+
catch (error) {
|
|
47
|
+
// If the snapshot doesn't exist, save the current screenshot and pass the test
|
|
48
|
+
await node_fs.promises.mkdir(screenshotDir, { recursive: true });
|
|
49
|
+
await node_fs.promises.writeFile(snapshotPath, actualScreenshot);
|
|
50
|
+
return {
|
|
51
|
+
pass: true,
|
|
52
|
+
message: () => `Screenshot saved as new snapshot: ${snapshotPath}`,
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
const { pass, diffPercentage, image } = await compareImages(actualScreenshot, expectedScreenshot, options);
|
|
56
|
+
if (!pass) {
|
|
57
|
+
const filepath = path.join(screenshotDir, name || '');
|
|
58
|
+
await node_fs.promises.mkdir(screenshotDir, { recursive: true });
|
|
59
|
+
await node_fs.promises.writeFile(`${filepath}.diff.png`, pngjs.PNG.sync.write(image));
|
|
60
|
+
await node_fs.promises.writeFile(`${filepath}.actual.png`, actualScreenshot);
|
|
61
|
+
return {
|
|
62
|
+
pass: false,
|
|
63
|
+
message: () => `Screenshot does not match the snapshot.\nDiff percentage: ${diffPercentage.toFixed(2)}%\nDiff image saved at: ${filepath}.(diff|actual).png`,
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
return {
|
|
67
|
+
pass: true,
|
|
68
|
+
message: () => `Screenshot matches the snapshot: ${snapshotPath}`,
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
catch (error) {
|
|
72
|
+
await node_fs.promises.mkdir(screenshotDir, { recursive: true });
|
|
73
|
+
await node_fs.promises.writeFile(`${filepath}.actual.png`, actualScreenshot);
|
|
74
|
+
return {
|
|
75
|
+
pass: false,
|
|
76
|
+
message: () => `Failed to compare screenshots: ${error.message}`,
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
// Override the default implementation
|
|
81
|
+
test.expect.extend({
|
|
82
|
+
async toMatchScreenshot(received, nameOrOptions, optOptions) {
|
|
83
|
+
const name = typeof nameOrOptions === 'string' ? nameOrOptions : 'screenshot';
|
|
84
|
+
const options = typeof nameOrOptions === 'object' ? nameOrOptions : optOptions;
|
|
85
|
+
return customToHaveScreenshot.call(this, received, name, options);
|
|
86
|
+
},
|
|
87
|
+
});
|
|
88
|
+
//# sourceMappingURL=snapshotMatcher.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"snapshotMatcher.cjs","sources":["../src/snapshotMatcher.ts"],"sourcesContent":[null],"names":["PNG","defaultsDeep","fs","playwrightExpect"],"mappings":";;;;;;;;;AA4BA,MAAM,cAAc,GAAG;;AAErB,IAAA,iBAAiB,EAAE,CAAC;;AAGpB,IA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
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { Locator } from 'playwright-core';
|
|
2
|
+
import { PixelmatchOptions } from 'pixelmatch';
|
|
3
|
+
export interface ToHaveScreenshotOptions extends PixelmatchOptions {
|
|
4
|
+
maxDiffPercentage?: number;
|
|
5
|
+
clip?: {
|
|
6
|
+
x: number;
|
|
7
|
+
y: number;
|
|
8
|
+
width: number;
|
|
9
|
+
height: number;
|
|
10
|
+
};
|
|
11
|
+
fullPage?: boolean;
|
|
12
|
+
mask?: Array<Locator>;
|
|
13
|
+
maskColor?: string;
|
|
14
|
+
omitBackground?: boolean;
|
|
15
|
+
timeout?: number;
|
|
16
|
+
}
|
|
17
|
+
declare global {
|
|
18
|
+
namespace PlaywrightTest {
|
|
19
|
+
interface Matchers<R> {
|
|
20
|
+
toMatchScreenshot(nameOrOptions?: string | Partial<ToHaveScreenshotOptions>, optOptions?: Partial<ToHaveScreenshotOptions>): Promise<R>;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { expect } from '@playwright/test';
|
|
2
|
+
import { PNG } from 'pngjs';
|
|
3
|
+
import { promises } from 'node:fs';
|
|
4
|
+
import path from 'node:path';
|
|
5
|
+
import pixelmatch from 'pixelmatch';
|
|
6
|
+
import { defaultsDeep } from 'lodash-es';
|
|
7
|
+
|
|
8
|
+
const defaultOptions = {
|
|
9
|
+
// Options for the comparison
|
|
10
|
+
maxDiffPercentage: 0,
|
|
11
|
+
// Options for the screenshot
|
|
12
|
+
fullPage: true,
|
|
13
|
+
omitBackground: false,
|
|
14
|
+
mask: [],
|
|
15
|
+
maskColor: 'rgb(255,255,255)',
|
|
16
|
+
timeout: 5000,
|
|
17
|
+
// Options for pixelmatch
|
|
18
|
+
threshold: 0.1,
|
|
19
|
+
alpha: 0.6,
|
|
20
|
+
};
|
|
21
|
+
async function compareImages(actual, expected, opts) {
|
|
22
|
+
const actualImage = PNG.sync.read(actual);
|
|
23
|
+
const expectedImage = PNG.sync.read(expected);
|
|
24
|
+
const { width, height } = actualImage;
|
|
25
|
+
const diffImage = new PNG({ width, height });
|
|
26
|
+
const mismatchedPixels = pixelmatch(actualImage.data, expectedImage.data, diffImage.data, width, height, opts);
|
|
27
|
+
const totalPixels = width * height;
|
|
28
|
+
const diffPercentage = (mismatchedPixels / totalPixels) * 100;
|
|
29
|
+
const pass = diffPercentage <= opts.maxDiffPercentage;
|
|
30
|
+
return { pass, diffPercentage, image: diffImage };
|
|
31
|
+
}
|
|
32
|
+
async function customToHaveScreenshot(pageOrLocator, snapshotPath, opts) {
|
|
33
|
+
const options = defaultsDeep(opts, defaultOptions);
|
|
34
|
+
const pathparts = snapshotPath.split('/');
|
|
35
|
+
const name = pathparts.pop();
|
|
36
|
+
const screenshotDir = pathparts.join('/');
|
|
37
|
+
const filepath = path.join(screenshotDir, name || '');
|
|
38
|
+
const actualScreenshot = await pageOrLocator.screenshot(options);
|
|
39
|
+
try {
|
|
40
|
+
let expectedScreenshot;
|
|
41
|
+
try {
|
|
42
|
+
expectedScreenshot = await promises.readFile(snapshotPath);
|
|
43
|
+
}
|
|
44
|
+
catch (error) {
|
|
45
|
+
// If the snapshot doesn't exist, save the current screenshot and pass the test
|
|
46
|
+
await promises.mkdir(screenshotDir, { recursive: true });
|
|
47
|
+
await promises.writeFile(snapshotPath, actualScreenshot);
|
|
48
|
+
return {
|
|
49
|
+
pass: true,
|
|
50
|
+
message: () => `Screenshot saved as new snapshot: ${snapshotPath}`,
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
const { pass, diffPercentage, image } = await compareImages(actualScreenshot, expectedScreenshot, options);
|
|
54
|
+
if (!pass) {
|
|
55
|
+
const filepath = path.join(screenshotDir, name || '');
|
|
56
|
+
await promises.mkdir(screenshotDir, { recursive: true });
|
|
57
|
+
await promises.writeFile(`${filepath}.diff.png`, PNG.sync.write(image));
|
|
58
|
+
await promises.writeFile(`${filepath}.actual.png`, actualScreenshot);
|
|
59
|
+
return {
|
|
60
|
+
pass: false,
|
|
61
|
+
message: () => `Screenshot does not match the snapshot.\nDiff percentage: ${diffPercentage.toFixed(2)}%\nDiff image saved at: ${filepath}.(diff|actual).png`,
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
return {
|
|
65
|
+
pass: true,
|
|
66
|
+
message: () => `Screenshot matches the snapshot: ${snapshotPath}`,
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
catch (error) {
|
|
70
|
+
await promises.mkdir(screenshotDir, { recursive: true });
|
|
71
|
+
await promises.writeFile(`${filepath}.actual.png`, actualScreenshot);
|
|
72
|
+
return {
|
|
73
|
+
pass: false,
|
|
74
|
+
message: () => `Failed to compare screenshots: ${error.message}`,
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
// Override the default implementation
|
|
79
|
+
expect.extend({
|
|
80
|
+
async toMatchScreenshot(received, nameOrOptions, optOptions) {
|
|
81
|
+
const name = typeof nameOrOptions === 'string' ? nameOrOptions : 'screenshot';
|
|
82
|
+
const options = typeof nameOrOptions === 'object' ? nameOrOptions : optOptions;
|
|
83
|
+
return customToHaveScreenshot.call(this, received, name, options);
|
|
84
|
+
},
|
|
85
|
+
});
|
|
86
|
+
//# sourceMappingURL=snapshotMatcher.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"snapshotMatcher.mjs","sources":["../src/snapshotMatcher.ts"],"sourcesContent":[null],"names":["fs","playwrightExpect"],"mappings":";;;;;;;AA4BA,MAAM,cAAc,GAAG;;AAErB,IAAA,iBAAiB,EAAE,CAAC;;AAGpB,IAAA,QAAQ,EAAE,IAAI;AACd,IAAA,cAAc,EAAE,KAAK;AACrB,IAAA,IAAI,EAAE,EAAE;AACR,IAAA,SAAS,EAAE,kBAAkB;AAC7B,IAAA,OAAO,EAAE,IAAI;;AAGb,IAAA,SAAS,EAAE,GAAG;AACd,IAAA,KAAK,EAAC,GAAG;CACV,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,0DAAA,EAAA,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC,CAAA,wBAAA,EAA2B,QAAQ,CAAoB,kBAAA,CAAA;aAC7J,CAAC;SACH;QAED,OAAO;AACL,YAAA,IAAI,EAAE,IAAI;AACV,YAAA,OAAO,EAAE,MAAM,CAAA,iCAAA,EAAoC,YAAY,CAAE,CAAA;SAClE,CAAC;KACH;IAAC,OAAO,KAAS,EAAE;AAClB,QAAA,MAAMA,QAAE,CAAC,KAAK,CAAC,aAAa,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QACnD,MAAMA,QAAE,CAAC,SAAS,CAAC,CAAA,EAAG,QAAQ,CAAa,WAAA,CAAA,EAAE,gBAAgB,CAAC,CAAA;QAC9D,OAAO;AACL,YAAA,IAAI,EAAE,KAAK;YACX,OAAO,EAAE,MAAM,kCAAkC,KAAK,CAAC,OAAO,CAAE,CAAA;SACjE,CAAC;KACH;AACH,CAAC;AAWD;AACAC,MAAgB,CAAC,MAAM,CAAC;AACtB,IAAA,MAAM,iBAAiB,CAAC,QAAwB,EAAE,aAAyD,EAAE,UAA6C,EAAA;AACxJ,QAAA,MAAM,IAAI,GAAG,OAAO,aAAa,KAAK,QAAQ,GAAG,aAAa,GAAG,YAAY,CAAC;AAC9E,QAAA,MAAM,OAAO,GAAG,OAAO,aAAa,KAAK,QAAQ,GAAG,aAAa,GAAG,UAAU,CAAC;AAC/E,QAAA,OAAO,sBAAsB,CAAC,IAAI,CAAC,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;KACnE;AACF,CAAA,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quickpickle/playwright",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.5",
|
|
4
4
|
"description": "Support files for running tests with Playwright using QuickPickle (Gherkin in Vitest).",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"BDD",
|
|
@@ -61,16 +61,23 @@
|
|
|
61
61
|
"author": "David Hunt",
|
|
62
62
|
"dependencies": {
|
|
63
63
|
"@playwright/test": "^1.48.0",
|
|
64
|
+
"jest-image-snapshot": "^6.4.0",
|
|
64
65
|
"lodash-es": "^4.17.21",
|
|
66
|
+
"pixelmatch": "^6.0.0",
|
|
65
67
|
"playwright": "^1.48.0",
|
|
66
68
|
"vite": "^5.0.11",
|
|
67
|
-
"quickpickle": "^1.2.
|
|
69
|
+
"quickpickle": "^1.2.3"
|
|
68
70
|
},
|
|
69
71
|
"devDependencies": {
|
|
70
72
|
"@rollup/plugin-replace": "^6.0.1",
|
|
71
73
|
"@rollup/plugin-typescript": "^12.1.0",
|
|
74
|
+
"@types/jest-image-snapshot": "^6.4.0",
|
|
72
75
|
"@types/lodash-es": "^4.17.12",
|
|
76
|
+
"@types/pixelmatch": "^5.2.6",
|
|
77
|
+
"@types/pngjs": "^6.0.5",
|
|
73
78
|
"fast-glob": "^3.3.2",
|
|
79
|
+
"playwright-core": "^1.48.0",
|
|
80
|
+
"pngjs": "^7.0.0",
|
|
74
81
|
"rollup": "^3.20.7",
|
|
75
82
|
"typescript": "^5.6.2",
|
|
76
83
|
"vitest": "^2.1.2"
|