playwright-cucumber-ts-steps 1.3.2 → 1.3.4
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/README.md +358 -671
- package/dist/backend/actions/click.d.ts +29 -29
- package/dist/backend/actions/click.js +29 -29
- package/dist/backend/actions/form.d.ts +2 -2
- package/dist/backend/actions/form.js +2 -2
- package/dist/backend/actions/formTable.d.ts +1 -1
- package/dist/backend/actions/formTable.js +1 -1
- package/dist/backend/actions/frames.d.ts +3 -3
- package/dist/backend/actions/frames.js +3 -3
- package/dist/backend/actions/inputs.d.ts +14 -14
- package/dist/backend/actions/inputs.js +14 -14
- package/dist/backend/actions/interactions.d.ts +7 -7
- package/dist/backend/actions/interactions.js +7 -7
- package/dist/backend/actions/keyboard.d.ts +6 -6
- package/dist/backend/actions/keyboard.js +6 -6
- package/dist/backend/actions/misc.d.ts +15 -15
- package/dist/backend/actions/misc.js +15 -15
- package/dist/backend/actions/mobile.d.ts +7 -7
- package/dist/backend/actions/mobile.js +7 -7
- package/dist/backend/actions/mouse.d.ts +9 -9
- package/dist/backend/actions/mouse.js +9 -9
- package/dist/backend/actions/navigation.d.ts +5 -5
- package/dist/backend/actions/navigation.js +5 -5
- package/dist/backend/actions/visual.d.ts +6 -6
- package/dist/backend/actions/visual.js +6 -6
- package/dist/backend/actions/waits.d.ts +6 -6
- package/dist/backend/actions/waits.js +6 -6
- package/dist/backend/api/assertions.d.ts +64 -4
- package/dist/backend/api/assertions.d.ts.map +1 -1
- package/dist/backend/api/assertions.js +205 -5
- package/dist/backend/api/mock.d.ts +3 -3
- package/dist/backend/api/mock.js +3 -3
- package/dist/backend/api/network.d.ts +6 -6
- package/dist/backend/api/network.js +6 -6
- package/dist/backend/api/requests.d.ts +4 -4
- package/dist/backend/api/requests.js +4 -4
- package/dist/backend/assertions/document.d.ts +10 -10
- package/dist/backend/assertions/document.js +10 -10
- package/dist/backend/assertions/elements.d.ts +28 -28
- package/dist/backend/assertions/elements.js +28 -28
- package/dist/backend/assertions/expectVisible.d.ts +1 -1
- package/dist/backend/assertions/expectVisible.js +1 -1
- package/dist/backend/assertions/forms.d.ts +7 -7
- package/dist/backend/assertions/forms.js +7 -7
- package/dist/backend/assertions/pageState.d.ts +4 -4
- package/dist/backend/assertions/pageState.js +4 -4
- package/dist/backend/assertions/storage.d.ts +11 -11
- package/dist/backend/assertions/storage.js +11 -11
- package/dist/backend/assertions/text.d.ts +17 -17
- package/dist/backend/assertions/text.js +17 -17
- package/dist/backend/assertions/visibility.d.ts +15 -15
- package/dist/backend/assertions/visibility.js +15 -15
- package/dist/backend/auth/index.d.ts +2 -2
- package/dist/backend/auth/index.js +2 -2
- package/dist/backend/db/steps.d.ts +9 -9
- package/dist/backend/db/steps.js +9 -9
- package/dist/backend/elements/alerts.d.ts +3 -3
- package/dist/backend/elements/alerts.js +3 -3
- package/dist/backend/elements/find.d.ts +15 -15
- package/dist/backend/elements/find.js +15 -15
- package/dist/backend/elements/forms.d.ts +4 -4
- package/dist/backend/elements/forms.js +4 -4
- package/dist/backend/elements/frames.d.ts +3 -3
- package/dist/backend/elements/frames.js +3 -3
- package/dist/backend/utils/faker.d.ts +2 -0
- package/dist/backend/utils/faker.d.ts.map +1 -0
- package/dist/backend/utils/faker.js +510 -0
- package/dist/backend/utils/fixtures.d.ts +44 -2
- package/dist/backend/utils/fixtures.d.ts.map +1 -1
- package/dist/backend/utils/fixtures.js +321 -5
- package/dist/backend/utils/resolver.d.ts +13 -0
- package/dist/backend/utils/resolver.d.ts.map +1 -1
- package/dist/backend/utils/resolver.js +55 -0
- package/dist/core/runner.d.ts +1 -0
- package/dist/core/runner.d.ts.map +1 -1
- package/dist/core/runner.js +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -1
- package/dist/metadata.json +49 -1
- package/package.json +4 -2
|
@@ -25,7 +25,7 @@ const state_1 = require("../utils/state");
|
|
|
25
25
|
// ==================================================
|
|
26
26
|
/**
|
|
27
27
|
* Asserts that the currently stored (active) element is visible in the viewport.
|
|
28
|
-
* @example Then I expect element to be visible
|
|
28
|
+
* @example Then I pw expect element to be visible
|
|
29
29
|
*/
|
|
30
30
|
async function expectActiveVisible(page) {
|
|
31
31
|
const element = (0, state_1.getActiveElement)(page);
|
|
@@ -35,7 +35,7 @@ async function expectActiveVisible(page) {
|
|
|
35
35
|
/**
|
|
36
36
|
* Asserts that an element with a given selector or description is visible in the viewport.
|
|
37
37
|
* Supports fixtures for reusable selectors.
|
|
38
|
-
* @example Then I expect "login.submitButton" to be visible
|
|
38
|
+
* @example Then I pw expect "login.submitButton" to be visible
|
|
39
39
|
*/
|
|
40
40
|
async function expectStringVisible(page, selectorKey) {
|
|
41
41
|
const selectors = (0, fixtures_1.loadFixture)("selectors.json");
|
|
@@ -46,7 +46,7 @@ async function expectStringVisible(page, selectorKey) {
|
|
|
46
46
|
}
|
|
47
47
|
/**
|
|
48
48
|
* Asserts that the currently stored (active) element is hidden or detached from the DOM.
|
|
49
|
-
* @example Then I expect element to be hidden
|
|
49
|
+
* @example Then I pw expect element to be hidden
|
|
50
50
|
*/
|
|
51
51
|
async function expectActiveHidden(page) {
|
|
52
52
|
const element = (0, state_1.getActiveElement)(page);
|
|
@@ -55,7 +55,7 @@ async function expectActiveHidden(page) {
|
|
|
55
55
|
}
|
|
56
56
|
/**
|
|
57
57
|
* Asserts that the currently stored (active) element is enabled (not disabled).
|
|
58
|
-
* @example Then I expect element to be enabled
|
|
58
|
+
* @example Then I pw expect element to be enabled
|
|
59
59
|
*/
|
|
60
60
|
async function expectActiveEnabled(page) {
|
|
61
61
|
const element = (0, state_1.getActiveElement)(page);
|
|
@@ -64,7 +64,7 @@ async function expectActiveEnabled(page) {
|
|
|
64
64
|
}
|
|
65
65
|
/**
|
|
66
66
|
* Asserts that the currently stored (active) element is disabled.
|
|
67
|
-
* @example Then I expect element to be disabled
|
|
67
|
+
* @example Then I pw expect element to be disabled
|
|
68
68
|
*/
|
|
69
69
|
async function expectActiveDisabled(page) {
|
|
70
70
|
const element = (0, state_1.getActiveElement)(page);
|
|
@@ -74,7 +74,7 @@ async function expectActiveDisabled(page) {
|
|
|
74
74
|
/**
|
|
75
75
|
* Asserts that the currently stored (active) element has the exact text specified.
|
|
76
76
|
* Supports fixtures for reusable texts.
|
|
77
|
-
* @example Then I expect element to have text "login.submitButtonText"
|
|
77
|
+
* @example Then I pw expect element to have text "login.submitButtonText"
|
|
78
78
|
*/
|
|
79
79
|
async function expectActiveText(page, textKey) {
|
|
80
80
|
const texts = (0, fixtures_1.loadFixture)("texts.json");
|
|
@@ -86,7 +86,7 @@ async function expectActiveText(page, textKey) {
|
|
|
86
86
|
/**
|
|
87
87
|
* Asserts that the currently stored (active) element contains the specified partial text.
|
|
88
88
|
* Supports fixtures for reusable texts.
|
|
89
|
-
* @example Then I expect element to contain text "login.partialText"
|
|
89
|
+
* @example Then I pw expect element to contain text "login.partialText"
|
|
90
90
|
*/
|
|
91
91
|
async function expectActiveContainText(page, textKey) {
|
|
92
92
|
const texts = (0, fixtures_1.loadFixture)("texts.json");
|
|
@@ -99,7 +99,7 @@ async function expectActiveContainText(page, textKey) {
|
|
|
99
99
|
* Asserts that the currently stored (active) element (input/select) has a specific value.
|
|
100
100
|
* Supports aliases (e.g., `@orderId`) to compare against stored variables.
|
|
101
101
|
* Supports fixtures for reusable values.
|
|
102
|
-
* @example Then I expect element to have value "@savedUserEmail"
|
|
102
|
+
* @example Then I pw expect element to have value "@savedUserEmail"
|
|
103
103
|
*/
|
|
104
104
|
async function expectActiveValue(page, valueKey) {
|
|
105
105
|
let resolvedValue = valueKey;
|
|
@@ -121,7 +121,7 @@ async function expectActiveValue(page, valueKey) {
|
|
|
121
121
|
/**
|
|
122
122
|
* Asserts that the currently stored (active) element possesses a specific attribute.
|
|
123
123
|
* Supports fixtures for reusable attributes.
|
|
124
|
-
* @example Then I expect element to have attribute "attributes.required"
|
|
124
|
+
* @example Then I pw expect element to have attribute "attributes.required"
|
|
125
125
|
*/
|
|
126
126
|
async function expectActiveAttribute(page, attrKey) {
|
|
127
127
|
const attributes = (0, fixtures_1.loadFixture)("attributes.json");
|
|
@@ -133,7 +133,7 @@ async function expectActiveAttribute(page, attrKey) {
|
|
|
133
133
|
/**
|
|
134
134
|
* Asserts that the currently stored (active) element has an attribute with a specific value.
|
|
135
135
|
* Supports fixtures for reusable attributes and values.
|
|
136
|
-
* @example Then I expect element to have attribute "attributes.type" with value "input.passwordType"
|
|
136
|
+
* @example Then I pw expect element to have attribute "attributes.type" with value "input.passwordType"
|
|
137
137
|
*/
|
|
138
138
|
async function expectActiveAttributeValue(page, attrKey, valueKey) {
|
|
139
139
|
const attributes = (0, fixtures_1.loadFixture)("attributes.json");
|
|
@@ -146,7 +146,7 @@ async function expectActiveAttributeValue(page, attrKey, valueKey) {
|
|
|
146
146
|
}
|
|
147
147
|
/**
|
|
148
148
|
* Performs a visual comparison of the entire page against a baseline screenshot.
|
|
149
|
-
* @example Then I expect the page screenshot to match "landing-page.png"
|
|
149
|
+
* @example Then I pw expect the page screenshot to match "landing-page.png"
|
|
150
150
|
*/
|
|
151
151
|
async function expectPageScreenshotMatch(page, filename) {
|
|
152
152
|
await (0, test_1.expect)(page).toHaveScreenshot(filename);
|
|
@@ -154,7 +154,7 @@ async function expectPageScreenshotMatch(page, filename) {
|
|
|
154
154
|
}
|
|
155
155
|
/**
|
|
156
156
|
* Performs a visual comparison of the active element against a baseline screenshot.
|
|
157
|
-
* @example Then I expect the element screenshot to match "login-button.png"
|
|
157
|
+
* @example Then I pw expect the element screenshot to match "login-button.png"
|
|
158
158
|
*/
|
|
159
159
|
async function expectElementScreenshotMatch(page, filename) {
|
|
160
160
|
const element = (0, state_1.getActiveElement)(page);
|
|
@@ -165,7 +165,7 @@ async function expectElementScreenshotMatch(page, filename) {
|
|
|
165
165
|
/**
|
|
166
166
|
* Asserts that an element is not visible.
|
|
167
167
|
* Supports fixtures for reusable selectors.
|
|
168
|
-
* @example Then I expect "modal.overlay" to be not visible
|
|
168
|
+
* @example Then I pw expect "modal.overlay" to be not visible
|
|
169
169
|
*/
|
|
170
170
|
async function expectElementToNotBeVisible(page, selectorKey) {
|
|
171
171
|
const selectors = (0, fixtures_1.loadFixture)("selectors.json");
|
|
@@ -176,7 +176,7 @@ async function expectElementToNotBeVisible(page, selectorKey) {
|
|
|
176
176
|
/**
|
|
177
177
|
* Asserts that an element exists in the DOM.
|
|
178
178
|
* Supports fixtures for reusable selectors.
|
|
179
|
-
* @example Then I expect element "header.logo" exists
|
|
179
|
+
* @example Then I pw expect element "header.logo" exists
|
|
180
180
|
*/
|
|
181
181
|
async function expectElementExists(page, selectorKey) {
|
|
182
182
|
const selectors = (0, fixtures_1.loadFixture)("selectors.json");
|
|
@@ -190,7 +190,7 @@ async function expectElementExists(page, selectorKey) {
|
|
|
190
190
|
/**
|
|
191
191
|
* Asserts that an element does not exist in the DOM.
|
|
192
192
|
* Supports fixtures for reusable selectors.
|
|
193
|
-
* @example Then I expect element "modal.deleted" does not exist
|
|
193
|
+
* @example Then I pw expect element "modal.deleted" does not exist
|
|
194
194
|
*/
|
|
195
195
|
async function expectElementDoesNotExist(page, selectorKey) {
|
|
196
196
|
const selectors = (0, fixtures_1.loadFixture)("selectors.json");
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
* Saves the current browser context's storage state (cookies, localStorage, etc.) to a file.
|
|
3
3
|
* Supports fixtures for reusable auth state filenames.
|
|
4
4
|
* Use this after a successful login to persist the authenticated session.
|
|
5
|
-
* @example And I save the browser state to "adminState"
|
|
5
|
+
* @example And I pw save the browser state to "adminState"
|
|
6
6
|
*/
|
|
7
7
|
export declare function saveBrowserState(page: any, filenameKey: string): Promise<void>;
|
|
8
8
|
/**
|
|
9
9
|
* Loads a previously saved browser context state (cookies, localStorage, etc.) from a file.
|
|
10
10
|
* Supports fixtures for reusable auth state filenames.
|
|
11
11
|
* Use this at the start of other scenarios to restore an authenticated session.
|
|
12
|
-
* @example Given I load the browser state from "adminState"
|
|
12
|
+
* @example Given I pw load the browser state from "adminState"
|
|
13
13
|
*/
|
|
14
14
|
export declare function loadBrowserState(page: any, filenameKey: string): Promise<void>;
|
|
15
15
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -47,7 +47,7 @@ const fixtures_1 = require("../utils/fixtures");
|
|
|
47
47
|
* Saves the current browser context's storage state (cookies, localStorage, etc.) to a file.
|
|
48
48
|
* Supports fixtures for reusable auth state filenames.
|
|
49
49
|
* Use this after a successful login to persist the authenticated session.
|
|
50
|
-
* @example And I save the browser state to "adminState"
|
|
50
|
+
* @example And I pw save the browser state to "adminState"
|
|
51
51
|
*/
|
|
52
52
|
async function saveBrowserState(page, filenameKey) {
|
|
53
53
|
const files = (0, fixtures_1.loadFixture)("files.json");
|
|
@@ -65,7 +65,7 @@ async function saveBrowserState(page, filenameKey) {
|
|
|
65
65
|
* Loads a previously saved browser context state (cookies, localStorage, etc.) from a file.
|
|
66
66
|
* Supports fixtures for reusable auth state filenames.
|
|
67
67
|
* Use this at the start of other scenarios to restore an authenticated session.
|
|
68
|
-
* @example Given I load the browser state from "adminState"
|
|
68
|
+
* @example Given I pw load the browser state from "adminState"
|
|
69
69
|
*/
|
|
70
70
|
async function loadBrowserState(page, filenameKey) {
|
|
71
71
|
const files = (0, fixtures_1.loadFixture)("files.json");
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Executes a raw SQL query against the configured database.
|
|
3
3
|
* Supports fixtures for reusable queries.
|
|
4
|
-
* @example When I run the database query "selectUsersByEmail"
|
|
4
|
+
* @example When I pw run the database query "selectUsersByEmail"
|
|
5
5
|
*/
|
|
6
6
|
export declare function runDbQuery(_page: any, queryKey: string): Promise<void>;
|
|
7
7
|
/**
|
|
8
8
|
* Asserts that the last executed database query returned a specific number of records.
|
|
9
|
-
* @example Then I expect the database to return 1 record
|
|
9
|
+
* @example Then I pw expect the database to return 1 record
|
|
10
10
|
*/
|
|
11
11
|
export declare function expectDbRecordCount(page: any, count: number): Promise<void>;
|
|
12
12
|
/**
|
|
13
13
|
* Asserts that the database query returned no records (empty result set).
|
|
14
|
-
* @example Then I expect the database to return no records
|
|
14
|
+
* @example Then I pw expect the database to return no records
|
|
15
15
|
*/
|
|
16
16
|
export declare function expectDbNoRecords(_page: any): Promise<void>;
|
|
17
17
|
/**
|
|
18
18
|
* Asserts that the first record of the last database result set contains specific column values.
|
|
19
19
|
* Performs a loose equality check (converts values to strings) to handle type mismatches.
|
|
20
20
|
* Supports fixtures for reusable table data.
|
|
21
|
-
* @example Then I expect the first database record to contain
|
|
21
|
+
* @example Then I pw expect the first database record to contain
|
|
22
22
|
* | username | admin |
|
|
23
23
|
* | is_active| 1 |
|
|
24
24
|
* | role | superuser |
|
|
@@ -27,7 +27,7 @@ export declare function expectFirstDbRecordToContain(page: any, tableData: strin
|
|
|
27
27
|
/**
|
|
28
28
|
* Asserts that a specific row (by index) contains expected column values.
|
|
29
29
|
* Supports fixtures for reusable table data.
|
|
30
|
-
* @example Then I expect database row 2 to contain
|
|
30
|
+
* @example Then I pw expect database row 2 to contain
|
|
31
31
|
* | username | bob |
|
|
32
32
|
* | status | active |
|
|
33
33
|
*/
|
|
@@ -36,27 +36,27 @@ export declare function expectDbRowToContain(page: any, index: number, tableData
|
|
|
36
36
|
* Asserts that all records in the result set contain specific column values.
|
|
37
37
|
* Useful for verifying uniform data across multiple rows.
|
|
38
38
|
* Supports fixtures for reusable table data.
|
|
39
|
-
* @example Then I expect all database records to contain
|
|
39
|
+
* @example Then I pw expect all database records to contain
|
|
40
40
|
* | status | active |
|
|
41
41
|
*/
|
|
42
42
|
export declare function expectAllDbRecordsToContain(page: any, tableData: string[][]): Promise<void>;
|
|
43
43
|
/**
|
|
44
44
|
* Asserts that a specific column exists in the database result set.
|
|
45
45
|
* Supports fixtures for reusable column names.
|
|
46
|
-
* @example Then I expect database column "email" to exist
|
|
46
|
+
* @example Then I pw expect database column "email" to exist
|
|
47
47
|
*/
|
|
48
48
|
export declare function expectDbColumnExists(page: any, columnNameKey: string): Promise<void>;
|
|
49
49
|
/**
|
|
50
50
|
* Asserts that a specific column in any row contains the expected value.
|
|
51
51
|
* Searches through all rows to find a match.
|
|
52
52
|
* Supports fixtures for reusable column names and values.
|
|
53
|
-
* @example Then I expect database column "email" to contain "test@example.com"
|
|
53
|
+
* @example Then I pw expect database column "email" to contain "test@example.com"
|
|
54
54
|
*/
|
|
55
55
|
export declare function expectDbColumnContains(page: any, columnNameKey: string, expectedValueKey: string): Promise<void>;
|
|
56
56
|
/**
|
|
57
57
|
* Asserts the data type of a column's value in the first record.
|
|
58
58
|
* Supports fixtures for reusable column names and types.
|
|
59
|
-
* @example Then I expect database column "age" to be of type "number"
|
|
59
|
+
* @example Then I pw expect database column "age" to be of type "number"
|
|
60
60
|
*/
|
|
61
61
|
export declare function expectDbColumnType(page: any, columnNameKey: string, dataTypeKey: string): Promise<void>;
|
|
62
62
|
//# sourceMappingURL=steps.d.ts.map
|
package/dist/backend/db/steps.js
CHANGED
|
@@ -20,7 +20,7 @@ const state_1 = require("../utils/state");
|
|
|
20
20
|
/**
|
|
21
21
|
* Executes a raw SQL query against the configured database.
|
|
22
22
|
* Supports fixtures for reusable queries.
|
|
23
|
-
* @example When I run the database query "selectUsersByEmail"
|
|
23
|
+
* @example When I pw run the database query "selectUsersByEmail"
|
|
24
24
|
*/
|
|
25
25
|
async function runDbQuery(_page, queryKey) {
|
|
26
26
|
const queries = (0, fixtures_1.loadFixture)("queries.json");
|
|
@@ -30,7 +30,7 @@ async function runDbQuery(_page, queryKey) {
|
|
|
30
30
|
}
|
|
31
31
|
/**
|
|
32
32
|
* Asserts that the last executed database query returned a specific number of records.
|
|
33
|
-
* @example Then I expect the database to return 1 record
|
|
33
|
+
* @example Then I pw expect the database to return 1 record
|
|
34
34
|
*/
|
|
35
35
|
async function expectDbRecordCount(page, count) {
|
|
36
36
|
const result = state_1.dbState.getLastResult();
|
|
@@ -44,7 +44,7 @@ async function expectDbRecordCount(page, count) {
|
|
|
44
44
|
}
|
|
45
45
|
/**
|
|
46
46
|
* Asserts that the database query returned no records (empty result set).
|
|
47
|
-
* @example Then I expect the database to return no records
|
|
47
|
+
* @example Then I pw expect the database to return no records
|
|
48
48
|
*/
|
|
49
49
|
async function expectDbNoRecords(_page) {
|
|
50
50
|
const result = state_1.dbState.getLastResult();
|
|
@@ -58,7 +58,7 @@ async function expectDbNoRecords(_page) {
|
|
|
58
58
|
* Asserts that the first record of the last database result set contains specific column values.
|
|
59
59
|
* Performs a loose equality check (converts values to strings) to handle type mismatches.
|
|
60
60
|
* Supports fixtures for reusable table data.
|
|
61
|
-
* @example Then I expect the first database record to contain
|
|
61
|
+
* @example Then I pw expect the first database record to contain
|
|
62
62
|
* | username | admin |
|
|
63
63
|
* | is_active| 1 |
|
|
64
64
|
* | role | superuser |
|
|
@@ -86,7 +86,7 @@ async function expectFirstDbRecordToContain(page, tableData) {
|
|
|
86
86
|
/**
|
|
87
87
|
* Asserts that a specific row (by index) contains expected column values.
|
|
88
88
|
* Supports fixtures for reusable table data.
|
|
89
|
-
* @example Then I expect database row 2 to contain
|
|
89
|
+
* @example Then I pw expect database row 2 to contain
|
|
90
90
|
* | username | bob |
|
|
91
91
|
* | status | active |
|
|
92
92
|
*/
|
|
@@ -117,7 +117,7 @@ async function expectDbRowToContain(page, index, tableData) {
|
|
|
117
117
|
* Asserts that all records in the result set contain specific column values.
|
|
118
118
|
* Useful for verifying uniform data across multiple rows.
|
|
119
119
|
* Supports fixtures for reusable table data.
|
|
120
|
-
* @example Then I expect all database records to contain
|
|
120
|
+
* @example Then I pw expect all database records to contain
|
|
121
121
|
* | status | active |
|
|
122
122
|
*/
|
|
123
123
|
async function expectAllDbRecordsToContain(page, tableData) {
|
|
@@ -148,7 +148,7 @@ async function expectAllDbRecordsToContain(page, tableData) {
|
|
|
148
148
|
/**
|
|
149
149
|
* Asserts that a specific column exists in the database result set.
|
|
150
150
|
* Supports fixtures for reusable column names.
|
|
151
|
-
* @example Then I expect database column "email" to exist
|
|
151
|
+
* @example Then I pw expect database column "email" to exist
|
|
152
152
|
*/
|
|
153
153
|
async function expectDbColumnExists(page, columnNameKey) {
|
|
154
154
|
const columns = (0, fixtures_1.loadFixture)("columns.json");
|
|
@@ -168,7 +168,7 @@ async function expectDbColumnExists(page, columnNameKey) {
|
|
|
168
168
|
* Asserts that a specific column in any row contains the expected value.
|
|
169
169
|
* Searches through all rows to find a match.
|
|
170
170
|
* Supports fixtures for reusable column names and values.
|
|
171
|
-
* @example Then I expect database column "email" to contain "test@example.com"
|
|
171
|
+
* @example Then I pw expect database column "email" to contain "test@example.com"
|
|
172
172
|
*/
|
|
173
173
|
async function expectDbColumnContains(page, columnNameKey, expectedValueKey) {
|
|
174
174
|
const columns = (0, fixtures_1.loadFixture)("columns.json");
|
|
@@ -196,7 +196,7 @@ async function expectDbColumnContains(page, columnNameKey, expectedValueKey) {
|
|
|
196
196
|
/**
|
|
197
197
|
* Asserts the data type of a column's value in the first record.
|
|
198
198
|
* Supports fixtures for reusable column names and types.
|
|
199
|
-
* @example Then I expect database column "age" to be of type "number"
|
|
199
|
+
* @example Then I pw expect database column "age" to be of type "number"
|
|
200
200
|
*/
|
|
201
201
|
async function expectDbColumnType(page, columnNameKey, dataTypeKey) {
|
|
202
202
|
const columns = (0, fixtures_1.loadFixture)("columns.json");
|
|
@@ -2,20 +2,20 @@
|
|
|
2
2
|
* Sets up a listener to automatically click "OK" or "Accept" on the very next browser dialog
|
|
3
3
|
* (alert, confirm, or prompt) that appears.
|
|
4
4
|
* **Note:** This must be called *before* the action that triggers the dialog.
|
|
5
|
-
* @example Given I accept the next dialog
|
|
5
|
+
* @example Given I pw accept the next dialog
|
|
6
6
|
*/
|
|
7
7
|
export declare function acceptNextDialog(page: any): Promise<void>;
|
|
8
8
|
/**
|
|
9
9
|
* Sets up a listener to automatically click "Cancel" or "Dismiss" on the very next browser dialog.
|
|
10
10
|
* **Note:** This must be called *before* the action that triggers the dialog.
|
|
11
|
-
* @example Given I dismiss the next dialog
|
|
11
|
+
* @example Given I pw dismiss the next dialog
|
|
12
12
|
*/
|
|
13
13
|
export declare function dismissNextDialog(page: any): Promise<void>;
|
|
14
14
|
/**
|
|
15
15
|
* Sets up a listener to type a specific string into the next browser prompt and then accept it.
|
|
16
16
|
* Supports fixtures for reusable prompt values.
|
|
17
17
|
* **Note:** This must be called *before* the action that triggers the prompt.
|
|
18
|
-
* @example Given I type "prompt.folderName" into the next prompt and accept
|
|
18
|
+
* @example Given I pw type "prompt.folderName" into the next prompt and accept
|
|
19
19
|
*/
|
|
20
20
|
export declare function typeAndAcceptPrompt(page: any, textKey: string): Promise<void>;
|
|
21
21
|
//# sourceMappingURL=alerts.d.ts.map
|
|
@@ -13,7 +13,7 @@ const fixtures_1 = require("../utils/fixtures");
|
|
|
13
13
|
* Sets up a listener to automatically click "OK" or "Accept" on the very next browser dialog
|
|
14
14
|
* (alert, confirm, or prompt) that appears.
|
|
15
15
|
* **Note:** This must be called *before* the action that triggers the dialog.
|
|
16
|
-
* @example Given I accept the next dialog
|
|
16
|
+
* @example Given I pw accept the next dialog
|
|
17
17
|
*/
|
|
18
18
|
async function acceptNextDialog(page) {
|
|
19
19
|
page.once("dialog", async (dialog) => {
|
|
@@ -24,7 +24,7 @@ async function acceptNextDialog(page) {
|
|
|
24
24
|
/**
|
|
25
25
|
* Sets up a listener to automatically click "Cancel" or "Dismiss" on the very next browser dialog.
|
|
26
26
|
* **Note:** This must be called *before* the action that triggers the dialog.
|
|
27
|
-
* @example Given I dismiss the next dialog
|
|
27
|
+
* @example Given I pw dismiss the next dialog
|
|
28
28
|
*/
|
|
29
29
|
async function dismissNextDialog(page) {
|
|
30
30
|
page.once("dialog", async (dialog) => {
|
|
@@ -36,7 +36,7 @@ async function dismissNextDialog(page) {
|
|
|
36
36
|
* Sets up a listener to type a specific string into the next browser prompt and then accept it.
|
|
37
37
|
* Supports fixtures for reusable prompt values.
|
|
38
38
|
* **Note:** This must be called *before* the action that triggers the prompt.
|
|
39
|
-
* @example Given I type "prompt.folderName" into the next prompt and accept
|
|
39
|
+
* @example Given I pw type "prompt.folderName" into the next prompt and accept
|
|
40
40
|
*/
|
|
41
41
|
async function typeAndAcceptPrompt(page, textKey) {
|
|
42
42
|
const prompts = (0, fixtures_1.loadFixture)("prompts.json");
|
|
@@ -1,74 +1,74 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Finds a single element using a CSS or XPath selector.
|
|
3
3
|
* Asserts that exactly one element is found.
|
|
4
|
-
* @example When I find element by selector ".nav-bar"
|
|
4
|
+
* @example When I pw find element by selector ".nav-bar"
|
|
5
5
|
*/
|
|
6
6
|
export declare function findElementBySelector(page: any, selectorKey: string): Promise<void>;
|
|
7
7
|
/**
|
|
8
8
|
* Finds an element containing the exact text provided.
|
|
9
|
-
* @example When I find element by text "Submit Order"
|
|
9
|
+
* @example When I pw find element by text "Submit Order"
|
|
10
10
|
*/
|
|
11
11
|
export declare function findElementByText(page: any, text: string): Promise<void>;
|
|
12
12
|
/**
|
|
13
13
|
* Finds an element by its `title` attribute.
|
|
14
|
-
* @example When I find element by title "Close Modal"
|
|
14
|
+
* @example When I pw find element by title "Close Modal"
|
|
15
15
|
*/
|
|
16
16
|
export declare function findElementByTitle(page: any, title: string): Promise<void>;
|
|
17
17
|
/**
|
|
18
18
|
* Finds an element by its test ID (usually `data-testid`).
|
|
19
|
-
* @example When I find element by testid "login-form"
|
|
19
|
+
* @example When I pw find element by testid "login-form"
|
|
20
20
|
*/
|
|
21
21
|
export declare function findElementByTestId(page: any, testid: string): Promise<void>;
|
|
22
22
|
/**
|
|
23
23
|
* Finds an element by its ARIA role.
|
|
24
|
-
* @example When I find element by role "button"
|
|
24
|
+
* @example When I pw find element by role "button"
|
|
25
25
|
*/
|
|
26
26
|
export declare function findElementByRole(page: any, role: string): Promise<void>;
|
|
27
27
|
/**
|
|
28
28
|
* Finds an input element by its placeholder text.
|
|
29
|
-
* @example When I find element by placeholder text "Enter your email"
|
|
29
|
+
* @example When I pw find element by placeholder text "Enter your email"
|
|
30
30
|
*/
|
|
31
31
|
export declare function findElementByPlaceholder(page: any, text: string): Promise<void>;
|
|
32
32
|
/**
|
|
33
33
|
* Finds a form control associated with a specific label text.
|
|
34
|
-
* @example When I find element by label text "Password"
|
|
34
|
+
* @example When I pw find element by label text "Password"
|
|
35
35
|
*/
|
|
36
36
|
export declare function findElementByLabel(page: any, label: string): Promise<void>;
|
|
37
37
|
/**
|
|
38
38
|
* Finds an element (usually an image) by its alt text.
|
|
39
|
-
* @example When I find element by alt text "Company Logo"
|
|
39
|
+
* @example When I pw find element by alt text "Company Logo"
|
|
40
40
|
*/
|
|
41
41
|
export declare function findElementByAltText(page: any, alt: string): Promise<void>;
|
|
42
42
|
/**
|
|
43
43
|
* Finds a specific link by its visible text.
|
|
44
|
-
* @example When I find link by text "Read More"
|
|
44
|
+
* @example When I pw find link by text "Read More"
|
|
45
45
|
*/
|
|
46
46
|
export declare function findLinkByText(page: any, text: string): Promise<void>;
|
|
47
47
|
/**
|
|
48
48
|
* Finds a heading (h1-h6) by its text content.
|
|
49
|
-
* @example When I find heading by text "Dashboard"
|
|
49
|
+
* @example When I pw find heading by text "Dashboard"
|
|
50
50
|
*/
|
|
51
51
|
export declare function findHeadingByText(page: any, text: string): Promise<void>;
|
|
52
52
|
/**
|
|
53
53
|
* Finds an element by its `name` attribute.
|
|
54
|
-
* @example When I find element by name "csrf_token"
|
|
54
|
+
* @example When I pw find element by name "csrf_token"
|
|
55
55
|
*/
|
|
56
56
|
export declare function findElementByName(page: any, name: string): Promise<void>;
|
|
57
57
|
/**
|
|
58
58
|
* Finds all elements matching a CSS selector and stores them as a list.
|
|
59
|
-
* @example When I find elements by selector "ul > li"
|
|
59
|
+
* @example When I pw find elements by selector "ul > li"
|
|
60
60
|
*/
|
|
61
61
|
export declare function findElementsBySelector(page: any, selectorKey: string): Promise<void>;
|
|
62
62
|
/**
|
|
63
63
|
* Finds all buttons matching specific text.
|
|
64
64
|
* Supports variable aliasing (e.g., "@buttonName").
|
|
65
|
-
* @example When I find buttons by text "Add to Cart"
|
|
65
|
+
* @example When I pw find buttons by text "Add to Cart"
|
|
66
66
|
*/
|
|
67
67
|
export declare function findButtonsByText(page: any, text: string): Promise<void>;
|
|
68
68
|
/**
|
|
69
69
|
* Selects the nth element from the currently stored list.
|
|
70
70
|
* Uses 1-based indexing (e.g., 1st, 2nd, 3rd).
|
|
71
|
-
* @example When I get 2nd element
|
|
71
|
+
* @example When I pw get 2nd element
|
|
72
72
|
*/
|
|
73
73
|
export declare function getNthElement(page: any, indexStr: string): Promise<void>;
|
|
74
74
|
/**
|
|
@@ -91,7 +91,7 @@ export declare function getFirstElement(page: any): Promise<void>;
|
|
|
91
91
|
export declare function getLastElement(page: any): Promise<void>;
|
|
92
92
|
/**
|
|
93
93
|
* Stores the text content of the currently active element in a variable.
|
|
94
|
-
* @example When I store element text as "confirmationCode"
|
|
94
|
+
* @example When I pw store element text as "confirmationCode"
|
|
95
95
|
*/
|
|
96
96
|
export declare function storeElementText(page: any, alias: string): Promise<void>;
|
|
97
97
|
/**
|
|
@@ -35,7 +35,7 @@ const fixtures_1 = require("../utils/fixtures");
|
|
|
35
35
|
/**
|
|
36
36
|
* Finds a single element using a CSS or XPath selector.
|
|
37
37
|
* Asserts that exactly one element is found.
|
|
38
|
-
* @example When I find element by selector ".nav-bar"
|
|
38
|
+
* @example When I pw find element by selector ".nav-bar"
|
|
39
39
|
*/
|
|
40
40
|
async function findElementBySelector(page, selectorKey) {
|
|
41
41
|
const selectors = (0, fixtures_1.loadFixture)("selectors.json");
|
|
@@ -47,7 +47,7 @@ async function findElementBySelector(page, selectorKey) {
|
|
|
47
47
|
}
|
|
48
48
|
/**
|
|
49
49
|
* Finds an element containing the exact text provided.
|
|
50
|
-
* @example When I find element by text "Submit Order"
|
|
50
|
+
* @example When I pw find element by text "Submit Order"
|
|
51
51
|
*/
|
|
52
52
|
async function findElementByText(page, text) {
|
|
53
53
|
const element = page.getByText(text, { exact: true });
|
|
@@ -57,7 +57,7 @@ async function findElementByText(page, text) {
|
|
|
57
57
|
}
|
|
58
58
|
/**
|
|
59
59
|
* Finds an element by its `title` attribute.
|
|
60
|
-
* @example When I find element by title "Close Modal"
|
|
60
|
+
* @example When I pw find element by title "Close Modal"
|
|
61
61
|
*/
|
|
62
62
|
async function findElementByTitle(page, title) {
|
|
63
63
|
const element = page.getByTitle(title);
|
|
@@ -67,7 +67,7 @@ async function findElementByTitle(page, title) {
|
|
|
67
67
|
}
|
|
68
68
|
/**
|
|
69
69
|
* Finds an element by its test ID (usually `data-testid`).
|
|
70
|
-
* @example When I find element by testid "login-form"
|
|
70
|
+
* @example When I pw find element by testid "login-form"
|
|
71
71
|
*/
|
|
72
72
|
async function findElementByTestId(page, testid) {
|
|
73
73
|
const element = page.getByTestId(testid);
|
|
@@ -77,7 +77,7 @@ async function findElementByTestId(page, testid) {
|
|
|
77
77
|
}
|
|
78
78
|
/**
|
|
79
79
|
* Finds an element by its ARIA role.
|
|
80
|
-
* @example When I find element by role "button"
|
|
80
|
+
* @example When I pw find element by role "button"
|
|
81
81
|
*/
|
|
82
82
|
async function findElementByRole(page, role) {
|
|
83
83
|
const element = page.getByRole(role);
|
|
@@ -87,7 +87,7 @@ async function findElementByRole(page, role) {
|
|
|
87
87
|
}
|
|
88
88
|
/**
|
|
89
89
|
* Finds an input element by its placeholder text.
|
|
90
|
-
* @example When I find element by placeholder text "Enter your email"
|
|
90
|
+
* @example When I pw find element by placeholder text "Enter your email"
|
|
91
91
|
*/
|
|
92
92
|
async function findElementByPlaceholder(page, text) {
|
|
93
93
|
const element = page.getByPlaceholder(text);
|
|
@@ -97,7 +97,7 @@ async function findElementByPlaceholder(page, text) {
|
|
|
97
97
|
}
|
|
98
98
|
/**
|
|
99
99
|
* Finds a form control associated with a specific label text.
|
|
100
|
-
* @example When I find element by label text "Password"
|
|
100
|
+
* @example When I pw find element by label text "Password"
|
|
101
101
|
*/
|
|
102
102
|
async function findElementByLabel(page, label) {
|
|
103
103
|
const element = page.getByLabel(label);
|
|
@@ -107,7 +107,7 @@ async function findElementByLabel(page, label) {
|
|
|
107
107
|
}
|
|
108
108
|
/**
|
|
109
109
|
* Finds an element (usually an image) by its alt text.
|
|
110
|
-
* @example When I find element by alt text "Company Logo"
|
|
110
|
+
* @example When I pw find element by alt text "Company Logo"
|
|
111
111
|
*/
|
|
112
112
|
async function findElementByAltText(page, alt) {
|
|
113
113
|
const element = page.getByAltText(alt);
|
|
@@ -117,7 +117,7 @@ async function findElementByAltText(page, alt) {
|
|
|
117
117
|
}
|
|
118
118
|
/**
|
|
119
119
|
* Finds a specific link by its visible text.
|
|
120
|
-
* @example When I find link by text "Read More"
|
|
120
|
+
* @example When I pw find link by text "Read More"
|
|
121
121
|
*/
|
|
122
122
|
async function findLinkByText(page, text) {
|
|
123
123
|
const element = page.getByRole("link", { name: text });
|
|
@@ -126,7 +126,7 @@ async function findLinkByText(page, text) {
|
|
|
126
126
|
}
|
|
127
127
|
/**
|
|
128
128
|
* Finds a heading (h1-h6) by its text content.
|
|
129
|
-
* @example When I find heading by text "Dashboard"
|
|
129
|
+
* @example When I pw find heading by text "Dashboard"
|
|
130
130
|
*/
|
|
131
131
|
async function findHeadingByText(page, text) {
|
|
132
132
|
const element = page.getByRole("heading", { name: text });
|
|
@@ -135,7 +135,7 @@ async function findHeadingByText(page, text) {
|
|
|
135
135
|
}
|
|
136
136
|
/**
|
|
137
137
|
* Finds an element by its `name` attribute.
|
|
138
|
-
* @example When I find element by name "csrf_token"
|
|
138
|
+
* @example When I pw find element by name "csrf_token"
|
|
139
139
|
*/
|
|
140
140
|
async function findElementByName(page, name) {
|
|
141
141
|
const element = page.locator(`[name="${name}"]`);
|
|
@@ -145,7 +145,7 @@ async function findElementByName(page, name) {
|
|
|
145
145
|
}
|
|
146
146
|
/**
|
|
147
147
|
* Finds all elements matching a CSS selector and stores them as a list.
|
|
148
|
-
* @example When I find elements by selector "ul > li"
|
|
148
|
+
* @example When I pw find elements by selector "ul > li"
|
|
149
149
|
*/
|
|
150
150
|
async function findElementsBySelector(page, selectorKey) {
|
|
151
151
|
const selectors = (0, fixtures_1.loadFixture)("selectors.json");
|
|
@@ -158,7 +158,7 @@ async function findElementsBySelector(page, selectorKey) {
|
|
|
158
158
|
/**
|
|
159
159
|
* Finds all buttons matching specific text.
|
|
160
160
|
* Supports variable aliasing (e.g., "@buttonName").
|
|
161
|
-
* @example When I find buttons by text "Add to Cart"
|
|
161
|
+
* @example When I pw find buttons by text "Add to Cart"
|
|
162
162
|
*/
|
|
163
163
|
async function findButtonsByText(page, text) {
|
|
164
164
|
let searchText = text;
|
|
@@ -176,7 +176,7 @@ async function findButtonsByText(page, text) {
|
|
|
176
176
|
/**
|
|
177
177
|
* Selects the nth element from the currently stored list.
|
|
178
178
|
* Uses 1-based indexing (e.g., 1st, 2nd, 3rd).
|
|
179
|
-
* @example When I get 2nd element
|
|
179
|
+
* @example When I pw get 2nd element
|
|
180
180
|
*/
|
|
181
181
|
async function getNthElement(page, indexStr) {
|
|
182
182
|
const index = parseInt(indexStr, 10);
|
|
@@ -223,7 +223,7 @@ async function getLastElement(page) {
|
|
|
223
223
|
}
|
|
224
224
|
/**
|
|
225
225
|
* Stores the text content of the currently active element in a variable.
|
|
226
|
-
* @example When I store element text as "confirmationCode"
|
|
226
|
+
* @example When I pw store element text as "confirmationCode"
|
|
227
227
|
*/
|
|
228
228
|
async function storeElementText(page, alias) {
|
|
229
229
|
const element = (0, state_1.getActiveElement)(page);
|
|
@@ -2,26 +2,26 @@
|
|
|
2
2
|
* Selects an option from a `<select>` dropdown menu.
|
|
3
3
|
* Supports fixtures for reusable selectors and options.
|
|
4
4
|
* It first attempts to match by the visible label; if that fails, it tries to match by the underlying `value` attribute.
|
|
5
|
-
* @example When I select option "options.country.canada" from "selectors.countrySelector"
|
|
5
|
+
* @example When I pw select option "options.country.canada" from "selectors.countrySelector"
|
|
6
6
|
*/
|
|
7
7
|
export declare function selectDropdownOption(page: any, optionKey: string, selectorKey: string): Promise<void>;
|
|
8
8
|
/**
|
|
9
9
|
* Checks a checkbox or radio button.
|
|
10
10
|
* Supports fixtures for reusable selectors.
|
|
11
|
-
* @example When I check "selectors.termsCheckbox"
|
|
11
|
+
* @example When I pw check "selectors.termsCheckbox"
|
|
12
12
|
*/
|
|
13
13
|
export declare function checkInput(page: any, selectorKey: string): Promise<void>;
|
|
14
14
|
/**
|
|
15
15
|
* Unchecks a checkbox.
|
|
16
16
|
* Supports fixtures for reusable selectors.
|
|
17
|
-
* @example When I uncheck "selectors.subscribeCheckbox"
|
|
17
|
+
* @example When I pw uncheck "selectors.subscribeCheckbox"
|
|
18
18
|
*/
|
|
19
19
|
export declare function uncheckInput(page: any, selectorKey: string): Promise<void>;
|
|
20
20
|
/**
|
|
21
21
|
* Uploads a file to an `<input type="file">` element.
|
|
22
22
|
* Supports fixtures for reusable selectors and file paths.
|
|
23
23
|
* The file path is resolved relative to the current working directory of the project.
|
|
24
|
-
* @example When I upload file "files.avatarImage" to "selectors.avatarUpload"
|
|
24
|
+
* @example When I pw upload file "files.avatarImage" to "selectors.avatarUpload"
|
|
25
25
|
*/
|
|
26
26
|
export declare function fileUpload(page: any, fileNameKey: string, selectorKey: string): Promise<void>;
|
|
27
27
|
//# sourceMappingURL=forms.d.ts.map
|