playwright-cucumber-ts-steps 1.3.0 → 1.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/backend/actions/click.d.ts +84 -0
- package/dist/backend/actions/click.d.ts.map +1 -1
- package/dist/backend/actions/click.js +167 -17
- package/dist/backend/actions/form.d.ts +6 -0
- package/dist/backend/actions/form.d.ts.map +1 -1
- package/dist/backend/actions/form.js +17 -1
- package/dist/backend/actions/formTable.js +1 -1
- package/dist/backend/actions/frames.js +3 -3
- package/dist/backend/actions/index.d.ts +2 -0
- package/dist/backend/actions/index.d.ts.map +1 -1
- package/dist/backend/actions/index.js +2 -0
- package/dist/backend/actions/inputs.js +18 -18
- package/dist/backend/actions/interactions.d.ts +14 -5
- package/dist/backend/actions/interactions.d.ts.map +1 -1
- package/dist/backend/actions/interactions.js +69 -13
- package/dist/backend/actions/keyboard.js +6 -6
- package/dist/backend/actions/misc.d.ts +8 -2
- package/dist/backend/actions/misc.d.ts.map +1 -1
- package/dist/backend/actions/misc.js +64 -16
- package/dist/backend/actions/mobile.js +7 -7
- package/dist/backend/actions/mouse.js +9 -9
- package/dist/backend/actions/navigation.js +5 -5
- package/dist/backend/actions/visual.d.ts +47 -0
- package/dist/backend/actions/visual.d.ts.map +1 -0
- package/dist/backend/actions/visual.js +97 -0
- package/dist/backend/actions/waits.d.ts +6 -0
- package/dist/backend/actions/waits.d.ts.map +1 -1
- package/dist/backend/actions/waits.js +18 -5
- package/dist/backend/api/assertions.js +3 -3
- package/dist/backend/api/mock.js +3 -3
- package/dist/backend/api/network.js +6 -6
- package/dist/backend/api/requests.js +4 -4
- package/dist/backend/assertions/document.d.ts +61 -0
- package/dist/backend/assertions/document.d.ts.map +1 -0
- package/dist/backend/assertions/document.js +166 -0
- package/dist/backend/assertions/elements.d.ts +163 -0
- package/dist/backend/assertions/elements.d.ts.map +1 -0
- package/dist/backend/assertions/elements.js +441 -0
- package/dist/backend/assertions/expectVisible.js +1 -1
- package/dist/backend/assertions/forms.d.ts +43 -0
- package/dist/backend/assertions/forms.d.ts.map +1 -0
- package/dist/backend/assertions/forms.js +126 -0
- package/dist/backend/assertions/index.d.ts +10 -0
- package/dist/backend/assertions/index.d.ts.map +1 -1
- package/dist/backend/assertions/index.js +10 -0
- package/dist/backend/assertions/pageState.js +4 -4
- package/dist/backend/assertions/storage.d.ts +67 -0
- package/dist/backend/assertions/storage.d.ts.map +1 -0
- package/dist/backend/assertions/storage.js +220 -0
- package/dist/backend/assertions/text.d.ts +103 -12
- package/dist/backend/assertions/text.d.ts.map +1 -1
- package/dist/backend/assertions/text.js +207 -28
- package/dist/backend/assertions/visibility.d.ts +18 -0
- package/dist/backend/assertions/visibility.d.ts.map +1 -1
- package/dist/backend/assertions/visibility.js +58 -12
- package/dist/backend/auth/index.js +2 -2
- package/dist/backend/db/steps.d.ts +2 -2
- package/dist/backend/db/steps.d.ts.map +1 -1
- package/dist/backend/db/steps.js +11 -11
- package/dist/backend/elements/alerts.js +3 -3
- package/dist/backend/elements/find.js +26 -24
- package/dist/backend/elements/forms.js +4 -4
- package/dist/backend/elements/frames.js +3 -3
- package/dist/backend/utils/fixtures.js +1 -1
- package/dist/backend/utils/resolver.d.ts +6 -0
- package/dist/backend/utils/resolver.d.ts.map +1 -0
- package/dist/backend/utils/resolver.js +19 -0
- package/dist/component/index.d.ts +3 -0
- package/dist/component/index.d.ts.map +1 -0
- package/dist/component/index.js +6 -0
- package/dist/component/runner.d.ts +18 -0
- package/dist/component/runner.d.ts.map +1 -0
- package/dist/component/runner.js +91 -0
- package/dist/core/runner.d.ts +1 -0
- package/dist/core/runner.d.ts.map +1 -1
- package/dist/core/runner.js +179 -124
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/metadata.json +564 -172
- package/package.json +4 -3
|
@@ -16,9 +16,19 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
//src/backend/assertions/index.ts
|
|
18
18
|
__exportStar(require("./visibility"), exports);
|
|
19
|
+
__exportStar(require("./expectVisible"), exports);
|
|
19
20
|
__exportStar(require("./text"), exports);
|
|
20
21
|
__exportStar(require("./pageState"), exports);
|
|
22
|
+
__exportStar(require("./document"), exports);
|
|
23
|
+
__exportStar(require("./storage"), exports);
|
|
24
|
+
__exportStar(require("./elements"), exports);
|
|
25
|
+
__exportStar(require("./forms"), exports);
|
|
21
26
|
// Import all side-effect modules (steps registration)
|
|
22
27
|
require("./visibility");
|
|
28
|
+
require("./expectVisible");
|
|
23
29
|
require("./text");
|
|
24
30
|
require("./pageState");
|
|
31
|
+
require("./document");
|
|
32
|
+
require("./storage");
|
|
33
|
+
require("./elements");
|
|
34
|
+
require("./forms");
|
|
@@ -58,7 +58,7 @@ async function expectTitleToBe(page, titleKey) {
|
|
|
58
58
|
// ==================================================
|
|
59
59
|
// GLUE STEPS
|
|
60
60
|
// ==================================================
|
|
61
|
-
(0, registry_1.Step)("I expect the url to contain {string}", expectUrlToContain, "Then");
|
|
62
|
-
(0, registry_1.Step)("I expect the url to be {string}", expectUrlToBe, "Then");
|
|
63
|
-
(0, registry_1.Step)("I expect the title to contain {string}", expectTitleToContain, "Then");
|
|
64
|
-
(0, registry_1.Step)("I expect the title to be {string}", expectTitleToBe, "Then");
|
|
61
|
+
(0, registry_1.Step)("I pw expect the url to contain {string}", expectUrlToContain, "Then");
|
|
62
|
+
(0, registry_1.Step)("I pw expect the url to be {string}", expectUrlToBe, "Then");
|
|
63
|
+
(0, registry_1.Step)("I pw expect the title to contain {string}", expectTitleToContain, "Then");
|
|
64
|
+
(0, registry_1.Step)("I pw expect the title to be {string}", expectTitleToBe, "Then");
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Asserts that a cookie exists and has the expected value.
|
|
3
|
+
* Supports fixtures for reusable cookie names and values.
|
|
4
|
+
* @example Then I see cookie "session_id" has value "abc123"
|
|
5
|
+
*/
|
|
6
|
+
export declare function expectCookieHasValue(page: any, cookieNameKey: string, valueKey: string): Promise<void>;
|
|
7
|
+
/**
|
|
8
|
+
* Asserts that a cookie exists and contains the expected substring.
|
|
9
|
+
* Supports fixtures for reusable cookie names and values.
|
|
10
|
+
* @example Then I see cookie "session_id" contains value "abc"
|
|
11
|
+
*/
|
|
12
|
+
export declare function expectCookieContainsValue(page: any, cookieNameKey: string, valueKey: string): Promise<void>;
|
|
13
|
+
/**
|
|
14
|
+
* Asserts that a cookie does not exist.
|
|
15
|
+
* Supports fixtures for reusable cookie names.
|
|
16
|
+
* @example Then I do not see cookie "old_session"
|
|
17
|
+
*/
|
|
18
|
+
export declare function expectCookieDoesNotExist(page: any, cookieNameKey: string): Promise<void>;
|
|
19
|
+
/**
|
|
20
|
+
* Asserts that a local storage item exists and has the expected value.
|
|
21
|
+
* Supports fixtures for reusable storage keys and values.
|
|
22
|
+
* @example Then I see local storage item "user_prefs" equals "dark_theme"
|
|
23
|
+
*/
|
|
24
|
+
export declare function expectLocalStorageItemEquals(page: any, keyKey: string, valueKey: string): Promise<void>;
|
|
25
|
+
/**
|
|
26
|
+
* Asserts that a local storage item exists and contains the expected substring.
|
|
27
|
+
* Supports fixtures for reusable storage keys and values.
|
|
28
|
+
* @example Then I see local storage item "user_prefs" contains "theme"
|
|
29
|
+
*/
|
|
30
|
+
export declare function expectLocalStorageItemContains(page: any, keyKey: string, valueKey: string): Promise<void>;
|
|
31
|
+
/**
|
|
32
|
+
* Asserts that a local storage item exists.
|
|
33
|
+
* Supports fixtures for reusable storage keys.
|
|
34
|
+
* @example Then I see local storage item "user_id"
|
|
35
|
+
*/
|
|
36
|
+
export declare function expectLocalStorageItem(page: any, keyKey: string): Promise<void>;
|
|
37
|
+
/**
|
|
38
|
+
* Asserts that a local storage item does not exist.
|
|
39
|
+
* Supports fixtures for reusable storage keys.
|
|
40
|
+
* @example Then I do not see local storage item "old_data"
|
|
41
|
+
*/
|
|
42
|
+
export declare function expectLocalStorageItemDoesNotExist(page: any, keyKey: string): Promise<void>;
|
|
43
|
+
/**
|
|
44
|
+
* Asserts that a session storage item exists and has the expected value.
|
|
45
|
+
* Supports fixtures for reusable storage keys and values.
|
|
46
|
+
* @example Then I see session storage item "temp_data" equals "abc123"
|
|
47
|
+
*/
|
|
48
|
+
export declare function expectSessionStorageItemEquals(page: any, keyKey: string, valueKey: string): Promise<void>;
|
|
49
|
+
/**
|
|
50
|
+
* Asserts that a session storage item exists and contains the expected substring.
|
|
51
|
+
* Supports fixtures for reusable storage keys and values.
|
|
52
|
+
* @example Then I see session storage item "temp_data" contains "abc"
|
|
53
|
+
*/
|
|
54
|
+
export declare function expectSessionStorageItemContains(page: any, keyKey: string, valueKey: string): Promise<void>;
|
|
55
|
+
/**
|
|
56
|
+
* Asserts that a session storage item exists.
|
|
57
|
+
* Supports fixtures for reusable storage keys.
|
|
58
|
+
* @example Then I see session storage item "temp_token"
|
|
59
|
+
*/
|
|
60
|
+
export declare function expectSessionStorageItem(page: any, keyKey: string): Promise<void>;
|
|
61
|
+
/**
|
|
62
|
+
* Asserts that a session storage item does not exist.
|
|
63
|
+
* Supports fixtures for reusable storage keys.
|
|
64
|
+
* @example Then I do not see session storage item "expired_token"
|
|
65
|
+
*/
|
|
66
|
+
export declare function expectSessionStorageItemDoesNotExist(page: any, keyKey: string): Promise<void>;
|
|
67
|
+
//# sourceMappingURL=storage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../../../src/backend/assertions/storage.ts"],"names":[],"mappings":"AAWA;;;;GAIG;AACH,wBAAsB,oBAAoB,CACxC,IAAI,EAAE,GAAG,EACT,aAAa,EAAE,MAAM,EACrB,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,IAAI,CAAC,CAmBf;AAED;;;;GAIG;AACH,wBAAsB,yBAAyB,CAC7C,IAAI,EAAE,GAAG,EACT,aAAa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AC,CAWf"}
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.expectCookieHasValue = expectCookieHasValue;
|
|
4
|
+
exports.expectCookieContainsValue = expectCookieContainsValue;
|
|
5
|
+
exports.expectCookieDoesNotExist = expectCookieDoesNotExist;
|
|
6
|
+
exports.expectLocalStorageItemEquals = expectLocalStorageItemEquals;
|
|
7
|
+
exports.expectLocalStorageItemContains = expectLocalStorageItemContains;
|
|
8
|
+
exports.expectLocalStorageItem = expectLocalStorageItem;
|
|
9
|
+
exports.expectLocalStorageItemDoesNotExist = expectLocalStorageItemDoesNotExist;
|
|
10
|
+
exports.expectSessionStorageItemEquals = expectSessionStorageItemEquals;
|
|
11
|
+
exports.expectSessionStorageItemContains = expectSessionStorageItemContains;
|
|
12
|
+
exports.expectSessionStorageItem = expectSessionStorageItem;
|
|
13
|
+
exports.expectSessionStorageItemDoesNotExist = expectSessionStorageItemDoesNotExist;
|
|
14
|
+
//src/backend/assertions/storage.ts
|
|
15
|
+
const registry_1 = require("../../core/registry");
|
|
16
|
+
const fixtures_1 = require("../utils/fixtures");
|
|
17
|
+
// ==================================================
|
|
18
|
+
// CORE FUNCTIONS
|
|
19
|
+
// ==================================================
|
|
20
|
+
/**
|
|
21
|
+
* Asserts that a cookie exists and has the expected value.
|
|
22
|
+
* Supports fixtures for reusable cookie names and values.
|
|
23
|
+
* @example Then I see cookie "session_id" has value "abc123"
|
|
24
|
+
*/
|
|
25
|
+
async function expectCookieHasValue(page, cookieNameKey, valueKey) {
|
|
26
|
+
const cookies = (0, fixtures_1.loadFixture)("cookies.json");
|
|
27
|
+
const values = (0, fixtures_1.loadFixture)("values.json");
|
|
28
|
+
const cookieName = (0, fixtures_1.getFixtureValue)(cookies, cookieNameKey);
|
|
29
|
+
const expectedValue = (0, fixtures_1.getFixtureValue)(values, valueKey);
|
|
30
|
+
const cookie = await page.context().cookies([page.url()]);
|
|
31
|
+
const foundCookie = cookie.find((c) => c.name === cookieName);
|
|
32
|
+
if (!foundCookie) {
|
|
33
|
+
throw new Error(`Cookie "${cookieName}" does not exist`);
|
|
34
|
+
}
|
|
35
|
+
if (foundCookie.value !== expectedValue) {
|
|
36
|
+
throw new Error(`Cookie "${cookieName}" has value "${foundCookie.value}", expected "${expectedValue}"`);
|
|
37
|
+
}
|
|
38
|
+
console.log(`✅ Cookie "${cookieName}" has value "${expectedValue}"`);
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Asserts that a cookie exists and contains the expected substring.
|
|
42
|
+
* Supports fixtures for reusable cookie names and values.
|
|
43
|
+
* @example Then I see cookie "session_id" contains value "abc"
|
|
44
|
+
*/
|
|
45
|
+
async function expectCookieContainsValue(page, cookieNameKey, valueKey) {
|
|
46
|
+
const cookies = (0, fixtures_1.loadFixture)("cookies.json");
|
|
47
|
+
const values = (0, fixtures_1.loadFixture)("values.json");
|
|
48
|
+
const cookieName = (0, fixtures_1.getFixtureValue)(cookies, cookieNameKey);
|
|
49
|
+
const expectedValue = (0, fixtures_1.getFixtureValue)(values, valueKey);
|
|
50
|
+
const cookie = await page.context().cookies([page.url()]);
|
|
51
|
+
const foundCookie = cookie.find((c) => c.name === cookieName);
|
|
52
|
+
if (!foundCookie) {
|
|
53
|
+
throw new Error(`Cookie "${cookieName}" does not exist`);
|
|
54
|
+
}
|
|
55
|
+
if (!foundCookie.value.includes(expectedValue)) {
|
|
56
|
+
throw new Error(`Cookie "${cookieName}" value "${foundCookie.value}" does not contain "${expectedValue}"`);
|
|
57
|
+
}
|
|
58
|
+
console.log(`✅ Cookie "${cookieName}" contains value "${expectedValue}"`);
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Asserts that a cookie does not exist.
|
|
62
|
+
* Supports fixtures for reusable cookie names.
|
|
63
|
+
* @example Then I do not see cookie "old_session"
|
|
64
|
+
*/
|
|
65
|
+
async function expectCookieDoesNotExist(page, cookieNameKey) {
|
|
66
|
+
const cookies = (0, fixtures_1.loadFixture)("cookies.json");
|
|
67
|
+
const cookieName = (0, fixtures_1.getFixtureValue)(cookies, cookieNameKey);
|
|
68
|
+
const cookie = await page.context().cookies([page.url()]);
|
|
69
|
+
const foundCookie = cookie.find((c) => c.name === cookieName);
|
|
70
|
+
if (foundCookie) {
|
|
71
|
+
throw new Error(`Cookie "${cookieName}" exists but was expected not to`);
|
|
72
|
+
}
|
|
73
|
+
console.log(`✅ Cookie "${cookieName}" does not exist`);
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Asserts that a local storage item exists and has the expected value.
|
|
77
|
+
* Supports fixtures for reusable storage keys and values.
|
|
78
|
+
* @example Then I see local storage item "user_prefs" equals "dark_theme"
|
|
79
|
+
*/
|
|
80
|
+
async function expectLocalStorageItemEquals(page, keyKey, valueKey) {
|
|
81
|
+
const keys = (0, fixtures_1.loadFixture)("keys.json");
|
|
82
|
+
const values = (0, fixtures_1.loadFixture)("values.json");
|
|
83
|
+
const storageKey = (0, fixtures_1.getFixtureValue)(keys, keyKey);
|
|
84
|
+
const expectedValue = (0, fixtures_1.getFixtureValue)(values, valueKey);
|
|
85
|
+
const actualValue = await page.evaluate((key) => localStorage.getItem(key), storageKey);
|
|
86
|
+
if (actualValue === null) {
|
|
87
|
+
throw new Error(`Local storage item "${storageKey}" does not exist`);
|
|
88
|
+
}
|
|
89
|
+
if (actualValue !== expectedValue) {
|
|
90
|
+
throw new Error(`Local storage item "${storageKey}" has value "${actualValue}", expected "${expectedValue}"`);
|
|
91
|
+
}
|
|
92
|
+
console.log(`✅ Local storage item "${storageKey}" equals "${expectedValue}"`);
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Asserts that a local storage item exists and contains the expected substring.
|
|
96
|
+
* Supports fixtures for reusable storage keys and values.
|
|
97
|
+
* @example Then I see local storage item "user_prefs" contains "theme"
|
|
98
|
+
*/
|
|
99
|
+
async function expectLocalStorageItemContains(page, keyKey, valueKey) {
|
|
100
|
+
const keys = (0, fixtures_1.loadFixture)("keys.json");
|
|
101
|
+
const values = (0, fixtures_1.loadFixture)("values.json");
|
|
102
|
+
const storageKey = (0, fixtures_1.getFixtureValue)(keys, keyKey);
|
|
103
|
+
const expectedValue = (0, fixtures_1.getFixtureValue)(values, valueKey);
|
|
104
|
+
const actualValue = await page.evaluate((key) => localStorage.getItem(key), storageKey);
|
|
105
|
+
if (actualValue === null) {
|
|
106
|
+
throw new Error(`Local storage item "${storageKey}" does not exist`);
|
|
107
|
+
}
|
|
108
|
+
if (!actualValue.includes(expectedValue)) {
|
|
109
|
+
throw new Error(`Local storage item "${storageKey}" value "${actualValue}" does not contain "${expectedValue}"`);
|
|
110
|
+
}
|
|
111
|
+
console.log(`✅ Local storage item "${storageKey}" contains "${expectedValue}"`);
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Asserts that a local storage item exists.
|
|
115
|
+
* Supports fixtures for reusable storage keys.
|
|
116
|
+
* @example Then I see local storage item "user_id"
|
|
117
|
+
*/
|
|
118
|
+
async function expectLocalStorageItem(page, keyKey) {
|
|
119
|
+
const keys = (0, fixtures_1.loadFixture)("keys.json");
|
|
120
|
+
const storageKey = (0, fixtures_1.getFixtureValue)(keys, keyKey);
|
|
121
|
+
const actualValue = await page.evaluate((key) => localStorage.getItem(key), storageKey);
|
|
122
|
+
if (actualValue === null) {
|
|
123
|
+
throw new Error(`Local storage item "${storageKey}" does not exist`);
|
|
124
|
+
}
|
|
125
|
+
console.log(`✅ Local storage item "${storageKey}" exists with value "${actualValue}"`);
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Asserts that a local storage item does not exist.
|
|
129
|
+
* Supports fixtures for reusable storage keys.
|
|
130
|
+
* @example Then I do not see local storage item "old_data"
|
|
131
|
+
*/
|
|
132
|
+
async function expectLocalStorageItemDoesNotExist(page, keyKey) {
|
|
133
|
+
const keys = (0, fixtures_1.loadFixture)("keys.json");
|
|
134
|
+
const storageKey = (0, fixtures_1.getFixtureValue)(keys, keyKey);
|
|
135
|
+
const actualValue = await page.evaluate((key) => localStorage.getItem(key), storageKey);
|
|
136
|
+
if (actualValue !== null) {
|
|
137
|
+
throw new Error(`Local storage item "${storageKey}" exists but was expected not to`);
|
|
138
|
+
}
|
|
139
|
+
console.log(`✅ Local storage item "${storageKey}" does not exist`);
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Asserts that a session storage item exists and has the expected value.
|
|
143
|
+
* Supports fixtures for reusable storage keys and values.
|
|
144
|
+
* @example Then I see session storage item "temp_data" equals "abc123"
|
|
145
|
+
*/
|
|
146
|
+
async function expectSessionStorageItemEquals(page, keyKey, valueKey) {
|
|
147
|
+
const keys = (0, fixtures_1.loadFixture)("keys.json");
|
|
148
|
+
const values = (0, fixtures_1.loadFixture)("values.json");
|
|
149
|
+
const storageKey = (0, fixtures_1.getFixtureValue)(keys, keyKey);
|
|
150
|
+
const expectedValue = (0, fixtures_1.getFixtureValue)(values, valueKey);
|
|
151
|
+
const actualValue = await page.evaluate((key) => sessionStorage.getItem(key), storageKey);
|
|
152
|
+
if (actualValue === null) {
|
|
153
|
+
throw new Error(`Session storage item "${storageKey}" does not exist`);
|
|
154
|
+
}
|
|
155
|
+
if (actualValue !== expectedValue) {
|
|
156
|
+
throw new Error(`Session storage item "${storageKey}" has value "${actualValue}", expected "${expectedValue}"`);
|
|
157
|
+
}
|
|
158
|
+
console.log(`✅ Session storage item "${storageKey}" equals "${expectedValue}"`);
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Asserts that a session storage item exists and contains the expected substring.
|
|
162
|
+
* Supports fixtures for reusable storage keys and values.
|
|
163
|
+
* @example Then I see session storage item "temp_data" contains "abc"
|
|
164
|
+
*/
|
|
165
|
+
async function expectSessionStorageItemContains(page, keyKey, valueKey) {
|
|
166
|
+
const keys = (0, fixtures_1.loadFixture)("keys.json");
|
|
167
|
+
const values = (0, fixtures_1.loadFixture)("values.json");
|
|
168
|
+
const storageKey = (0, fixtures_1.getFixtureValue)(keys, keyKey);
|
|
169
|
+
const expectedValue = (0, fixtures_1.getFixtureValue)(values, valueKey);
|
|
170
|
+
const actualValue = await page.evaluate((key) => sessionStorage.getItem(key), storageKey);
|
|
171
|
+
if (actualValue === null) {
|
|
172
|
+
throw new Error(`Session storage item "${storageKey}" does not exist`);
|
|
173
|
+
}
|
|
174
|
+
if (!actualValue.includes(expectedValue)) {
|
|
175
|
+
throw new Error(`Session storage item "${storageKey}" value "${actualValue}" does not contain "${expectedValue}"`);
|
|
176
|
+
}
|
|
177
|
+
console.log(`✅ Session storage item "${storageKey}" contains "${expectedValue}"`);
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Asserts that a session storage item exists.
|
|
181
|
+
* Supports fixtures for reusable storage keys.
|
|
182
|
+
* @example Then I see session storage item "temp_token"
|
|
183
|
+
*/
|
|
184
|
+
async function expectSessionStorageItem(page, keyKey) {
|
|
185
|
+
const keys = (0, fixtures_1.loadFixture)("keys.json");
|
|
186
|
+
const storageKey = (0, fixtures_1.getFixtureValue)(keys, keyKey);
|
|
187
|
+
const actualValue = await page.evaluate((key) => sessionStorage.getItem(key), storageKey);
|
|
188
|
+
if (actualValue === null) {
|
|
189
|
+
throw new Error(`Session storage item "${storageKey}" does not exist`);
|
|
190
|
+
}
|
|
191
|
+
console.log(`✅ Session storage item "${storageKey}" exists with value "${actualValue}"`);
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Asserts that a session storage item does not exist.
|
|
195
|
+
* Supports fixtures for reusable storage keys.
|
|
196
|
+
* @example Then I do not see session storage item "expired_token"
|
|
197
|
+
*/
|
|
198
|
+
async function expectSessionStorageItemDoesNotExist(page, keyKey) {
|
|
199
|
+
const keys = (0, fixtures_1.loadFixture)("keys.json");
|
|
200
|
+
const storageKey = (0, fixtures_1.getFixtureValue)(keys, keyKey);
|
|
201
|
+
const actualValue = await page.evaluate((key) => sessionStorage.getItem(key), storageKey);
|
|
202
|
+
if (actualValue !== null) {
|
|
203
|
+
throw new Error(`Session storage item "${storageKey}" exists but was expected not to`);
|
|
204
|
+
}
|
|
205
|
+
console.log(`✅ Session storage item "${storageKey}" does not exist`);
|
|
206
|
+
}
|
|
207
|
+
// ==================================================
|
|
208
|
+
// GLUE STEPS
|
|
209
|
+
// ==================================================
|
|
210
|
+
(0, registry_1.Step)("I pw see cookie {string} has value {string}", expectCookieHasValue, "Then");
|
|
211
|
+
(0, registry_1.Step)("I pw see cookie {string} contains value {string}", expectCookieContainsValue, "Then");
|
|
212
|
+
(0, registry_1.Step)("I pw do not see cookie {string}", expectCookieDoesNotExist, "Then");
|
|
213
|
+
(0, registry_1.Step)("I pw see local storage item {string} equals {string}", expectLocalStorageItemEquals, "Then");
|
|
214
|
+
(0, registry_1.Step)("I pw see local storage item {string} contains {string}", expectLocalStorageItemContains, "Then");
|
|
215
|
+
(0, registry_1.Step)("I pw see local storage item {string}", expectLocalStorageItem, "Then");
|
|
216
|
+
(0, registry_1.Step)("I pw do not see local storage item {string}", expectLocalStorageItemDoesNotExist, "Then");
|
|
217
|
+
(0, registry_1.Step)("I pw see session storage item {string} equals {string}", expectSessionStorageItemEquals, "Then");
|
|
218
|
+
(0, registry_1.Step)("I pw see session storage item {string} contains {string}", expectSessionStorageItemContains, "Then");
|
|
219
|
+
(0, registry_1.Step)("I pw see session storage item {string}", expectSessionStorageItem, "Then");
|
|
220
|
+
(0, registry_1.Step)("I pw do not see session storage item {string}", expectSessionStorageItemDoesNotExist, "Then");
|
|
@@ -1,25 +1,116 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Asserts that an element exactly matches the specified text.
|
|
2
|
+
* Asserts that an element exactly matches the specified text (case-sensitive).
|
|
3
3
|
* Supports fixtures for reusable selectors and text values.
|
|
4
|
-
* @
|
|
4
|
+
* @param page - The Playwright page object
|
|
5
|
+
* @param selectorKey - The selector key (can be a fixture key or raw CSS selector)
|
|
6
|
+
* @param textKey - The text key (can be a fixture key or raw text)
|
|
7
|
+
* @example Then I see exact element text "Welcome Home"
|
|
5
8
|
*/
|
|
6
|
-
export declare function
|
|
9
|
+
export declare function expectElementToHaveExactText(page: any, selectorKey: string, textKey: string): Promise<void>;
|
|
7
10
|
/**
|
|
8
|
-
* Asserts that an element contains the specified substring.
|
|
11
|
+
* Asserts that an element contains the specified substring (case-sensitive).
|
|
9
12
|
* Supports fixtures for reusable selectors and text values.
|
|
10
|
-
* @
|
|
13
|
+
* @param page - The Playwright page object
|
|
14
|
+
* @param textKey - The text key (can be a fixture key or raw text)
|
|
15
|
+
* @example Then I see text "Welcome" (will match "Welcome Home" or "Welcome!")
|
|
16
|
+
*
|
|
17
|
+
* Global Visibility Check: Finds text anywhere on the page without needing a selector.
|
|
11
18
|
*/
|
|
12
|
-
export declare function
|
|
19
|
+
export declare function expectGlobalTextVisible(page: any, textKey: string): Promise<void>;
|
|
13
20
|
/**
|
|
14
|
-
* Asserts that
|
|
21
|
+
* Asserts that an element does NOT contain the specified substring.
|
|
22
|
+
* Supports fixtures for reusable selectors and text values.
|
|
23
|
+
* @param page - The Playwright page object
|
|
24
|
+
* @param textKey - The text key (can be a fixture key or raw text)
|
|
25
|
+
* @example Then I do not see text "error"
|
|
26
|
+
*/
|
|
27
|
+
export declare function expectGlobalTextNotVisible(page: any, textKey: string): Promise<void>;
|
|
28
|
+
/**
|
|
29
|
+
* Asserts that a form field (input, textarea, select) has a specific value (exact match).
|
|
15
30
|
* Supports fixtures for reusable selectors and values.
|
|
16
|
-
* @
|
|
31
|
+
* @param page - The Playwright page object
|
|
32
|
+
* @param selectorKey - The selector key (can be a fixture key or raw CSS selector)
|
|
33
|
+
* @param valueKey - The value key (can be a fixture key or raw value)
|
|
34
|
+
* @example Then I see exact value "john_doe"
|
|
35
|
+
*/
|
|
36
|
+
export declare function expectElementToHaveExactValue(page: any, selectorKey: string, valueKey: string): Promise<void>;
|
|
37
|
+
/**
|
|
38
|
+
* Asserts that a form field (input, textarea, select) does NOT have a specific value.
|
|
39
|
+
* Supports fixtures for reusable selectors and values.
|
|
40
|
+
* @param page - The Playwright page object
|
|
41
|
+
* @param selectorKey - The selector key (can be a fixture key or raw CSS selector)
|
|
42
|
+
* @param valueKey - The value key (can be a fixture key or raw value)
|
|
43
|
+
* @example Then I do not see exact value "john_doe"
|
|
44
|
+
*/
|
|
45
|
+
export declare function expectElementToNotHaveExactValue(page: any, selectorKey: string, valueKey: string): Promise<void>;
|
|
46
|
+
/**
|
|
47
|
+
* Asserts that a specific attribute of an element matches the expected value exactly.
|
|
48
|
+
* Supports fixtures for reusable selectors, attributes, and values.
|
|
49
|
+
* @param page - The Playwright page object
|
|
50
|
+
* @param selectorKey - The selector key (can be a fixture key or raw CSS selector)
|
|
51
|
+
* @param attrKey - The attribute key (can be a fixture key or raw attribute name)
|
|
52
|
+
* @param valueKey - The value key (can be a fixture key or raw value)
|
|
53
|
+
* @example Then I see exact attribute "href" with value "/terms-and-conditions"
|
|
17
54
|
*/
|
|
18
|
-
export declare function
|
|
55
|
+
export declare function expectElementToHaveExactAttribute(page: any, selectorKey: string, attrKey: string, valueKey: string): Promise<void>;
|
|
19
56
|
/**
|
|
20
|
-
* Asserts that a specific attribute of an element
|
|
57
|
+
* Asserts that a specific attribute of an element does NOT match the expected value.
|
|
21
58
|
* Supports fixtures for reusable selectors, attributes, and values.
|
|
22
|
-
* @
|
|
59
|
+
* @param page - The Playwright page object
|
|
60
|
+
* @param selectorKey - The selector key (can be a fixture key or raw CSS selector)
|
|
61
|
+
* @param attrKey - The attribute key (can be a fixture key or raw attribute name)
|
|
62
|
+
* @param valueKey - The value key (can be a fixture key or raw value)
|
|
63
|
+
* @example Then I do not see exact attribute "href" with value "/wrong-url"
|
|
64
|
+
*/
|
|
65
|
+
export declare function expectElementToNotHaveExactAttribute(page: any, selectorKey: string, attrKey: string, valueKey: string): Promise<void>;
|
|
66
|
+
/**
|
|
67
|
+
* Asserts that a button with specific text is visible.
|
|
68
|
+
* @param page - The Playwright page object
|
|
69
|
+
* @param textKey - The text key (can be a fixture key or raw text)
|
|
70
|
+
* @example Then I see button text "Submit"
|
|
71
|
+
* @example Then I see button text "buttons.saveKey" (fixture)
|
|
72
|
+
*/
|
|
73
|
+
export declare function iSeeButtonText(page: any, textKey: string): Promise<void>;
|
|
74
|
+
/**
|
|
75
|
+
* Asserts that a heading with specific text is visible.
|
|
76
|
+
* @param page - The Playwright page object
|
|
77
|
+
* @param textKey - The text key (can be a fixture key or raw text)
|
|
78
|
+
* @example Then I see heading text "Welcome"
|
|
79
|
+
*/
|
|
80
|
+
export declare function iSeeHeadingText(page: any, textKey: string): Promise<void>;
|
|
81
|
+
/**
|
|
82
|
+
* Asserts that a link with specific text is visible.
|
|
83
|
+
* @example Then I see link text "Read More"
|
|
84
|
+
*/
|
|
85
|
+
export declare function iSeeLinkText(page: any, textKey: string): Promise<void>;
|
|
86
|
+
/**
|
|
87
|
+
* Asserts that a label with specific text is visible.
|
|
88
|
+
* @example Then I see label text "Email Address"
|
|
89
|
+
*/
|
|
90
|
+
export declare function iSeeLabelText(page: any, textKey: string): Promise<void>;
|
|
91
|
+
/**
|
|
92
|
+
* Asserts that a button with specific text is NOT visible or does not exist.
|
|
93
|
+
* @example Then I do not see button text "Delete"
|
|
94
|
+
*/
|
|
95
|
+
export declare function iDoNotSeeButtonText(page: any, textKey: string): Promise<void>;
|
|
96
|
+
/**
|
|
97
|
+
* Asserts that a heading with specific text is NOT visible or does not exist.
|
|
98
|
+
* @example Then I do not see heading text "Old Title"
|
|
99
|
+
*/
|
|
100
|
+
export declare function iDoNotSeeHeadingText(page: any, textKey: string): Promise<void>;
|
|
101
|
+
/**
|
|
102
|
+
* Asserts that a link with specific text is NOT visible or does not exist.
|
|
103
|
+
* @example Then I do not see link text "Expired Offer"
|
|
104
|
+
*/
|
|
105
|
+
export declare function iDoNotSeeLinkText(page: any, textKey: string): Promise<void>;
|
|
106
|
+
/**
|
|
107
|
+
* Asserts that a label with specific text is NOT visible or does not exist.
|
|
108
|
+
* @example Then I do not see label text "Secret Info"
|
|
109
|
+
*/
|
|
110
|
+
export declare function iDoNotSeeLabelText(page: any, textKey: string): Promise<void>;
|
|
111
|
+
/**
|
|
112
|
+
* Gets an element by selector and asserts it is hidden.
|
|
113
|
+
* @example When I get element by selector "div.loader" to be hidden
|
|
23
114
|
*/
|
|
24
|
-
export declare function
|
|
115
|
+
export declare function getElementBySelectorToBeHidden(page: any, selectorKey: string): Promise<void>;
|
|
25
116
|
//# sourceMappingURL=text.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text.d.ts","sourceRoot":"","sources":["../../../src/backend/assertions/text.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"text.d.ts","sourceRoot":"","sources":["../../../src/backend/assertions/text.ts"],"names":[],"mappings":"AAqBA;;;;;;;GAOG;AACH,wBAAsB,4BAA4B,CAChD,IAAI,EAAE,GAAG,EACT,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,IAAI,CAAC,CASf;AAGD;;;;;;;;GAQG;AACH,wBAAsB,uBAAuB,CAAC,IAAI,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,iBAMvE;AAED;;;;;;GAMG;AACH,wBAAsB,0BAA0B,CAAC,IAAI,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,iBAK1E;AAED;;;;;;;GAOG;AACH,wBAAsB,6BAA6B,CACjD,IAAI,EAAE,GAAG,EACT,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,IAAI,CAAC,CASf;AAED;;;;;;;GAOG;AACH,wBAAsB,gCAAgC,CACpD,IAAI,EAAE,GAAG,EACT,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,IAAI,CAAC,CAYf;AAED;;;;;;;;GAQG;AACH,wBAAsB,iCAAiC,CACrD,IAAI,EAAE,GAAG,EACT,WAAW,EAAE,MAAM,EACnB,OA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