@haibun/web-playwright 3.0.3 → 3.1.0
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/build/PlaywrightEvents.d.ts +2 -1
- package/build/PlaywrightEvents.d.ts.map +1 -1
- package/build/PlaywrightEvents.js +11 -1
- package/build/PlaywrightEvents.js.map +1 -1
- package/build/cycles.d.ts.map +1 -1
- package/build/cycles.js +4 -10
- package/build/cycles.js.map +1 -1
- package/build/domains.d.ts.map +1 -1
- package/build/domains.js +6 -2
- package/build/domains.js.map +1 -1
- package/build/interactionSteps.d.ts +247 -2
- package/build/interactionSteps.d.ts.map +1 -1
- package/build/interactionSteps.js +41 -34
- package/build/interactionSteps.js.map +1 -1
- package/build/monitor/MonitorHandler.d.ts +1 -0
- package/build/monitor/MonitorHandler.d.ts.map +1 -1
- package/build/monitor/MonitorHandler.js +22 -5
- package/build/monitor/MonitorHandler.js.map +1 -1
- package/build/monitor/artifactDisplays/ResolvedFeaturesArtifactDisplay.d.ts.map +1 -1
- package/build/monitor/artifactDisplays/ResolvedFeaturesArtifactDisplay.js +117 -8
- package/build/monitor/artifactDisplays/ResolvedFeaturesArtifactDisplay.js.map +1 -1
- package/build/monitor/artifactDisplays/VideoArtifactDisplay.js +1 -1
- package/build/monitor/artifactDisplays/VideoArtifactDisplay.js.map +1 -1
- package/build/monitor/controls.d.ts.map +1 -1
- package/build/monitor/controls.js +247 -209
- package/build/monitor/controls.js.map +1 -1
- package/build/monitor/graph/generateMermaidGraph.d.ts +9 -2
- package/build/monitor/graph/generateMermaidGraph.d.ts.map +1 -1
- package/build/monitor/graph/generateMermaidGraph.js +249 -54
- package/build/monitor/graph/generateMermaidGraph.js.map +1 -1
- package/build/monitor/graph/graphUtils.d.ts.map +1 -1
- package/build/monitor/graph/graphUtils.js +21 -11
- package/build/monitor/graph/graphUtils.js.map +1 -1
- package/build/monitor/graph/mermaidGraphLinks.d.ts.map +1 -1
- package/build/monitor/graph/mermaidGraphLinks.js +0 -5
- package/build/monitor/graph/mermaidGraphLinks.js.map +1 -1
- package/build/monitor/messages.d.ts +1 -1
- package/build/monitor/messages.d.ts.map +1 -1
- package/build/monitor/messages.js +196 -27
- package/build/monitor/messages.js.map +1 -1
- package/build/monitor/monitor.d.ts +2 -1
- package/build/monitor/monitor.d.ts.map +1 -1
- package/build/monitor/monitor.js +532 -12
- package/build/monitor/monitor.js.map +1 -1
- package/build/rest-playwright.d.ts +62 -60
- package/build/rest-playwright.d.ts.map +1 -1
- package/build/rest-playwright.js +13 -9
- package/build/rest-playwright.js.map +1 -1
- package/build/web-playwright.d.ts +25 -125
- package/build/web-playwright.d.ts.map +1 -1
- package/build/web-playwright.js +34 -6
- package/build/web-playwright.js.map +1 -1
- package/package.json +8 -5
- package/web/monitor.html +0 -3244
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Page } from 'playwright';
|
|
2
2
|
import { TArtifactHTTPTrace } from '@haibun/core/lib/interfaces/logger.js';
|
|
3
3
|
import { TTag } from '@haibun/core/lib/ttag.js';
|
|
4
|
-
import { TWorld } from '@haibun/core/
|
|
4
|
+
import { TWorld } from '@haibun/core/lib/defs.js';
|
|
5
5
|
type TEtc = {
|
|
6
6
|
headers: Record<string, string>;
|
|
7
7
|
method?: string;
|
|
@@ -13,6 +13,7 @@ export declare class PlaywrightEvents {
|
|
|
13
13
|
private world;
|
|
14
14
|
private page;
|
|
15
15
|
private tag;
|
|
16
|
+
navigateCount: number;
|
|
16
17
|
constructor(world: TWorld, page: Page, tag: TTag);
|
|
17
18
|
init(): Promise<this>;
|
|
18
19
|
private logRequest;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PlaywrightEvents.d.ts","sourceRoot":"","sources":["../src/PlaywrightEvents.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAA4B,MAAM,YAAY,CAAC;AAE5D,OAAO,EAAE,kBAAkB,EAA6D,MAAM,uCAAuC,CAAC;AAEtI,OAAO,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAChD,OAAO,
|
|
1
|
+
{"version":3,"file":"PlaywrightEvents.d.ts","sourceRoot":"","sources":["../src/PlaywrightEvents.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAA4B,MAAM,YAAY,CAAC;AAE5D,OAAO,EAAE,kBAAkB,EAA6D,MAAM,uCAAuC,CAAC;AAEtI,OAAO,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAChD,OAAO,EAAU,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAI1D,KAAK,IAAI,GAAG;IACX,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;CACpB,CAAA;AAED,qBAAa,gBAAgB;IAEhB,OAAO,CAAC,KAAK;IAAU,OAAO,CAAC,IAAI;IAAQ,OAAO,CAAC,GAAG;IADlE,aAAa,SAAK;gBACE,KAAK,EAAE,MAAM,EAAU,IAAI,EAAE,IAAI,EAAU,GAAG,EAAE,IAAI;IAElE,IAAI;IASV,OAAO,CAAC,UAAU;YAYJ,YAAY;IAM1B,OAAO,CAAC,WAAW;IAWnB,OAAO,CAAC,cAAc;IAef,KAAK,IAAI,IAAI;IAKpB,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,kBAAkB,CAAC,WAAW,CAAC,EAAE,aAAa,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,IAAI;CAwBlH"}
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { EExecutionMessageType } from '@haibun/core/lib/interfaces/logger.js'; // Updated imports
|
|
2
2
|
import { shortenURI } from '@haibun/core/lib/util/index.js';
|
|
3
|
+
import { Origin } from '@haibun/core/lib/defs.js';
|
|
3
4
|
import { DOMAIN_STRING } from '@haibun/core/lib/domain-types.js';
|
|
5
|
+
import { VISITED_PAGES } from './web-playwright.js';
|
|
4
6
|
export class PlaywrightEvents {
|
|
5
7
|
world;
|
|
6
8
|
page;
|
|
7
9
|
tag;
|
|
10
|
+
navigateCount = 0;
|
|
8
11
|
constructor(world, page, tag) {
|
|
9
12
|
this.world = world;
|
|
10
13
|
this.page = page;
|
|
@@ -46,7 +49,14 @@ export class PlaywrightEvents {
|
|
|
46
49
|
}
|
|
47
50
|
framenavigated(frame) {
|
|
48
51
|
if (frame === this.page.mainFrame()) {
|
|
49
|
-
|
|
52
|
+
const url = frame.url();
|
|
53
|
+
const provenance = { in: 'PlaywrightEvents.framenavigated', seq: [], when: 'framenavigated' };
|
|
54
|
+
this.world.shared.setForStepper('WebPlaywright', { term: 'currentURI', value: url, domain: DOMAIN_STRING, origin: Origin.var }, provenance);
|
|
55
|
+
this.world.shared.setForStepper('WebPlaywright', { term: 'navigateCount', value: this.navigateCount, domain: DOMAIN_STRING, origin: Origin.var }, provenance);
|
|
56
|
+
// Add to Visited pages domain for verification with 'every url in Visited pages is ...'
|
|
57
|
+
const visitedKey = `visited/${this.navigateCount}`;
|
|
58
|
+
this.world.shared.setForStepper('WebPlaywright', { term: visitedKey, value: url, domain: VISITED_PAGES, origin: Origin.var }, provenance);
|
|
59
|
+
this.navigateCount++;
|
|
50
60
|
}
|
|
51
61
|
}
|
|
52
62
|
close() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PlaywrightEvents.js","sourceRoot":"","sources":["../src/PlaywrightEvents.ts"],"names":[],"mappings":"AAEA,OAAO,EAAyC,qBAAqB,EAAmB,MAAM,uCAAuC,CAAC,CAAC,kBAAkB;AACzJ,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;
|
|
1
|
+
{"version":3,"file":"PlaywrightEvents.js","sourceRoot":"","sources":["../src/PlaywrightEvents.ts"],"names":[],"mappings":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,MAAM,QAAQ,GAAG,aAAa,KAAK,cAAc,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,aAAa,CAAC;QAC9E,MAAM,aAAa,GAAG,QAAQ,CAAC,CAAC,CAAC,SAAS,QAAQ,OAAO,cAAc,EAAE,CAAC,CAAC,CAAC,cAAc,CAAC;QAC3F,MAAM,OAAO,GAAsB;YAClC,QAAQ;YACR,cAAc;YACd,aAAa;YACb,GAAG,GAAG;SACN,CAAC;QACF,MAAM,cAAc,GAAG,cAAc,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;QAC9D,MAAM,2BAA2B,GAAG,SAAS,CAAC,OAAO,CAAC,cAAc,EAAE,EAAE,CAAC,CAAC;QAC1E,MAAM,QAAQ,GAAuB;YACpC,SAAS;YACT,KAAK,EAAE,OAAO;YACd,YAAY,EAAE,iBAAiB;SAC/B,CAAA;QACD,MAAM,EAAE,GAAoB;YAC3B,QAAQ,EAAE,qBAAqB,CAAC,KAAK;YACrC,SAAS,EAAE,CAAC,QAAQ,CAAC;YACrB,GAAG,EAAE,IAAI,CAAC,GAAG;SACb,CAAC;QACF,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,cAAc,KAAK,IAAI,UAAU,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,2BAA2B,EAAE,EAAE,EAAE,CAAC,CAAC;IAC1H,CAAC;CACD"}
|
package/build/cycles.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cycles.d.ts","sourceRoot":"","sources":["../src/cycles.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,cAAc,EAA+E,MAAM,0BAA0B,CAAC;AAGvI,OAAO,EAAE,aAAa,EAAoB,MAAM,qBAAqB,CAAC;AAGtE,eAAO,MAAM,MAAM,GAAI,IAAI,aAAa,KAAG,
|
|
1
|
+
{"version":3,"file":"cycles.d.ts","sourceRoot":"","sources":["../src/cycles.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,cAAc,EAA+E,MAAM,0BAA0B,CAAC;AAGvI,OAAO,EAAE,aAAa,EAAoB,MAAM,qBAAqB,CAAC;AAGtE,eAAO,MAAM,MAAM,GAAI,IAAI,aAAa,KAAG,cAkDzC,CAAC"}
|
package/build/cycles.js
CHANGED
|
@@ -20,9 +20,10 @@ export const cycles = (wp) => ({
|
|
|
20
20
|
if (wp.twin) {
|
|
21
21
|
await wp.createTwin();
|
|
22
22
|
}
|
|
23
|
-
await
|
|
23
|
+
await writeFeaturesArtifact(wp, 'features', resolvedFeatures);
|
|
24
24
|
},
|
|
25
25
|
async startFeature({ resolvedFeature, index }) {
|
|
26
|
+
wp.tab = 0;
|
|
26
27
|
if (wp.monitor === EMonitoringTypes.MONITOR_EACH) {
|
|
27
28
|
await wp.callClosers(); // first tab
|
|
28
29
|
await wp.monitorHandler.createMonitorPage(wp);
|
|
@@ -31,7 +32,7 @@ export const cycles = (wp) => ({
|
|
|
31
32
|
if (wp.twinPage) {
|
|
32
33
|
wp.twinPage.updateWorld(wp.getWorld());
|
|
33
34
|
}
|
|
34
|
-
await
|
|
35
|
+
await writeFeaturesArtifact(wp, `feature-${index}`, [resolvedFeature]);
|
|
35
36
|
},
|
|
36
37
|
async endFeature({ shouldClose = true }) {
|
|
37
38
|
// leave web server running if there was a failure and it's the last feature
|
|
@@ -53,19 +54,12 @@ export const cycles = (wp) => ({
|
|
|
53
54
|
}
|
|
54
55
|
},
|
|
55
56
|
});
|
|
56
|
-
async function
|
|
57
|
+
async function writeFeaturesArtifact(wp, type, resolvedFeatures) {
|
|
57
58
|
const loc = await wp.getCaptureDir('json');
|
|
58
59
|
const mediaType = EMediaTypes.json;
|
|
59
60
|
// FIXME shouldn't be fs dependant
|
|
60
61
|
const path = resolve(wp.storage.fromLocation(mediaType, loc, `${type}.json`));
|
|
61
62
|
await wp.storage.writeFile(path, JSON.stringify(resolvedFeatures, null, 2), mediaType);
|
|
62
|
-
const artifact = { artifactType: 'resolvedFeatures', resolvedFeatures, index, path };
|
|
63
|
-
const context = {
|
|
64
|
-
incident: EExecutionMessageType.ACTION,
|
|
65
|
-
artifacts: [artifact],
|
|
66
|
-
tag: wp.getWorld().tag,
|
|
67
|
-
};
|
|
68
|
-
wp.getWorld().logger.info(`resolvedFeatures for ${type}`, context);
|
|
69
63
|
}
|
|
70
64
|
async function closeAfterFeature(wp) {
|
|
71
65
|
for (const file of wp.downloaded) {
|
package/build/cycles.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cycles.js","sourceRoot":"","sources":["../src/cycles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,IAAI,CAAC;AAC5B,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAGrC,OAAO,EAAE,qBAAqB,
|
|
1
|
+
{"version":3,"file":"cycles.js","sourceRoot":"","sources":["../src/cycles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,IAAI,CAAC;AAC5B,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAGrC,OAAO,EAAE,qBAAqB,EAAmC,MAAM,uCAAuC,CAAC;AAC/G,OAAO,EAAE,WAAW,EAAE,MAAM,uCAAuC,CAAC;AACpE,OAAO,EAAiB,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACtE,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAEpD,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,EAAiB,EAAkB,EAAE,CAAC,CAAC;IAC7D,UAAU,EAAE,GAAG,EAAE,CAAC,oBAAoB;IACtC,4DAA4D;IAC5D,KAAK,CAAC,SAAS,CAAC,EAAE,UAAU,EAAgB;QAC3C,IAAI,EAAE,CAAC,EAAE,EAAE,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC;YAC/C,MAAM,EAAE,CA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,IAAI,CAAC,EAAE,CAAC,CAAC;QAC/D,MAAM,CAAC,IAAI,CAAC,CAAC;QACb,EAAE,CAAC,UAAU,GAAG,EAAE,CAAC;IACpB,CAAC;IACD,IAAI,EAAE,CAAC,UAAU,EAAE,CAAC;QACnB,IAAI,EAAE,CAAC,YAAY,EAAE,CAAC;YACrB,MAAM,IAAI,GAAG,MAAM,EAAE,CAAC,OAAO,EAAE,CAAC;YAChC,MAAM,IAAI,GAAG,MAAM,EAAE,CAAC,OAAO,CAAC,eAAe,CAAC,MAAM,IAAI,CAAC,KAAK,EAAE,CAAC,IAAI,EAAE,CAAC,CAAC;YACzE,MAAM,QAAQ,GAAmB,EAAE,YAAY,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;YACjE,MAAM,OAAO,GAAoB;gBAChC,QAAQ,EAAE,qBAAqB,CAAC,WAAW;gBAC3C,SAAS,EAAE,CAAC,QAAQ,CAAC;gBACrB,GAAG,EAAE,EAAE,CAAC,QAAQ,EAAE,CAAC,GAAG;aACtB,CAAC;YACF,EAAE,CAAC,QAAQ,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,eAAe,EAAE,OAAO,CAAC,CAAC;QACpD,CAAC;QACD,4CAA4C;QAC5C,IAAI,EAAE,CAAC,UAAU,EAAE,CAAC;YACnB,MAAM,EAAE,CAAC,EAAE,EAAE,YAAY,CAAC,EAAE,CAAC,QAAQ,EAAE,CAAC,GAAG,CAAC,CAAC;QAC9C,CAAC;QACD,MAAM,EAAE,CAAC,EAAE,EAAE,KAAK,EAAE,CAAC;QACrB,EAAE,CAAC,EAAE,GAAG,SAAS,CAAC;QAClB,EAAE,CAAC,UAAU,GAAG,KAAK,CAAC;IACvB,CAAC;AACF,CAAC"}
|
package/build/domains.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"domains.d.ts","sourceRoot":"","sources":["../src/domains.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"domains.d.ts","sourceRoot":"","sources":["../src/domains.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAG7D,eAAO,MAAM,mBAAmB,iBAAiB,CAAC;AAIlD,eAAO,MAAM,oBAAoB,EAAE,iBAAiB,EAWnD,CAAA"}
|
package/build/domains.js
CHANGED
|
@@ -1,13 +1,17 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
1
2
|
import { DOMAIN_STRING } from "@haibun/core/lib/domain-types.js";
|
|
2
3
|
export const DOMAIN_PAGE_LOCATOR = 'page-locator';
|
|
4
|
+
const locatorSchema = z.string().min(1, 'locator cannot be empty');
|
|
3
5
|
export const WebPlaywrightDomains = [
|
|
4
6
|
{
|
|
5
7
|
selectors: [DOMAIN_PAGE_LOCATOR],
|
|
6
|
-
|
|
8
|
+
schema: locatorSchema,
|
|
9
|
+
description: 'Playwright selector such as css= or text=',
|
|
7
10
|
},
|
|
8
11
|
{
|
|
9
12
|
selectors: [DOMAIN_PAGE_LOCATOR, DOMAIN_STRING],
|
|
10
|
-
|
|
13
|
+
schema: locatorSchema,
|
|
14
|
+
description: 'Locator that also satisfies string semantics.',
|
|
11
15
|
}
|
|
12
16
|
];
|
|
13
17
|
//# sourceMappingURL=domains.js.map
|
package/build/domains.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"domains.js","sourceRoot":"","sources":["../src/domains.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"domains.js","sourceRoot":"","sources":["../src/domains.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AAEjE,MAAM,CAAC,MAAM,mBAAmB,GAAG,cAAc,CAAC;AAElD,MAAM,aAAa,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,yBAAyB,CAAC,CAAC;AAEnE,MAAM,CAAC,MAAM,oBAAoB,GAAwB;IACxD;QACC,SAAS,EAAE,CAAC,mBAAmB,CAAC;QAChC,MAAM,EAAE,aAAa;QACrB,WAAW,EAAE,2CAA2C;KACxD;IACD;QACC,SAAS,EAAE,CAAC,mBAAmB,EAAE,aAAa,CAAC;QAC/C,MAAM,EAAE,aAAa;QACrB,WAAW,EAAE,+CAA+C;KAC5D;CACD,CAAA"}
|
|
@@ -1,4 +1,249 @@
|
|
|
1
|
+
import { TActionResult, TFeatureStep } from "@haibun/core/lib/defs.js";
|
|
1
2
|
import { WebPlaywright } from "./web-playwright.js";
|
|
2
|
-
|
|
3
|
-
|
|
3
|
+
export declare const interactionSteps: (wp: WebPlaywright) => {
|
|
4
|
+
readonly press: {
|
|
5
|
+
readonly gwta: "press {key}";
|
|
6
|
+
readonly action: ({ key }: {
|
|
7
|
+
key: string;
|
|
8
|
+
}) => Promise<import("@haibun/core/lib/defs.js").TOKActionResult>;
|
|
9
|
+
};
|
|
10
|
+
readonly type: {
|
|
11
|
+
readonly gwta: "type {text}";
|
|
12
|
+
readonly action: ({ text }: {
|
|
13
|
+
text: string;
|
|
14
|
+
}) => Promise<import("@haibun/core/lib/defs.js").TOKActionResult>;
|
|
15
|
+
};
|
|
16
|
+
readonly inputVariable: {
|
|
17
|
+
readonly gwta: "input {what} for {field: string | page-locator}";
|
|
18
|
+
readonly action: ({ what, field }: {
|
|
19
|
+
what: string;
|
|
20
|
+
field: string;
|
|
21
|
+
}, featureStep: TFeatureStep) => Promise<import("@haibun/core/lib/defs.js").TOKActionResult>;
|
|
22
|
+
};
|
|
23
|
+
readonly selectionOption: {
|
|
24
|
+
readonly gwta: "select {option} for {field: string | page-locator}";
|
|
25
|
+
readonly action: ({ option, field }: {
|
|
26
|
+
option: string;
|
|
27
|
+
field: string;
|
|
28
|
+
}, featureStep: TFeatureStep) => Promise<import("@haibun/core/lib/defs.js").TOKActionResult>;
|
|
29
|
+
};
|
|
30
|
+
readonly dialogIs: {
|
|
31
|
+
readonly gwta: "dialog {what} {type} says {value}";
|
|
32
|
+
readonly action: ({ what, type, value }: {
|
|
33
|
+
what: string;
|
|
34
|
+
type: string;
|
|
35
|
+
value: string;
|
|
36
|
+
}) => import("@haibun/core/lib/defs.js").TOKActionResult | import("@haibun/core/lib/defs.js").TNotOKActionResult;
|
|
37
|
+
};
|
|
38
|
+
readonly dialogIsUnset: {
|
|
39
|
+
readonly gwta: "dialog {what} {type} not set";
|
|
40
|
+
readonly action: ({ what, type }: {
|
|
41
|
+
what: string;
|
|
42
|
+
type: string;
|
|
43
|
+
}) => import("@haibun/core/lib/defs.js").TOKActionResult | import("@haibun/core/lib/defs.js").TNotOKActionResult;
|
|
44
|
+
};
|
|
45
|
+
readonly shouldSeeTestId: {
|
|
46
|
+
readonly gwta: "has test id {testId}";
|
|
47
|
+
readonly action: ({ testId }: {
|
|
48
|
+
testId: string;
|
|
49
|
+
}) => Promise<import("@haibun/core/lib/defs.js").TOKActionResult | import("@haibun/core/lib/defs.js").TNotOKActionResult>;
|
|
50
|
+
};
|
|
51
|
+
readonly seeText: {
|
|
52
|
+
readonly gwta: "see {text}";
|
|
53
|
+
readonly action: ({ text }: {
|
|
54
|
+
text: string;
|
|
55
|
+
}) => Promise<import("@haibun/core/lib/defs.js").TOKActionResult | import("@haibun/core/lib/defs.js").TNotOKActionResult>;
|
|
56
|
+
};
|
|
57
|
+
readonly waitFor: {
|
|
58
|
+
readonly gwta: "wait for {target: string | page-locator}";
|
|
59
|
+
readonly action: ({ target }: {
|
|
60
|
+
target: string;
|
|
61
|
+
}, featureStep: TFeatureStep) => Promise<import("@haibun/core/lib/defs.js").TOKActionResult | import("@haibun/core/lib/defs.js").TNotOKActionResult>;
|
|
62
|
+
};
|
|
63
|
+
readonly onNewTab: {
|
|
64
|
+
readonly gwta: "on a new tab";
|
|
65
|
+
readonly action: () => import("@haibun/core/lib/defs.js").TOKActionResult;
|
|
66
|
+
};
|
|
67
|
+
readonly currentTabIs: {
|
|
68
|
+
readonly gwta: "current tab is {tab}";
|
|
69
|
+
readonly action: ({ tab }: {
|
|
70
|
+
tab: string;
|
|
71
|
+
}) => Promise<import("@haibun/core/lib/defs.js").TOKActionResult | import("@haibun/core/lib/defs.js").TNotOKActionResult>;
|
|
72
|
+
};
|
|
73
|
+
readonly onTabX: {
|
|
74
|
+
readonly gwta: "on tab {tab}";
|
|
75
|
+
readonly action: ({ tab }: {
|
|
76
|
+
tab: string;
|
|
77
|
+
}) => import("@haibun/core/lib/defs.js").TOKActionResult;
|
|
78
|
+
};
|
|
79
|
+
readonly beOnPage: {
|
|
80
|
+
readonly gwta: "be on the {name} webpage";
|
|
81
|
+
readonly action: ({ name }: {
|
|
82
|
+
name: string;
|
|
83
|
+
}) => Promise<import("@haibun/core/lib/defs.js").TOKActionResult | import("@haibun/core/lib/defs.js").TNotOKActionResult>;
|
|
84
|
+
};
|
|
85
|
+
readonly extensionContext: {
|
|
86
|
+
readonly expose: false;
|
|
87
|
+
readonly gwta: "open extension popup for tab {tab}";
|
|
88
|
+
readonly action: ({ tab }: {
|
|
89
|
+
tab: string;
|
|
90
|
+
}, featureStep: TFeatureStep) => Promise<import("@haibun/core/lib/defs.js").TOKActionResult>;
|
|
91
|
+
};
|
|
92
|
+
readonly cookieIs: {
|
|
93
|
+
readonly gwta: "cookie {name} is {value}";
|
|
94
|
+
readonly action: ({ name, value }: {
|
|
95
|
+
name: string;
|
|
96
|
+
value: string;
|
|
97
|
+
}) => Promise<import("@haibun/core/lib/defs.js").TOKActionResult | import("@haibun/core/lib/defs.js").TNotOKActionResult>;
|
|
98
|
+
};
|
|
99
|
+
readonly URIQueryParameterIs: {
|
|
100
|
+
readonly gwta: "URI query parameter {what} is {value}";
|
|
101
|
+
readonly action: ({ value }: {
|
|
102
|
+
value: string;
|
|
103
|
+
}, featureStep: TFeatureStep) => Promise<import("@haibun/core/lib/defs.js").TOKActionResult | import("@haibun/core/lib/defs.js").TNotOKActionResult>;
|
|
104
|
+
};
|
|
105
|
+
readonly URIStartsWith: {
|
|
106
|
+
readonly gwta: "URI starts with {start}";
|
|
107
|
+
readonly action: ({ start }: {
|
|
108
|
+
start: string;
|
|
109
|
+
}) => Promise<import("@haibun/core/lib/defs.js").TOKActionResult | import("@haibun/core/lib/defs.js").TNotOKActionResult>;
|
|
110
|
+
};
|
|
111
|
+
readonly URIMatches: {
|
|
112
|
+
readonly gwta: "URI(case insensitively)? matches {what}";
|
|
113
|
+
readonly action: ({ what }: {
|
|
114
|
+
what: string;
|
|
115
|
+
}, featureStep: TFeatureStep) => Promise<import("@haibun/core/lib/defs.js").TOKActionResult | import("@haibun/core/lib/defs.js").TNotOKActionResult>;
|
|
116
|
+
};
|
|
117
|
+
readonly click: {
|
|
118
|
+
readonly gwta: "click( invisible)? {target: string | page-locator}( with force)?";
|
|
119
|
+
readonly action: ({ target }: {
|
|
120
|
+
target: string;
|
|
121
|
+
}, featureStep: TFeatureStep) => Promise<import("@haibun/core/lib/defs.js").TOKActionResult>;
|
|
122
|
+
};
|
|
123
|
+
readonly inElement: {
|
|
124
|
+
readonly gwta: "in {container: string | page-locator}, {what: statement}";
|
|
125
|
+
readonly action: ({ container, what }: {
|
|
126
|
+
container: string;
|
|
127
|
+
what: TFeatureStep[];
|
|
128
|
+
}, featureStep: TFeatureStep) => Promise<TActionResult>;
|
|
129
|
+
};
|
|
130
|
+
readonly clickBy: {
|
|
131
|
+
readonly precludes: [`${string}.click`];
|
|
132
|
+
readonly gwta: "click {target: string | page-locator} by {method}";
|
|
133
|
+
readonly handlesUndefined: ["method"];
|
|
134
|
+
readonly action: ({ target }: {
|
|
135
|
+
target: string;
|
|
136
|
+
method: string;
|
|
137
|
+
}, featureStep: TFeatureStep) => Promise<import("@haibun/core/lib/defs.js").TOKActionResult | import("@haibun/core/lib/defs.js").TNotOKActionResult>;
|
|
138
|
+
};
|
|
139
|
+
readonly gotoPage: {
|
|
140
|
+
readonly gwta: "go to the { name } webpage";
|
|
141
|
+
readonly action: ({ name }: {
|
|
142
|
+
name: string;
|
|
143
|
+
}) => Promise<import("@haibun/core/lib/defs.js").TOKActionResult | import("@haibun/core/lib/defs.js").TNotOKActionResult>;
|
|
144
|
+
};
|
|
145
|
+
readonly reloadPage: {
|
|
146
|
+
readonly gwta: "reload page";
|
|
147
|
+
readonly action: () => Promise<import("@haibun/core/lib/defs.js").TOKActionResult>;
|
|
148
|
+
};
|
|
149
|
+
readonly goBack: {
|
|
150
|
+
readonly gwta: "go back";
|
|
151
|
+
readonly action: () => Promise<import("@haibun/core/lib/defs.js").TOKActionResult>;
|
|
152
|
+
};
|
|
153
|
+
readonly blur: {
|
|
154
|
+
readonly gwta: "blur {what: string | page-locator}";
|
|
155
|
+
readonly action: ({ what }: {
|
|
156
|
+
what: string;
|
|
157
|
+
}, featureStep: TFeatureStep) => Promise<import("@haibun/core/lib/defs.js").TOKActionResult>;
|
|
158
|
+
};
|
|
159
|
+
readonly usingBrowserVar: {
|
|
160
|
+
readonly gwta: "using {browser} browser";
|
|
161
|
+
readonly action: ({ browser }: {
|
|
162
|
+
browser: string;
|
|
163
|
+
}) => import("@haibun/core/lib/defs.js").TOKActionResult;
|
|
164
|
+
};
|
|
165
|
+
readonly uploadFile: {
|
|
166
|
+
readonly gwta: "upload file {file} using {selector: string | page-locator}";
|
|
167
|
+
readonly action: ({ file, selector }: {
|
|
168
|
+
file: string;
|
|
169
|
+
selector: string;
|
|
170
|
+
}, featureStep: TFeatureStep) => Promise<import("@haibun/core/lib/defs.js").TOKActionResult>;
|
|
171
|
+
};
|
|
172
|
+
readonly waitForFileChooser: {
|
|
173
|
+
readonly gwta: "upload file {file} with {selector: string | page-locator}";
|
|
174
|
+
readonly action: ({ file, selector }: {
|
|
175
|
+
file: string;
|
|
176
|
+
selector: string;
|
|
177
|
+
}, featureStep: TFeatureStep) => Promise<import("@haibun/core/lib/defs.js").TOKActionResult | import("@haibun/core/lib/defs.js").TNotOKActionResult>;
|
|
178
|
+
};
|
|
179
|
+
readonly expectDownload: {
|
|
180
|
+
readonly gwta: "expect a download";
|
|
181
|
+
readonly action: () => import("@haibun/core/lib/defs.js").TOKActionResult | import("@haibun/core/lib/defs.js").TNotOKActionResult;
|
|
182
|
+
};
|
|
183
|
+
readonly receiveDownload: {
|
|
184
|
+
readonly gwta: "receive download as {file}";
|
|
185
|
+
readonly action: ({ file }: {
|
|
186
|
+
file: string;
|
|
187
|
+
}) => Promise<import("@haibun/core/lib/defs.js").TOKActionResult | import("@haibun/core/lib/defs.js").TNotOKActionResult>;
|
|
188
|
+
};
|
|
189
|
+
readonly waitForDownload: {
|
|
190
|
+
readonly gwta: "save download to {file}";
|
|
191
|
+
readonly action: ({ file }: {
|
|
192
|
+
file: string;
|
|
193
|
+
}) => Promise<import("@haibun/core/lib/defs.js").TOKActionResult | import("@haibun/core/lib/defs.js").TNotOKActionResult>;
|
|
194
|
+
};
|
|
195
|
+
readonly captureDialog: {
|
|
196
|
+
readonly gwta: "accept next dialog to {where}";
|
|
197
|
+
readonly action: ({ where }: {
|
|
198
|
+
where: string;
|
|
199
|
+
}, featureStep: TFeatureStep) => Promise<import("@haibun/core/lib/defs.js").TOKActionResult>;
|
|
200
|
+
};
|
|
201
|
+
readonly canvasIsEmpty: {
|
|
202
|
+
readonly gwta: "canvas {what} is empty";
|
|
203
|
+
readonly action: ({ what }: {
|
|
204
|
+
what: string;
|
|
205
|
+
}) => Promise<import("@haibun/core/lib/defs.js").TOKActionResult | import("@haibun/core/lib/defs.js").TNotOKActionResult>;
|
|
206
|
+
};
|
|
207
|
+
readonly takeScreenshotOf: {
|
|
208
|
+
readonly gwta: "take a screenshot of {what: string | page-locator} to {where}";
|
|
209
|
+
readonly action: ({ what, where }: {
|
|
210
|
+
what: string;
|
|
211
|
+
where: string;
|
|
212
|
+
}, featureStep: TFeatureStep) => Promise<import("@haibun/core/lib/defs.js").TOKActionResult | import("@haibun/core/lib/defs.js").TNotOKActionResult>;
|
|
213
|
+
};
|
|
214
|
+
readonly takeScreenshot: {
|
|
215
|
+
readonly gwta: "take a screenshot";
|
|
216
|
+
readonly action: () => Promise<import("@haibun/core/lib/defs.js").TOKActionResult>;
|
|
217
|
+
};
|
|
218
|
+
readonly getPageContents: {
|
|
219
|
+
readonly gwta: "get page contents";
|
|
220
|
+
readonly action: () => Promise<import("@haibun/core/lib/defs.js").TOKActionResult>;
|
|
221
|
+
};
|
|
222
|
+
readonly takeAccessibilitySnapshot: {
|
|
223
|
+
readonly gwta: "take an accessibility snapshot";
|
|
224
|
+
readonly action: () => Promise<import("@haibun/core/lib/defs.js").TOKActionResult>;
|
|
225
|
+
};
|
|
226
|
+
readonly saveURIQueryParameter: {
|
|
227
|
+
readonly gwta: "save URI query parameter {what} to {where}";
|
|
228
|
+
readonly handlesUndefined: ["what", "where"];
|
|
229
|
+
readonly action: ({}: import("@haibun/core/lib/defs.js").TStepArgs, featureStep: TFeatureStep) => Promise<import("@haibun/core/lib/defs.js").TOKActionResult>;
|
|
230
|
+
};
|
|
231
|
+
readonly resizeWindow: {
|
|
232
|
+
readonly gwta: "resize window to {width}x{height}";
|
|
233
|
+
readonly action: ({ width, height }: {
|
|
234
|
+
width: string;
|
|
235
|
+
height: string;
|
|
236
|
+
}) => Promise<import("@haibun/core/lib/defs.js").TOKActionResult>;
|
|
237
|
+
};
|
|
238
|
+
readonly resizeAvailable: {
|
|
239
|
+
readonly gwta: "resize window to largest dimensions";
|
|
240
|
+
readonly action: () => Promise<import("@haibun/core/lib/defs.js").TOKActionResult>;
|
|
241
|
+
};
|
|
242
|
+
readonly usingTimeout: {
|
|
243
|
+
readonly gwta: "using timeout of {timeout}ms";
|
|
244
|
+
readonly action: ({ timeout }: {
|
|
245
|
+
timeout: string;
|
|
246
|
+
}) => Promise<import("@haibun/core/lib/defs.js").TOKActionResult>;
|
|
247
|
+
};
|
|
248
|
+
};
|
|
4
249
|
//# sourceMappingURL=interactionSteps.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interactionSteps.d.ts","sourceRoot":"","sources":["../src/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ENT, DOMAIN_STRING } from "@haibun/core/lib/domain-types.js";
|
|
3
|
-
import { actionNotOK, sleep } from "@haibun/core/lib/util/index.js";
|
|
3
|
+
import { actionNotOK, sleep, getStepTerm } from "@haibun/core/lib/util/index.js";
|
|
4
4
|
import { DOMAIN_PAGE_LOCATOR } from "./domains.js";
|
|
5
5
|
import { WEB_PAGE, WebPlaywright } from "./web-playwright.js";
|
|
6
6
|
import { BROWSERS } from "./BrowserFactory.js";
|
|
@@ -8,7 +8,7 @@ import { EExecutionMessageType } from "@haibun/core/lib/interfaces/logger.js";
|
|
|
8
8
|
import { actionOK } from "@haibun/core/lib/util/index.js";
|
|
9
9
|
import { pathToFileURL } from 'node:url';
|
|
10
10
|
import { provenanceFromFeatureStep } from "@haibun/core/steps/variables-stepper.js";
|
|
11
|
-
import {
|
|
11
|
+
import { FlowRunner } from "@haibun/core/lib/core/flow-runner.js";
|
|
12
12
|
const DOMAIN_STRING_OR_PAGE_LOCATOR = `${DOMAIN_STRING} | ${DOMAIN_PAGE_LOCATOR}`;
|
|
13
13
|
export const interactionSteps = (wp) => ({
|
|
14
14
|
// INPUT
|
|
@@ -29,16 +29,14 @@ export const interactionSteps = (wp) => ({
|
|
|
29
29
|
inputVariable: {
|
|
30
30
|
gwta: `input {what} for {field: ${DOMAIN_STRING_OR_PAGE_LOCATOR}}`,
|
|
31
31
|
action: async ({ what, field }, featureStep) => {
|
|
32
|
-
|
|
33
|
-
await wp.withPage(async (page) => await locateByDomain(page, featureStep, 'field').fill(what));
|
|
32
|
+
await wp.withPage(async (page) => await wp.locateByDomain(page, featureStep, 'field').fill(what));
|
|
34
33
|
return OK;
|
|
35
34
|
},
|
|
36
35
|
},
|
|
37
36
|
selectionOption: {
|
|
38
37
|
gwta: `select {option} for {field: ${DOMAIN_STRING_OR_PAGE_LOCATOR}}`,
|
|
39
38
|
action: async ({ option, field }, featureStep) => {
|
|
40
|
-
|
|
41
|
-
await wp.withPage(async (page) => await locateByDomain(page, featureStep, 'field').selectOption({ label: option }));
|
|
39
|
+
await wp.withPage(async (page) => await wp.locateByDomain(page, featureStep, 'field').selectOption({ label: option }));
|
|
42
40
|
return OK;
|
|
43
41
|
},
|
|
44
42
|
},
|
|
@@ -71,7 +69,7 @@ export const interactionSteps = (wp) => ({
|
|
|
71
69
|
gwta: `wait for {target: ${DOMAIN_STRING_OR_PAGE_LOCATOR}}`,
|
|
72
70
|
action: async ({ target }, featureStep) => {
|
|
73
71
|
try {
|
|
74
|
-
await wp.withPage(async (page) => await locateByDomain(page, featureStep, 'target').waitFor());
|
|
72
|
+
await wp.withPage(async (page) => await wp.locateByDomain(page, featureStep, 'target').waitFor());
|
|
75
73
|
return OK;
|
|
76
74
|
}
|
|
77
75
|
catch {
|
|
@@ -86,8 +84,8 @@ export const interactionSteps = (wp) => ({
|
|
|
86
84
|
return OK;
|
|
87
85
|
},
|
|
88
86
|
},
|
|
89
|
-
|
|
90
|
-
gwta: `
|
|
87
|
+
currentTabIs: {
|
|
88
|
+
gwta: `current tab is {tab}`,
|
|
91
89
|
action: async ({ tab }) => {
|
|
92
90
|
const waitForTab = parseInt(tab, 10);
|
|
93
91
|
let timedOut = false;
|
|
@@ -137,7 +135,7 @@ export const interactionSteps = (wp) => ({
|
|
|
137
135
|
}
|
|
138
136
|
console.debug('background', background, browserContext.serviceWorkers());
|
|
139
137
|
const extensionId = background.url().split('/')[2];
|
|
140
|
-
wp.getWorld().shared.set({ term: 'extensionContext', value: extensionId, domain: 'string', origin: Origin.
|
|
138
|
+
wp.getWorld().shared.set({ term: 'extensionContext', value: extensionId, domain: 'string', origin: Origin.var }, provenanceFromFeatureStep(featureStep));
|
|
141
139
|
await wp.withPage(async (page) => {
|
|
142
140
|
const popupURI = `chrome-extension://${extensionId}/popup.html?${tab}`;
|
|
143
141
|
return await page.goto(popupURI);
|
|
@@ -156,7 +154,7 @@ export const interactionSteps = (wp) => ({
|
|
|
156
154
|
URIQueryParameterIs: {
|
|
157
155
|
gwta: 'URI query parameter {what} is {value}',
|
|
158
156
|
action: async ({ value }, featureStep) => {
|
|
159
|
-
const
|
|
157
|
+
const term = getStepTerm(featureStep, 'what');
|
|
160
158
|
const uri = await wp.withPage(async (page) => await page.url());
|
|
161
159
|
const found = new URL(uri).searchParams.get(term);
|
|
162
160
|
if (found === value) {
|
|
@@ -183,31 +181,39 @@ export const interactionSteps = (wp) => ({
|
|
|
183
181
|
},
|
|
184
182
|
// CLICK
|
|
185
183
|
click: {
|
|
186
|
-
gwta: `click {target: ${DOMAIN_STRING_OR_PAGE_LOCATOR}}
|
|
184
|
+
gwta: `click( invisible)? {target: ${DOMAIN_STRING_OR_PAGE_LOCATOR}}( with force)?`,
|
|
187
185
|
action: async ({ target }, featureStep) => {
|
|
188
|
-
|
|
186
|
+
const forced = (featureStep.in.match(/ with force$/) || featureStep.in.match(/^click invisible/)) ? { force: true } : {};
|
|
189
187
|
await wp.withPage(async (page) => {
|
|
190
|
-
return await locateByDomain(page, featureStep, 'target').click();
|
|
188
|
+
return await wp.locateByDomain(page, featureStep, 'target').click(forced);
|
|
191
189
|
});
|
|
192
190
|
return OK;
|
|
193
191
|
},
|
|
194
192
|
},
|
|
195
193
|
inElement: {
|
|
196
194
|
gwta: `in {container: ${DOMAIN_STRING_OR_PAGE_LOCATOR}}, {what: ${DOMAIN_STATEMENT}}`,
|
|
197
|
-
action: async ({ what }, featureStep) => {
|
|
195
|
+
action: async ({ container, what }, featureStep) => {
|
|
198
196
|
return await wp.withPage(async (page) => {
|
|
199
|
-
const containerLocator = locateByDomain(page, featureStep, 'container');
|
|
197
|
+
const containerLocator = wp.locateByDomain(page, featureStep, 'container');
|
|
200
198
|
wp.inContainer = containerLocator;
|
|
201
|
-
const
|
|
199
|
+
const runner = new FlowRunner(wp.getWorld(), [wp]);
|
|
200
|
+
const result = await runner.runSteps(what);
|
|
202
201
|
wp.inContainer = undefined;
|
|
203
|
-
|
|
202
|
+
if (result.kind === 'ok') {
|
|
203
|
+
return result.payload;
|
|
204
|
+
}
|
|
205
|
+
else {
|
|
206
|
+
return actionNotOK(result.message);
|
|
207
|
+
}
|
|
204
208
|
});
|
|
205
209
|
},
|
|
206
210
|
},
|
|
207
211
|
clickBy: {
|
|
208
212
|
precludes: [`${wp.constructor.name}.click`],
|
|
209
213
|
gwta: `click {target: ${DOMAIN_STRING_OR_PAGE_LOCATOR}} by {method}`,
|
|
210
|
-
|
|
214
|
+
handlesUndefined: ['method'],
|
|
215
|
+
action: async ({ target }, featureStep) => {
|
|
216
|
+
const method = getStepTerm(featureStep, 'method');
|
|
211
217
|
let withModifier = {};
|
|
212
218
|
const bys = {
|
|
213
219
|
'alt text': (page) => page.getByAltText(target),
|
|
@@ -219,7 +225,7 @@ export const interactionSteps = (wp) => ({
|
|
|
219
225
|
text: (page) => page.getByText(target),
|
|
220
226
|
modifier: (page) => {
|
|
221
227
|
withModifier = JSON.parse(method);
|
|
222
|
-
return locateByDomain(page, featureStep, 'target');
|
|
228
|
+
return wp.locateByDomain(page, featureStep, 'target');
|
|
223
229
|
},
|
|
224
230
|
};
|
|
225
231
|
if (!bys[method]) {
|
|
@@ -266,8 +272,7 @@ export const interactionSteps = (wp) => ({
|
|
|
266
272
|
blur: {
|
|
267
273
|
gwta: `blur {what: ${DOMAIN_STRING_OR_PAGE_LOCATOR}}`,
|
|
268
274
|
action: async ({ what }, featureStep) => {
|
|
269
|
-
|
|
270
|
-
await wp.withPage(async (page) => await locateByDomain(page, featureStep, 'what').evaluate((e) => e.blur()));
|
|
275
|
+
await wp.withPage(async (page) => await wp.locateByDomain(page, featureStep, 'what').evaluate((e) => e.blur()));
|
|
271
276
|
return OK;
|
|
272
277
|
},
|
|
273
278
|
},
|
|
@@ -285,8 +290,7 @@ export const interactionSteps = (wp) => ({
|
|
|
285
290
|
uploadFile: {
|
|
286
291
|
gwta: `upload file {file} using {selector: ${DOMAIN_STRING_OR_PAGE_LOCATOR}}`,
|
|
287
292
|
action: async ({ file, selector }, featureStep) => {
|
|
288
|
-
|
|
289
|
-
await wp.withPage(async (page) => await locateByDomain(page, featureStep, 'selector').setInputFiles(file));
|
|
293
|
+
await wp.withPage(async (page) => await wp.locateByDomain(page, featureStep, 'selector').setInputFiles(file));
|
|
290
294
|
return OK;
|
|
291
295
|
},
|
|
292
296
|
},
|
|
@@ -298,7 +302,7 @@ export const interactionSteps = (wp) => ({
|
|
|
298
302
|
await wp.withPage(async (page) => {
|
|
299
303
|
const [fileChooser] = await Promise.all([
|
|
300
304
|
page.waitForEvent('filechooser'),
|
|
301
|
-
locateByDomain(page, featureStep, 'selector').click()
|
|
305
|
+
wp.locateByDomain(page, featureStep, 'selector').click()
|
|
302
306
|
]);
|
|
303
307
|
await fileChooser.setFiles(file);
|
|
304
308
|
});
|
|
@@ -361,6 +365,11 @@ export const interactionSteps = (wp) => ({
|
|
|
361
365
|
type: dialog.type(),
|
|
362
366
|
};
|
|
363
367
|
await dialog.accept();
|
|
368
|
+
console.log('DEBUG: captureDialog handler triggered', { where, res });
|
|
369
|
+
if (!where) {
|
|
370
|
+
console.error('Error: captureDialog called with empty "where" argument');
|
|
371
|
+
return;
|
|
372
|
+
}
|
|
364
373
|
wp.getWorld().shared.setJSON(where, res, Origin.var, featureStep);
|
|
365
374
|
});
|
|
366
375
|
});
|
|
@@ -398,7 +407,7 @@ export const interactionSteps = (wp) => ({
|
|
|
398
407
|
action: async ({ what, where }, featureStep) => {
|
|
399
408
|
try {
|
|
400
409
|
await wp.withPage(async (page) => {
|
|
401
|
-
const locator = await locateByDomain(page, featureStep, 'what');
|
|
410
|
+
const locator = await wp.locateByDomain(page, featureStep, 'what');
|
|
402
411
|
if (await locator.count() !== 1) {
|
|
403
412
|
throw Error(`no single ${what} from ${locator} `);
|
|
404
413
|
}
|
|
@@ -452,10 +461,13 @@ export const interactionSteps = (wp) => ({
|
|
|
452
461
|
},
|
|
453
462
|
saveURIQueryParameter: {
|
|
454
463
|
gwta: 'save URI query parameter {what} to {where}',
|
|
455
|
-
|
|
464
|
+
handlesUndefined: ['what', 'where'],
|
|
465
|
+
action: async ({}, featureStep) => {
|
|
466
|
+
const what = getStepTerm(featureStep, 'what');
|
|
467
|
+
const where = getStepTerm(featureStep, 'where');
|
|
456
468
|
const uri = await wp.withPage(async (page) => await page.url());
|
|
457
469
|
const found = new URL(uri).searchParams.get(what);
|
|
458
|
-
wp.getWorld().shared.set({ term: where, value: found, domain: 'string', origin: Origin.
|
|
470
|
+
wp.getWorld().shared.set({ term: where, value: found, domain: 'string', origin: Origin.var }, provenanceFromFeatureStep(featureStep));
|
|
459
471
|
return OK;
|
|
460
472
|
},
|
|
461
473
|
},
|
|
@@ -488,9 +500,4 @@ export const interactionSteps = (wp) => ({
|
|
|
488
500
|
},
|
|
489
501
|
}
|
|
490
502
|
});
|
|
491
|
-
function locateByDomain(page, featureStep, where) {
|
|
492
|
-
const value = featureStep.action.stepValuesMap[where].value;
|
|
493
|
-
const located = (featureStep.action.stepValuesMap[where].domain === 'string') ? page.getByText(value, { exact: true }) : page.locator(value);
|
|
494
|
-
return located;
|
|
495
|
-
}
|
|
496
503
|
//# sourceMappingURL=interactionSteps.js.map
|