@quickpickle/playwright 1.0.0 → 1.2.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/README.md +5 -0
- package/dist/PlaywrightWorld.cjs +31 -12
- package/dist/PlaywrightWorld.cjs.map +1 -1
- package/dist/PlaywrightWorld.d.ts +97 -2
- package/dist/PlaywrightWorld.mjs +32 -13
- package/dist/PlaywrightWorld.mjs.map +1 -1
- package/dist/actions.steps.cjs +66 -66
- package/dist/actions.steps.cjs.map +1 -1
- package/dist/actions.steps.mjs +66 -66
- package/dist/actions.steps.mjs.map +1 -1
- package/dist/outcomes.steps.cjs +73 -60
- package/dist/outcomes.steps.cjs.map +1 -1
- package/dist/outcomes.steps.mjs +73 -60
- package/dist/outcomes.steps.mjs.map +1 -1
- package/package.json +4 -4
package/dist/actions.steps.mjs
CHANGED
|
@@ -4,114 +4,114 @@ import { expect } from '@playwright/test';
|
|
|
4
4
|
// ================
|
|
5
5
|
// Navigation
|
|
6
6
|
Given('I am on the home/front page', async function (world) {
|
|
7
|
-
await world.page.goto(world.baseUrl.toString()
|
|
8
|
-
});
|
|
7
|
+
await world.page.goto(world.baseUrl.toString());
|
|
8
|
+
}, -10);
|
|
9
9
|
Given('I am on {string}', async function (world, path) {
|
|
10
10
|
let url = new URL(path, world.baseUrl);
|
|
11
|
-
await world.page.goto(url.href
|
|
12
|
-
});
|
|
11
|
+
await world.page.goto(url.href);
|
|
12
|
+
}, -10);
|
|
13
13
|
When(`I visit {string}`, async function (world, path) {
|
|
14
14
|
let url = new URL(path, world.baseUrl);
|
|
15
|
-
await world.page.goto(url.href
|
|
16
|
-
});
|
|
15
|
+
await world.page.goto(url.href);
|
|
16
|
+
}, -10);
|
|
17
17
|
When(`I navigate/go to {string}`, async function (world, path) {
|
|
18
18
|
let url = new URL(path, world.baseUrl);
|
|
19
|
-
await world.page.goto(url.href
|
|
20
|
-
});
|
|
19
|
+
await world.page.goto(url.href);
|
|
20
|
+
}, -10);
|
|
21
21
|
When('I load the file {string}', async (world, filepath) => {
|
|
22
22
|
filepath = world.fullPath(filepath).replace(/^.*?\/+/, 'file:///');
|
|
23
|
-
await world.page.goto(filepath
|
|
24
|
-
});
|
|
23
|
+
await world.page.goto(filepath);
|
|
24
|
+
}, -10);
|
|
25
25
|
When('I go back/forward/forwards', async function (world) {
|
|
26
26
|
let direction = world.info.step?.match(/(back|forwards?)$/)[0];
|
|
27
27
|
if (direction === 'back')
|
|
28
|
-
await world.page.goBack(
|
|
28
|
+
await world.page.goBack();
|
|
29
29
|
else
|
|
30
|
-
await world.page.goForward(
|
|
31
|
-
});
|
|
30
|
+
await world.page.goForward();
|
|
31
|
+
}, -10);
|
|
32
32
|
// ================
|
|
33
33
|
// Identities
|
|
34
34
|
Given('(as )a/an/the (user ){string}', async function (world, identity) {
|
|
35
35
|
await world.setIdentity(identity);
|
|
36
|
-
});
|
|
36
|
+
}, -10);
|
|
37
37
|
Given('(as )a/an/the {string} user/role/browser/identity', async function (world, identity) {
|
|
38
38
|
await world.setIdentity(identity);
|
|
39
|
-
});
|
|
39
|
+
}, -10);
|
|
40
40
|
Given('I am {string}', async function (world, identity) {
|
|
41
41
|
await world.setIdentity(identity);
|
|
42
|
-
});
|
|
42
|
+
}, -10);
|
|
43
43
|
Given('I am a/an/the (user ){string}', async function (world, identity) {
|
|
44
44
|
await world.setIdentity(identity);
|
|
45
|
-
});
|
|
45
|
+
}, -10);
|
|
46
46
|
Given('I am a/an/the {string} user/role/browser/identity', async function (world, identity) {
|
|
47
47
|
await world.setIdentity(identity);
|
|
48
|
-
});
|
|
48
|
+
}, -10);
|
|
49
49
|
Then('as {string}', async function (world, identity) {
|
|
50
50
|
await world.setIdentity(identity);
|
|
51
|
-
});
|
|
51
|
+
}, -10);
|
|
52
52
|
// ================
|
|
53
53
|
// Interaction
|
|
54
54
|
When('I click/press/tap/touch (on ){string}', async function (world, identifier) {
|
|
55
55
|
let locator = world.page.getByText(identifier, { exact: true });
|
|
56
|
-
await locator.click(
|
|
57
|
-
});
|
|
58
|
-
When('I click/press/tap/touch (on )the {string} {
|
|
56
|
+
await locator.click();
|
|
57
|
+
}, -10);
|
|
58
|
+
When('I click/press/tap/touch (on )the {string} {word}', async function (world, identifier, role) {
|
|
59
59
|
let locator = world.getLocator(world.page, identifier, role);
|
|
60
|
-
await locator.click(
|
|
61
|
-
});
|
|
60
|
+
await locator.click();
|
|
61
|
+
}, -10);
|
|
62
62
|
When('I focus/select/activate (on ){string}', async function (world, identifier) {
|
|
63
63
|
let locator = await world.page.getByText(identifier, { exact: true });
|
|
64
|
-
await locator.focus(
|
|
64
|
+
await locator.focus();
|
|
65
65
|
await expect(locator).toBeFocused();
|
|
66
|
-
});
|
|
67
|
-
When('I focus/select/activate (on )the {string} {
|
|
66
|
+
}, -10);
|
|
67
|
+
When('I focus/select/activate (on )the {string} {word}', async function (world, identifier, role) {
|
|
68
68
|
let locator = world.getLocator(world.page, identifier, role);
|
|
69
|
-
await locator.focus(
|
|
69
|
+
await locator.focus();
|
|
70
70
|
await expect(locator).toBeFocused();
|
|
71
|
-
});
|
|
71
|
+
}, -10);
|
|
72
72
|
// ================
|
|
73
73
|
// Typing
|
|
74
74
|
When("for/in/on (the ){string} I type {string}", async function (world, identifier, value) {
|
|
75
75
|
let locator = world.getLocator(world.page, identifier, 'input');
|
|
76
|
-
await locator.pressSequentially(value, { delay: world.worldConfig.keyboardDelay
|
|
77
|
-
});
|
|
78
|
-
When("for/in/on (the ){string} {
|
|
76
|
+
await locator.pressSequentially(value, { delay: world.worldConfig.keyboardDelay });
|
|
77
|
+
}, -10);
|
|
78
|
+
When("for/in/on (the ){string} {word} I type {string}", async function (world, identifier, role, value) {
|
|
79
79
|
let locator = world.getLocator(world.page, identifier, role);
|
|
80
|
-
await locator.pressSequentially(value, { delay: world.worldConfig.keyboardDelay
|
|
81
|
-
});
|
|
80
|
+
await locator.pressSequentially(value, { delay: world.worldConfig.keyboardDelay });
|
|
81
|
+
}, -10);
|
|
82
82
|
When('I type the following keys: {}', async function (world, keys) {
|
|
83
83
|
let keyPresses = keys.split(' ');
|
|
84
84
|
for (let key of keyPresses)
|
|
85
85
|
await world.page.keyboard.press(key, { delay: world.worldConfig.keyboardDelay });
|
|
86
|
-
});
|
|
86
|
+
}, -10);
|
|
87
87
|
When("for/in/on (the ){string} I type the following keys: {}", async function (world, identifier, keys) {
|
|
88
88
|
let locator = world.getLocator(world.page, identifier, 'input');
|
|
89
89
|
for (let key of keys.split(' '))
|
|
90
|
-
await locator.press(key, { delay: world.worldConfig.keyboardDelay
|
|
91
|
-
});
|
|
92
|
-
When("for/in/on (the ){string} {
|
|
90
|
+
await locator.press(key, { delay: world.worldConfig.keyboardDelay });
|
|
91
|
+
}, -10);
|
|
92
|
+
When("for/in/on (the ){string} {word} I type the following keys: {}", async function (world, identifier, role, keys) {
|
|
93
93
|
let locator = world.getLocator(world.page, identifier, role);
|
|
94
94
|
for (let key of keys.split(' '))
|
|
95
|
-
await locator.press(key, { delay: world.worldConfig.keyboardDelay
|
|
96
|
-
});
|
|
95
|
+
await locator.press(key, { delay: world.worldConfig.keyboardDelay });
|
|
96
|
+
}, -10);
|
|
97
97
|
// ================
|
|
98
98
|
// Forms
|
|
99
99
|
When("for/in/on (the ){string} I enter/fill/select (in ){string}", async function (world, identifier, value) {
|
|
100
100
|
let locator = world.getLocator(world.page, identifier, 'input');
|
|
101
101
|
await world.setValue(locator, value);
|
|
102
|
-
});
|
|
103
|
-
When("for/in/on (the ){string} {
|
|
102
|
+
}, -10);
|
|
103
|
+
When("for/in/on (the ){string} {word} I enter/fill/select (in ){string}", async function (world, identifier, role, value) {
|
|
104
104
|
let locator = world.getLocator(world.page, identifier, role);
|
|
105
105
|
await world.setValue(locator, value);
|
|
106
|
-
});
|
|
106
|
+
}, -10);
|
|
107
107
|
When("for/in/on (the ){string} I enter/fill/select (in )the following( text):", async function (world, identifier, value) {
|
|
108
108
|
let locator = world.getLocator(world.page, identifier, 'input');
|
|
109
109
|
await world.setValue(locator, value.toString());
|
|
110
|
-
});
|
|
111
|
-
When("for/in/on (the ){string} {
|
|
110
|
+
}, -10);
|
|
111
|
+
When("for/in/on (the ){string} {word} I enter/fill/select (in )the following( text):", async function (world, identifier, role, value) {
|
|
112
112
|
let locator = world.getLocator(world.page, identifier, role);
|
|
113
113
|
await world.setValue(locator, value.toString());
|
|
114
|
-
});
|
|
114
|
+
}, -10);
|
|
115
115
|
When('I enter/fill (in )the following( fields):', async function (world, table) {
|
|
116
116
|
let rows = table.raw();
|
|
117
117
|
let hasRole = rows[0].length === 3;
|
|
@@ -124,65 +124,65 @@ When('I enter/fill (in )the following( fields):', async function (world, table)
|
|
|
124
124
|
let locator = world.getLocator(world.page, identifier, role);
|
|
125
125
|
await world.setValue(locator, value);
|
|
126
126
|
}
|
|
127
|
-
});
|
|
127
|
+
}, -10);
|
|
128
128
|
When('I check (the ){string}( radio)( checkbox)( box)', async function (world, indentifier) {
|
|
129
129
|
let locator = world.getLocator(world.page, indentifier, 'input');
|
|
130
130
|
await world.setValue(locator, 'on');
|
|
131
|
-
});
|
|
131
|
+
}, -10);
|
|
132
132
|
When('I uncheck (the ){string}( checkbox)( box)', async function (world, indentifier) {
|
|
133
133
|
let locator = world.getLocator(world.page, indentifier, 'input');
|
|
134
134
|
await world.setValue(locator, 'off');
|
|
135
|
-
});
|
|
135
|
+
}, -10);
|
|
136
136
|
// ================
|
|
137
137
|
// Waiting
|
|
138
138
|
When('I wait for {string} to be attached/detatched/visible/hidden', async function (world, text) {
|
|
139
139
|
let state = world.info.step?.match(/(attached|detatched|visible|hidden)$/)[0];
|
|
140
140
|
let locator = world.page.getByText(text);
|
|
141
|
-
await locator.waitFor({ state
|
|
142
|
-
});
|
|
143
|
-
When('I wait for a/an/the {string} {
|
|
141
|
+
await locator.waitFor({ state });
|
|
142
|
+
}, -10);
|
|
143
|
+
When('I wait for a/an/the {string} {word} to be attached/detatched/visible/hidden', async function (world, identifier, role) {
|
|
144
144
|
let state = world.info.step?.match(/(attached|detatched|visible|hidden)$/)[0];
|
|
145
145
|
let locator = world.getLocator(world.page, identifier, role);
|
|
146
|
-
await locator.waitFor({ state
|
|
147
|
-
});
|
|
146
|
+
await locator.waitFor({ state });
|
|
147
|
+
}, -10);
|
|
148
148
|
When('I wait (for ){int}ms', async function (world, num) {
|
|
149
149
|
await world.page.waitForTimeout(num);
|
|
150
|
-
});
|
|
150
|
+
}, -10);
|
|
151
151
|
When('I wait (for ){float} second(s)', async function (world, num) {
|
|
152
152
|
await world.page.waitForTimeout(num * 1000);
|
|
153
|
-
});
|
|
153
|
+
}, -10);
|
|
154
154
|
// ================
|
|
155
155
|
// Scrolling
|
|
156
156
|
When('I scroll down/up/left/right', async function (world) {
|
|
157
157
|
let direction = world.info.step?.match(/(down|up|left|right)$/)[0];
|
|
158
158
|
await world.scroll(world.page, direction);
|
|
159
|
-
});
|
|
159
|
+
}, -10);
|
|
160
160
|
When('I scroll down/up/left/right {int}(px)( pixels)', async function (world, num) {
|
|
161
161
|
let direction = world.info.step?.match(/(down|up|left|right)(?= \d)/)[0];
|
|
162
162
|
await world.scroll(world.page, direction, num);
|
|
163
|
-
});
|
|
163
|
+
}, -10);
|
|
164
164
|
// ================
|
|
165
165
|
// Screenshots
|
|
166
166
|
Then('(I )take (a )screenshot', async function (world) {
|
|
167
167
|
await world.screenshot();
|
|
168
|
-
});
|
|
168
|
+
}, -10);
|
|
169
169
|
Then('(I )take (a )screenshot named {string}', async function (world, name) {
|
|
170
170
|
await world.screenshot({ name });
|
|
171
|
-
});
|
|
172
|
-
Then('(I )take (a )screenshot of the {string} {
|
|
171
|
+
}, -10);
|
|
172
|
+
Then('(I )take (a )screenshot of the {string} {word}', async function (world, identifier, role) {
|
|
173
173
|
let locator = world.getLocator(world.page, identifier, role);
|
|
174
174
|
await world.screenshot({ locator });
|
|
175
|
-
});
|
|
176
|
-
Then('(I )take (a )screenshot of the {string} {
|
|
175
|
+
}, -10);
|
|
176
|
+
Then('(I )take (a )screenshot of the {string} {word} named {string}', async function (world, identifier, role, name) {
|
|
177
177
|
let locator = world.getLocator(world.page, identifier, role);
|
|
178
178
|
await world.screenshot({ locator, name });
|
|
179
|
-
});
|
|
179
|
+
}, -10);
|
|
180
180
|
// ================
|
|
181
181
|
// Browser size
|
|
182
182
|
Given('the browser size is (set to ){word}', async function (world, browserSizeTag) {
|
|
183
183
|
await world.setViewportSize(browserSizeTag);
|
|
184
|
-
});
|
|
184
|
+
}, -10);
|
|
185
185
|
Given('the browser size is (set to ){int} x {int}', async function (world, width, height) {
|
|
186
186
|
await world.page.setViewportSize({ width, height });
|
|
187
|
-
});
|
|
187
|
+
}, -10);
|
|
188
188
|
//# sourceMappingURL=actions.steps.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"actions.steps.mjs","sources":["../src/actions.steps.ts"],"sourcesContent":[null],"names":[],"mappings":";;;AAIA;AACA;AAEA,KAAK,CAAC,6BAA6B,EAAE,gBAAgB,KAAqB,EAAA;
|
|
1
|
+
{"version":3,"file":"actions.steps.mjs","sources":["../src/actions.steps.ts"],"sourcesContent":[null],"names":[],"mappings":";;;AAIA;AACA;AAEA,KAAK,CAAC,6BAA6B,EAAE,gBAAgB,KAAqB,EAAA;AACxE,IAAA,MAAM,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC;AACjD,CAAC,EAAE,GAAG,CAAC;AACP,KAAK,CAAC,kBAAkB,EAAE,gBAAgB,KAAqB,EAAE,IAAI,EAAA;IACnE,IAAI,GAAG,GAAG,IAAI,GAAG,CAAC,IAAI,EAAE,KAAK,CAAC,OAAO,CAAC;IACtC,MAAM,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC;AACjC,CAAC,EAAE,GAAG,CAAC;AACP,IAAI,CAAC,CAAkB,gBAAA,CAAA,EAAE,gBAAgB,KAAqB,EAAE,IAAI,EAAA;IAClE,I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,CAAC,4CAA4C,EAAE,gBAAgB,KAAqB,EAAE,KAAY,EAAE,MAAa,EAAA;AACpH,IAAA,MAAM,KAAK,CAAC,IAAI,CAAC,eAAe,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC;AACrD,CAAC,EAAE,GAAG,CAAC"}
|
package/dist/outcomes.steps.cjs
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
var quickpickle = require('quickpickle');
|
|
4
4
|
var test = require('@playwright/test');
|
|
5
5
|
require('./snapshotMatcher.cjs');
|
|
6
|
+
var playwright = require('@axe-core/playwright');
|
|
6
7
|
require('pngjs');
|
|
7
8
|
require('node:fs');
|
|
8
9
|
require('node:path');
|
|
@@ -13,124 +14,124 @@ require('lodash/defaultsDeep');
|
|
|
13
14
|
// Text on page
|
|
14
15
|
quickpickle.Then('I should see {string}( on the page)', async function (world, text) {
|
|
15
16
|
await world.expectText(world.page, text);
|
|
16
|
-
});
|
|
17
|
+
}, -10);
|
|
17
18
|
quickpickle.Then('I should not/NOT see {string}( on the page)', async function (world, text) {
|
|
18
19
|
await world.expectText(world.page, text, false);
|
|
19
|
-
});
|
|
20
|
+
}, -10);
|
|
20
21
|
quickpickle.Then('the text {string} should be visible( on the page)', async function (world, text) {
|
|
21
22
|
await world.expectText(world.page, text);
|
|
22
|
-
});
|
|
23
|
+
}, -10);
|
|
23
24
|
quickpickle.Then('the text {string} should not/NOT be visible( on the page)', async function (world, text) {
|
|
24
25
|
await world.expectText(world.page, text, false);
|
|
25
|
-
});
|
|
26
|
+
}, -10);
|
|
26
27
|
// ================
|
|
27
28
|
// Elements on page
|
|
28
|
-
quickpickle.Then('I should see a/an/the {string} {
|
|
29
|
+
quickpickle.Then('I should see a/an/the {string} {word}', async function (world, identifier, role) {
|
|
29
30
|
let locator = world.getLocator(world.page, identifier, role);
|
|
30
31
|
await world.expectElement(locator);
|
|
31
|
-
});
|
|
32
|
-
quickpickle.Then('I should not/NOT see a/an/the {string} {
|
|
32
|
+
}, -10);
|
|
33
|
+
quickpickle.Then('I should not/NOT see a/an/the {string} {word}', async function (world, identifier, role) {
|
|
33
34
|
let locator = world.getLocator(world.page, identifier, role);
|
|
34
35
|
await world.expectElement(locator, false);
|
|
35
|
-
});
|
|
36
|
+
}, -10);
|
|
36
37
|
quickpickle.Then('I should see a/an/the {string} (element )with (the )(text ){string}', async function (world, identifier, text) {
|
|
37
38
|
let locator = world.getLocator(world.page, identifier, 'element', text);
|
|
38
39
|
await world.expectElement(locator);
|
|
39
|
-
});
|
|
40
|
+
}, -10);
|
|
40
41
|
quickpickle.Then('I should not/NOT see a/an/the {string} (element )with (the )(text ){string}', async function (world, identifier, text) {
|
|
41
42
|
let locator = world.getLocator(world.page, identifier, 'element', text);
|
|
42
43
|
await world.expectElement(locator, false);
|
|
43
|
-
});
|
|
44
|
+
}, -10);
|
|
44
45
|
// ================
|
|
45
46
|
// Element state
|
|
46
|
-
quickpickle.Then('a/an/the {string} {
|
|
47
|
+
quickpickle.Then('a/an/the {string} {word} should be visible/hidden/invisible', async function (world, identifier, role) {
|
|
47
48
|
let state = world.info.step?.match(/(\w+)$/)[0];
|
|
48
49
|
let locator = world.getLocator(world.page, identifier, role);
|
|
49
50
|
await world.expectElement(locator, true, state === 'visible');
|
|
50
|
-
});
|
|
51
|
+
}, -10);
|
|
51
52
|
quickpickle.Then('a/an/the {string} (element )with (the )(text ){string} should be visible/hidden/invisible', async function (world, identifier, text) {
|
|
52
53
|
let state = world.info.step?.match(/(\w+)$/)[0];
|
|
53
54
|
let locator = world.getLocator(world.page, identifier, 'element', text);
|
|
54
55
|
await world.expectElement(locator, true, state === 'visible');
|
|
55
|
-
});
|
|
56
|
-
quickpickle.Then('a/an/the {string} {
|
|
56
|
+
}, -10);
|
|
57
|
+
quickpickle.Then('a/an/the {string} {word} should be attached/detatched', async function (world, identifier, role) {
|
|
57
58
|
let state = world.info.step?.match(/(\w)$/)[0];
|
|
58
59
|
let locator = world.getLocator(world.page, identifier, role);
|
|
59
|
-
await locator.waitFor({ state
|
|
60
|
-
});
|
|
60
|
+
await locator.waitFor({ state });
|
|
61
|
+
}, -10);
|
|
61
62
|
quickpickle.Then('a/an/the {string} (element )with (the )(text ){string} should be attached/detatched', async function (world, identifier, text) {
|
|
62
63
|
let state = world.info.step?.match(/(\w)$/)[0];
|
|
63
64
|
let locator = world.getLocator(world.page, identifier, 'element', text);
|
|
64
|
-
await locator.waitFor({ state
|
|
65
|
-
});
|
|
65
|
+
await locator.waitFor({ state });
|
|
66
|
+
}, -10);
|
|
66
67
|
// disabled / enabled
|
|
67
|
-
quickpickle.Then('a/an/the {string} {
|
|
68
|
+
quickpickle.Then('a/an/the {string} {word} should be disabled', async function (world, identifier, role) {
|
|
68
69
|
let locator = world.getLocator(world.page, identifier, role);
|
|
69
70
|
await test.expect(locator).toBeDisabled();
|
|
70
|
-
});
|
|
71
|
-
quickpickle.Then('a/an/the {string} {
|
|
71
|
+
}, -10);
|
|
72
|
+
quickpickle.Then('a/an/the {string} {word} should be enabled', async function (world, identifier, role) {
|
|
72
73
|
let locator = world.getLocator(world.page, identifier, role);
|
|
73
74
|
await test.expect(locator).toBeEnabled();
|
|
74
|
-
});
|
|
75
|
+
}, -10);
|
|
75
76
|
quickpickle.Then('a/an/the {string} (element )with (the )(text ){string} should be disabled', async function (world, identifier, text) {
|
|
76
77
|
let locator = world.getLocator(world.page, identifier, 'element', text);
|
|
77
78
|
await test.expect(locator).toBeDisabled();
|
|
78
|
-
});
|
|
79
|
+
}, -10);
|
|
79
80
|
quickpickle.Then('a/an/the {string} (element )with (the )(text ){string} should be enabled', async function (world, identifier, text) {
|
|
80
81
|
let locator = world.getLocator(world.page, identifier, 'element', text);
|
|
81
82
|
await test.expect(locator).toBeEnabled();
|
|
82
|
-
});
|
|
83
|
+
}, -10);
|
|
83
84
|
// checked / unchecked
|
|
84
|
-
quickpickle.Then('a/an/the {string} {
|
|
85
|
+
quickpickle.Then('a/an/the {string} {word} should be checked', async function (world, identifier, role) {
|
|
85
86
|
let locator = world.getLocator(world.page, identifier, role);
|
|
86
87
|
await test.expect(locator).toBeChecked();
|
|
87
|
-
});
|
|
88
|
-
quickpickle.Then('a/an/the {string} {
|
|
88
|
+
}, -10);
|
|
89
|
+
quickpickle.Then('a/an/the {string} {word} should be unchecked', async function (world, identifier, role) {
|
|
89
90
|
let locator = world.getLocator(world.page, identifier, role);
|
|
90
91
|
await test.expect(locator).not.toBeChecked();
|
|
91
|
-
});
|
|
92
|
+
}, -10);
|
|
92
93
|
quickpickle.Then('a/an/the {string} (element )with (the )(text ){string} should be checked', async function (world, identifier, text) {
|
|
93
94
|
let locator = world.getLocator(world.page, identifier, 'element', text);
|
|
94
95
|
await test.expect(locator).toBeChecked();
|
|
95
|
-
});
|
|
96
|
+
}, -10);
|
|
96
97
|
quickpickle.Then('a/an/the {string} (element )with (the )(text ){string} should be unchecked', async function (world, identifier, text) {
|
|
97
98
|
let locator = world.getLocator(world.page, identifier, 'element', text);
|
|
98
99
|
await test.expect(locator).not.toBeChecked();
|
|
99
|
-
});
|
|
100
|
+
}, -10);
|
|
100
101
|
// focused / unfocused
|
|
101
|
-
quickpickle.Then('a/an/the {string} {
|
|
102
|
+
quickpickle.Then('a/an/the {string} {word} should be focused/active', async function (world, identifier, role) {
|
|
102
103
|
let locator = world.getLocator(world.page, identifier, role);
|
|
103
104
|
await test.expect(locator).toBeFocused();
|
|
104
|
-
});
|
|
105
|
-
quickpickle.Then('a/an/the {string} {
|
|
105
|
+
}, -10);
|
|
106
|
+
quickpickle.Then('a/an/the {string} {word} should be unfocused/blurred', async function (world, identifier, role) {
|
|
106
107
|
let locator = world.getLocator(world.page, identifier, role);
|
|
107
108
|
await test.expect(locator).not.toBeFocused();
|
|
108
|
-
});
|
|
109
|
+
}, -10);
|
|
109
110
|
quickpickle.Then('a/an/the {string} (element )with (the )(text ){string} should be focused/active', async function (world, identifier, text) {
|
|
110
111
|
let locator = world.getLocator(world.page, identifier, 'element', text);
|
|
111
112
|
await test.expect(locator).toBeFocused();
|
|
112
|
-
});
|
|
113
|
+
}, -10);
|
|
113
114
|
quickpickle.Then('a/an/the {string} (element )with (the )(text ){string} should be unfocused/blurred', async function (world, identifier, text) {
|
|
114
115
|
let locator = world.getLocator(world.page, identifier, 'element', text);
|
|
115
116
|
await test.expect(locator).not.toBeFocused();
|
|
116
|
-
});
|
|
117
|
+
}, -10);
|
|
117
118
|
// in viewport / out of viewport
|
|
118
|
-
quickpickle.Then('a/an/the {string} {
|
|
119
|
+
quickpickle.Then('a/an/the {string} {word} should be in(side) (of )the viewport', async function (world, identifier, role) {
|
|
119
120
|
let locator = world.getLocator(world.page, identifier, role);
|
|
120
121
|
await test.expect(locator).toBeInViewport();
|
|
121
|
-
});
|
|
122
|
-
quickpickle.Then('a/an/the {string} {
|
|
122
|
+
}, -10);
|
|
123
|
+
quickpickle.Then('a/an/the {string} {word} should be out(side) (of )the viewport', async function (world, identifier, role) {
|
|
123
124
|
let locator = world.getLocator(world.page, identifier, role);
|
|
124
125
|
await test.expect(locator).not.toBeInViewport();
|
|
125
|
-
});
|
|
126
|
+
}, -10);
|
|
126
127
|
quickpickle.Then('a/an/the {string} (element )with (the )(text ){string} should be in(side) (of )the viewport', async function (world, identifier, text) {
|
|
127
128
|
let locator = world.getLocator(world.page, identifier, 'element', text);
|
|
128
129
|
await test.expect(locator).toBeInViewport();
|
|
129
|
-
});
|
|
130
|
+
}, -10);
|
|
130
131
|
quickpickle.Then('a/an/the {string} (element )with (the )(text ){string} should be out(side) (of )the viewport', async function (world, identifier, text) {
|
|
131
132
|
let locator = world.getLocator(world.page, identifier, 'element', text);
|
|
132
133
|
await test.expect(locator).not.toBeInViewport();
|
|
133
|
-
});
|
|
134
|
+
}, -10);
|
|
134
135
|
// Values
|
|
135
136
|
quickpickle.Then('a/an/the (value of ){string} should contain/include/be/equal {string}', async function (world, identifier, expected) {
|
|
136
137
|
let exact = world.info.step?.match(/ should (?:be|equal) ['"]/) ? true : false;
|
|
@@ -141,8 +142,8 @@ quickpickle.Then('a/an/the (value of ){string} should contain/include/be/equal {
|
|
|
141
142
|
let actual = await locator.inputValue();
|
|
142
143
|
await test.expect(actual).toContain(expected);
|
|
143
144
|
}
|
|
144
|
-
});
|
|
145
|
-
quickpickle.Then('a/an/the (value of )(the ){string} {
|
|
145
|
+
}, -10);
|
|
146
|
+
quickpickle.Then('a/an/the (value of )(the ){string} {word} should contain/include/be/equal {string}', async function (world, identifier, role, expected) {
|
|
146
147
|
let exact = world.info.step?.match(/ should (?:be|equal) ['"]/) ? true : false;
|
|
147
148
|
if (role === 'metatag')
|
|
148
149
|
await world.expectMetatag(world.page, identifier, expected, exact);
|
|
@@ -155,7 +156,7 @@ quickpickle.Then('a/an/the (value of )(the ){string} {AriaRole} should contain/i
|
|
|
155
156
|
await test.expect(actual).toContain(expected);
|
|
156
157
|
}
|
|
157
158
|
}
|
|
158
|
-
});
|
|
159
|
+
}, -10);
|
|
159
160
|
quickpickle.Then('a/an/the (value of )(the ){string} should not/NOT contain/include/be/equal {string}', async function (world, identifier, expected) {
|
|
160
161
|
let exact = world.info.step?.match(/ should (?:not|NOT) (?:be|equal) ['"]/) ? true : false;
|
|
161
162
|
let locator = world.getLocator(world.page, identifier, 'input');
|
|
@@ -165,8 +166,8 @@ quickpickle.Then('a/an/the (value of )(the ){string} should not/NOT contain/incl
|
|
|
165
166
|
let actual = await locator.inputValue();
|
|
166
167
|
await test.expect(actual).not.toContain(expected);
|
|
167
168
|
}
|
|
168
|
-
});
|
|
169
|
-
quickpickle.Then('a/an/the (value of )(the ){string} {
|
|
169
|
+
}, -10);
|
|
170
|
+
quickpickle.Then('a/an/the (value of )(the ){string} {word} should not/NOT contain/include/be/equal {string}', async function (world, identifier, role, expected) {
|
|
170
171
|
let exact = world.info.step?.match(/ should (?:not|NOT) (?:be|equal) ['"]/) ? true : false;
|
|
171
172
|
if (role === 'metatag')
|
|
172
173
|
await world.expectMetatag(world.page, identifier, expected, exact, false);
|
|
@@ -179,41 +180,41 @@ quickpickle.Then('a/an/the (value of )(the ){string} {AriaRole} should not/NOT c
|
|
|
179
180
|
await test.expect(actual).not.toContain(expected);
|
|
180
181
|
}
|
|
181
182
|
}
|
|
182
|
-
});
|
|
183
|
+
}, -10);
|
|
183
184
|
// Metatags
|
|
184
185
|
quickpickle.Then('the meta( )tag {string} should contain/include/be/equal {string}', async function (world, name, expected) {
|
|
185
186
|
let exact = world.info.step?.match(/ should (?:be|equal) ['"]/) ? true : false;
|
|
186
187
|
await world.expectMetatag(world.page, name, expected, exact);
|
|
187
|
-
});
|
|
188
|
+
}, -9);
|
|
188
189
|
quickpickle.Then('the meta( )tag {string} should not/NOT contain/include/be/equal {string}', async function (world, name, expected) {
|
|
189
190
|
let exact = world.info.step?.match(/ should (?:not|NOT) (?:be|equal) ['"]/) ? true : false;
|
|
190
191
|
await world.expectMetatag(world.page, name, expected, exact, false);
|
|
191
|
-
});
|
|
192
|
+
}, -9);
|
|
192
193
|
quickpickle.Then('the {string} meta( )tag should contain/include/be/equal {string}', async function (world, name, expected) {
|
|
193
194
|
let exact = world.info.step?.match(/ should (?:be|equal) ['"]/) ? true : false;
|
|
194
195
|
await world.expectMetatag(world.page, name, expected, exact);
|
|
195
|
-
});
|
|
196
|
+
}, -9);
|
|
196
197
|
quickpickle.Then('the {string} meta( )tag should not/NOT contain/include/be/equal {string}', async function (world, name, expected) {
|
|
197
198
|
let exact = world.info.step?.match(/ should (?:not|NOT) (?:be|equal) ['"]/) ? true : false;
|
|
198
199
|
await world.expectMetatag(world.page, name, expected, exact, false);
|
|
199
|
-
});
|
|
200
|
+
}, -9);
|
|
200
201
|
// Visual regression testing
|
|
201
202
|
quickpickle.Then('(the )screenshot should match', async function (world) {
|
|
202
203
|
await world.expectScreenshotMatch(world.page, world.screenshotPath, { fullPage: true });
|
|
203
|
-
});
|
|
204
|
+
}, -10);
|
|
204
205
|
quickpickle.Then('(the )screenshot {string} should match', async function (world, name) {
|
|
205
206
|
let explodedTags = world.info.explodedIdx ? `_(${world.info.tags.join(',')})` : '';
|
|
206
207
|
await world.expectScreenshotMatch(world.page, `${world.screenshotDir}/${name}${explodedTags}.png`, { fullPage: true });
|
|
207
|
-
});
|
|
208
|
-
quickpickle.Then('(the )screenshot of the {string} {
|
|
208
|
+
}, -10);
|
|
209
|
+
quickpickle.Then('(the )screenshot of the {string} {word} should match', async function (world, identifier, role) {
|
|
209
210
|
let locator = world.getLocator(world.page, identifier, role);
|
|
210
211
|
await world.expectScreenshotMatch(locator, world.screenshotPath);
|
|
211
|
-
});
|
|
212
|
-
quickpickle.Then('(the )screenshot {string} of the {string} {
|
|
212
|
+
}, -10);
|
|
213
|
+
quickpickle.Then('(the )screenshot {string} of the {string} {word} should match', async function (world, name, identifier, role) {
|
|
213
214
|
let locator = world.getLocator(world.page, identifier, role);
|
|
214
215
|
let explodedTags = world.info.explodedIdx ? `_(${world.info.tags.join(',')})` : '';
|
|
215
216
|
await world.expectScreenshotMatch(locator, `${world.screenshotDir}/${name}${explodedTags}.png`);
|
|
216
|
-
});
|
|
217
|
+
}, -10);
|
|
217
218
|
// Browser context
|
|
218
219
|
quickpickle.Then('the user agent should contain/be {string}', async function (world, ua) {
|
|
219
220
|
let exact = world.info.step?.match(/ should (?:be|equal) ['"]/) ? true : false;
|
|
@@ -221,12 +222,24 @@ quickpickle.Then('the user agent should contain/be {string}', async function (wo
|
|
|
221
222
|
await test.expect(world.browser.browserType().name()).toBe(ua);
|
|
222
223
|
else
|
|
223
224
|
await test.expect(world.browser.browserType().name()).toContain(ua);
|
|
224
|
-
});
|
|
225
|
+
}, -10);
|
|
225
226
|
quickpickle.Then('the url should contain/include/be/equal {string}', async function (world, url) {
|
|
226
227
|
let exact = world.info.step?.match(/ should (?:be|equal) ['"]/) ? true : false;
|
|
227
228
|
if (exact)
|
|
228
229
|
await test.expect(world.page.url()).toBe(url);
|
|
229
230
|
else
|
|
230
231
|
await test.expect(world.page.url()).toContain(url);
|
|
231
|
-
});
|
|
232
|
+
}, -10);
|
|
233
|
+
// Accessibility testing
|
|
234
|
+
quickpickle.Then('all accessibility tests should pass', async function (world) {
|
|
235
|
+
let axeBuilder = new playwright.AxeBuilder({ page: world.page });
|
|
236
|
+
if (world.worldConfig.accessibilityExcludes) {
|
|
237
|
+
let excludes = Array.isArray(world.worldConfig.accessibilityExcludes) ? world.worldConfig.accessibilityExcludes : [world.worldConfig.accessibilityExcludes];
|
|
238
|
+
excludes.forEach(exclude => {
|
|
239
|
+
axeBuilder.exclude(exclude);
|
|
240
|
+
});
|
|
241
|
+
}
|
|
242
|
+
let results = await axeBuilder.analyze();
|
|
243
|
+
test.expect(results.violations).toHaveLength(0);
|
|
244
|
+
}, -10);
|
|
232
245
|
//# sourceMappingURL=outcomes.steps.cjs.map
|