@quickpickle/playwright 0.9.4 → 0.9.6

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.
@@ -2,49 +2,159 @@
2
2
 
3
3
  var quickpickle = require('quickpickle');
4
4
  var test = require('@playwright/test');
5
+ require('./snapshotMatcher.cjs');
6
+ require('pngjs');
7
+ require('node:fs');
8
+ require('node:path');
9
+ require('pixelmatch');
10
+ require('lodash-es');
5
11
 
6
- quickpickle.Then('I should see {string}', async function (world, text) {
7
- await world.page.waitForTimeout(50);
12
+ async function getLocator(el, identifier, role, text = null) {
13
+ let locator;
14
+ if (role === 'element')
15
+ locator = await el.locator(identifier);
16
+ else
17
+ locator = await el.getByRole(role, { name: identifier });
18
+ if (text)
19
+ locator = await locator.filter({ hasText: text });
20
+ return locator;
21
+ }
22
+ quickpickle.Then('I should see {string}( somewhere)( on the page)', async function (world, text) {
8
23
  await test.expect(world.page.getByText(text)).toBeVisible();
9
24
  });
10
- quickpickle.Then('I should not see {string}', async function (world, text) {
11
- await world.page.waitForTimeout(50);
25
+ quickpickle.Then('I should not see {string}( anywhere)( on the page)', async function (world, text) {
12
26
  await test.expect(world.page.getByText(text)).not.toBeVisible();
13
27
  });
28
+ quickpickle.Then('I should see a(n)/the {string} with (the )(text ){string}', async function (world, identifier, text) {
29
+ let locator = await getLocator(world.page, identifier, 'element', text);
30
+ await test.expect(locator).toBeVisible();
31
+ });
32
+ quickpickle.Then('I should not see a(n)/the {string} with (the )(text ){string}', async function (world, identifier, text) {
33
+ let locator = await getLocator(world.page, identifier, 'element', text);
34
+ await test.expect(locator).not.toBeVisible();
35
+ });
36
+ quickpickle.Then('I should see a(n)/the {string} {word} with (the )(text ){string}', async function (world, identifier, role, text) {
37
+ let locator = await getLocator(world.page, identifier, role, text);
38
+ await test.expect(locator).toBeVisible();
39
+ });
40
+ quickpickle.Then('I should not see a(n)/the {string} {word} with (the )(text ){string}', async function (world, identifier, role, text) {
41
+ let locator = await getLocator(world.page, identifier, role, text);
42
+ await test.expect(locator).not.toBeVisible();
43
+ });
14
44
  quickpickle.Then('I should see a(n)/the {string} {word}', async function (world, identifier, role) {
15
- await world.page.waitForTimeout(50);
16
- if (role === 'element')
17
- await test.expect(world.page.locator(identifier)).toBeVisible();
18
- else
19
- await test.expect(world.page.getByRole(role, { name: identifier })).toBeVisible();
45
+ let locator = await getLocator(world.page, identifier, role);
46
+ await test.expect(locator).toBeVisible();
20
47
  });
21
48
  quickpickle.Then('I should not see a(n)/the {string} {word}', async function (world, identifier, role) {
22
- await world.page.waitForTimeout(50);
23
- if (role === 'element')
24
- await test.expect(world.page.locator(identifier)).not.toBeVisible();
25
- else
26
- await test.expect(world.page.getByRole(role, { name: identifier })).not.toBeVisible();
49
+ let locator = await getLocator(world.page, identifier, role);
50
+ await test.expect(locator).not.toBeVisible();
51
+ });
52
+ quickpickle.Then('a/an/the {string} should be disabled', async function (world, identifier) {
53
+ let locator = await getLocator(world.page, identifier, 'element');
54
+ await test.expect(locator).toBeDisabled();
55
+ });
56
+ quickpickle.Then('a/an/the {string} should be enabled', async function (world, identifier) {
57
+ let locator = await getLocator(world.page, identifier, 'element');
58
+ await test.expect(locator).toBeEnabled();
59
+ });
60
+ quickpickle.Then('a/an/the {string} should be checked', async function (world, identifier) {
61
+ let locator = await getLocator(world.page, identifier, 'element');
62
+ await test.expect(locator).toBeChecked();
63
+ });
64
+ quickpickle.Then('a/an/the {string} should be unchecked', async function (world, identifier) {
65
+ let locator = await getLocator(world.page, identifier, 'element');
66
+ await test.expect(locator).not.toBeChecked();
67
+ });
68
+ quickpickle.Then('a/an/the {string} should be focused/active', async function (world, identifier) {
69
+ let locator = await getLocator(world.page, identifier, 'element');
70
+ await test.expect(locator).toBeFocused();
71
+ });
72
+ quickpickle.Then('a/an/the {string} should be unfocused/blurred', async function (world, identifier) {
73
+ let locator = await getLocator(world.page, identifier, 'element');
74
+ await test.expect(locator).not.toBeFocused();
75
+ });
76
+ quickpickle.Then('a/an/the {string} should be visible', async function (world, identifier) {
77
+ let locator = await getLocator(world.page, identifier, 'element');
78
+ await test.expect(locator).toBeVisible();
79
+ });
80
+ quickpickle.Then('a/an/the {string} should be hidden/invisible', async function (world, identifier) {
81
+ let locator = await getLocator(world.page, identifier, 'element');
82
+ await test.expect(locator).not.toBeVisible();
83
+ });
84
+ quickpickle.Then('a/an/the {string} {word} should be disabled', async function (world, identifier, role) {
85
+ let locator = await getLocator(world.page, identifier, role);
86
+ await test.expect(locator).toBeDisabled();
27
87
  });
28
- quickpickle.Then('I should see a(n)/the {string} with the text {string}', async function (world, identifier, text) {
29
- await world.page.waitForTimeout(50);
30
- await test.expect(world.page.locator(identifier).filter({ hasText: text })).toBeVisible();
88
+ quickpickle.Then('a/an/the {string} {word} should be enabled', async function (world, identifier, role) {
89
+ let locator = await getLocator(world.page, identifier, role);
90
+ await test.expect(locator).toBeEnabled();
31
91
  });
32
- quickpickle.Then('I should not see a(n)/the {string} with the text {string}', async function (world, identifier, text) {
33
- await world.page.waitForTimeout(50);
34
- await test.expect(world.page.locator(identifier).filter({ hasText: text })).not.toBeVisible();
92
+ quickpickle.Then('a/an/the {string} {word} should be checked', async function (world, identifier, role) {
93
+ let locator = await getLocator(world.page, identifier, role);
94
+ await test.expect(locator).toBeChecked();
35
95
  });
36
- quickpickle.Then('the (value of ){string} (value )should contain/include/be/equal {string}', async function (world, identifier, val) {
96
+ quickpickle.Then('a/an/the {string} {word} should be unchecked', async function (world, identifier, role) {
97
+ let locator = await getLocator(world.page, identifier, role);
98
+ await test.expect(locator).not.toBeChecked();
99
+ });
100
+ quickpickle.Then('a/an/the {string} {word} should be focused/active', async function (world, identifier, role) {
101
+ let locator = await getLocator(world.page, identifier, role);
102
+ await test.expect(locator).toBeFocused();
103
+ });
104
+ quickpickle.Then('a/an/the {string} {word} should be unfocused/blurred', async function (world, identifier, role) {
105
+ let locator = await getLocator(world.page, identifier, role);
106
+ await test.expect(locator).not.toBeFocused();
107
+ });
108
+ quickpickle.Then('a/an/the {string} {word} should be visible', async function (world, identifier, role) {
109
+ let locator = await getLocator(world.page, identifier, role);
110
+ await test.expect(locator).toBeVisible();
111
+ });
112
+ quickpickle.Then('a/an/the {string} {word} should be hidden/invisible', async function (world, identifier, role) {
113
+ let locator = await getLocator(world.page, identifier, role);
114
+ await test.expect(locator).not.toBeVisible();
115
+ });
116
+ quickpickle.Then('a/an/the {string} {word} with (the )(text ){string} should be disabled', async function (world, identifier, role, text) {
117
+ let locator = await getLocator(world.page, identifier, role, text);
118
+ await test.expect(locator).toBeDisabled();
119
+ });
120
+ quickpickle.Then('a/an/the {string} {word} with (the )(text ){string} should be enabled', async function (world, identifier, role, text) {
121
+ let locator = await getLocator(world.page, identifier, role, text);
122
+ await test.expect(locator).toBeEnabled();
123
+ });
124
+ quickpickle.Then('a/an/the {string} {word} with (the )(text ){string} should be checked', async function (world, identifier, role, text) {
125
+ let locator = await getLocator(world.page, identifier, role, text);
126
+ await test.expect(locator).toBeChecked();
127
+ });
128
+ quickpickle.Then('a/an/the {string} {word} with (the )(text ){string} should be unchecked', async function (world, identifier, role, text) {
129
+ let locator = await getLocator(world.page, identifier, role, text);
130
+ await test.expect(locator).not.toBeChecked();
131
+ });
132
+ quickpickle.Then('a/an/the {string} {word} with (the )(text ){string} should be focused', async function (world, identifier, role, text) {
133
+ let locator = await getLocator(world.page, identifier, role, text);
134
+ await test.expect(locator).toBeFocused();
135
+ });
136
+ quickpickle.Then('a/an/the {string} {word} with (the )(text ){string} should be unfocused/blurred', async function (world, identifier, role, text) {
137
+ let locator = await getLocator(world.page, identifier, role, text);
138
+ await test.expect(locator).not.toBeFocused();
139
+ });
140
+ quickpickle.Then('a/an/the {string} {word} with (the )(text ){string} should be visible', async function (world, identifier, role, text) {
141
+ let locator = await getLocator(world.page, identifier, role, text);
142
+ await test.expect(locator).toBeVisible();
143
+ });
144
+ quickpickle.Then('a/an/the {string} {word} with (the )(text ){string} should be hidden/invisible', async function (world, identifier, role, text) {
145
+ let locator = await getLocator(world.page, identifier, role, text);
146
+ await test.expect(locator).not.toBeVisible();
147
+ });
148
+ quickpickle.Then('a/an/the (value of ){string} (value )should contain/include/be/equal {string}', async function (world, identifier, val) {
37
149
  let exact = world.info.step?.match(/should not (?:be|equal) ["']/) ? true : false;
38
- await world.page.waitForTimeout(50);
39
150
  let value = await (await world.page.locator(identifier)).inputValue();
40
151
  if (exact)
41
152
  await test.expect(value).toEqual(val);
42
153
  else
43
154
  await test.expect(value).toContain(val);
44
155
  });
45
- quickpickle.Then('the (value of ){string} (value )should not contain/include/be/equal {string}', async function (world, identifier, val) {
156
+ quickpickle.Then('a/an/the (value of ){string} (value )should not contain/include/be/equal {string}', async function (world, identifier, val) {
46
157
  let exact = world.info.step?.match(/should not (?:be|equal) ["']/) ? true : false;
47
- await world.page.waitForTimeout(50);
48
158
  let value = await (await world.page.locator(identifier)).inputValue();
49
159
  if (exact)
50
160
  await test.expect(value).not.toEqual(val);
@@ -52,7 +162,6 @@ quickpickle.Then('the (value of ){string} (value )should not contain/include/be/
52
162
  await test.expect(value).not.toContain(val);
53
163
  });
54
164
  quickpickle.Then(/^the metatag for "([^"]+)" should (be|equal|contain) "(.*)"$/, async function (world, name, eq, value) {
55
- await world.page.waitForTimeout(50);
56
165
  let val;
57
166
  if (name === 'title')
58
167
  val = await world.page.title();
@@ -65,14 +174,16 @@ quickpickle.Then(/^the metatag for "([^"]+)" should (be|equal|contain) "(.*)"$/,
65
174
  else
66
175
  await test.expect(val).toBe(value);
67
176
  });
68
- quickpickle.Then('the active element should be {string}', async function (world, identifier) {
69
- await world.page.waitForTimeout(50);
70
- let locator = await world.page.locator(identifier);
71
- await test.expect(locator).toBeFocused();
177
+ quickpickle.Then('(the )screenshot should match', async function (world) {
178
+ await test.expect(world.page).toMatchScreenshot(`${world.playwrightConfig.screenshotDir}/${world.info.rule ? world.info.rule + '__' + world.info.scenario : world.info.scenario}__${world.info.line}.png`);
72
179
  });
73
- quickpickle.Then('the active element should be the {string} {word}', async function (world, identifier, role) {
74
- await world.page.waitForTimeout(50);
75
- let locator = await world.page.getByRole(role, { name: identifier });
76
- await test.expect(locator).toBeFocused();
180
+ quickpickle.Then('(the )screenshot {string} should match', async function (world, name) {
181
+ await test.expect(world.page).toMatchScreenshot(`${world.playwrightConfig.screenshotDir}/${name}.png`);
182
+ });
183
+ quickpickle.Then('the user agent should contain/be {string}', async function (world, ua) {
184
+ await test.expect(world.browser.browserType().name()).toContain(ua);
185
+ });
186
+ quickpickle.Then('the url should contain {string}', async function (world, url) {
187
+ await test.expect(world.page.url()).toContain(url);
77
188
  });
78
189
  //# sourceMappingURL=outcomes.steps.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"outcomes.steps.cjs","sources":["../src/outcomes.steps.ts"],"sourcesContent":[null],"names":["Then","expect"],"mappings":";;;;;AAIAA,gBAAI,CAAC,uBAAuB,EAAE,gBAAgB,KAAqB,EAAE,IAAI,EAAA;IACvE,MAAM,KAAK,CAAC,IAAI,CAAC,cAAc,CAAC,EAAE,CAAC,CAAA;AACnC,IAAA,MAAMC,WAAM,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,WAAW,EAAE,CAAA;AACxD,CAAC,CAAC,CAAA;AACFD,gBAAI,CAAC,2BAA2B,EAAE,gBAAgB,KAAqB,EAAE,IAAI,EAAA;IAC3E,MAAM,KAAK,CAAC,IAAI,CAAC,cAAc,CAAC,EAAE,CAAC,CAAA;AACnC,IAAA,MAAMC,WAAM,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,WAAW,EAAE,CAAA;AAC5D,CAAC,CAAC,CAAA;AAEFD,gBAAI,CAAC,uCAAuC,EAAE,gBAAgB,KAAqB,EAAE,UAAU,EAAE,IAAI,EAAA;IACnG,MAAM,KAAK,CAAC,IAAI,CAAC,cAAc,CAAC,EAAE,CAAC,CAAA;IACnC,IAAI,IAAI,KAAK,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C,OAAO,CAAC,WAAW,EAAE,CAAC,IAAI,EAAE,CAAC,CAAC,SAAS,CAAC,EAAE,CAAC,CAAA;AAChE,CAAC,CAAC,CAAA;AACFD,gBAAI,CAAC,iCAAiC,EAAE,gBAAgB,KAAqB,EAAE,GAAG,EAAA;AAChF,IAAA,MAAMC,WAAM,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,CAAA;AAC/C,CAAC,CAAC;;"}
@@ -1 +1 @@
1
- export {};
1
+ import './snapshotMatcher';
@@ -1,48 +1,158 @@
1
1
  import { Then } from 'quickpickle';
2
2
  import { expect } from '@playwright/test';
3
+ import './snapshotMatcher.mjs';
4
+ import 'pngjs';
5
+ import 'node:fs';
6
+ import 'node:path';
7
+ import 'pixelmatch';
8
+ import 'lodash-es';
3
9
 
4
- Then('I should see {string}', async function (world, text) {
5
- await world.page.waitForTimeout(50);
10
+ async function getLocator(el, identifier, role, text = null) {
11
+ let locator;
12
+ if (role === 'element')
13
+ locator = await el.locator(identifier);
14
+ else
15
+ locator = await el.getByRole(role, { name: identifier });
16
+ if (text)
17
+ locator = await locator.filter({ hasText: text });
18
+ return locator;
19
+ }
20
+ Then('I should see {string}( somewhere)( on the page)', async function (world, text) {
6
21
  await expect(world.page.getByText(text)).toBeVisible();
7
22
  });
8
- Then('I should not see {string}', async function (world, text) {
9
- await world.page.waitForTimeout(50);
23
+ Then('I should not see {string}( anywhere)( on the page)', async function (world, text) {
10
24
  await expect(world.page.getByText(text)).not.toBeVisible();
11
25
  });
26
+ Then('I should see a(n)/the {string} with (the )(text ){string}', async function (world, identifier, text) {
27
+ let locator = await getLocator(world.page, identifier, 'element', text);
28
+ await expect(locator).toBeVisible();
29
+ });
30
+ Then('I should not see a(n)/the {string} with (the )(text ){string}', async function (world, identifier, text) {
31
+ let locator = await getLocator(world.page, identifier, 'element', text);
32
+ await expect(locator).not.toBeVisible();
33
+ });
34
+ Then('I should see a(n)/the {string} {word} with (the )(text ){string}', async function (world, identifier, role, text) {
35
+ let locator = await getLocator(world.page, identifier, role, text);
36
+ await expect(locator).toBeVisible();
37
+ });
38
+ Then('I should not see a(n)/the {string} {word} with (the )(text ){string}', async function (world, identifier, role, text) {
39
+ let locator = await getLocator(world.page, identifier, role, text);
40
+ await expect(locator).not.toBeVisible();
41
+ });
12
42
  Then('I should see a(n)/the {string} {word}', async function (world, identifier, role) {
13
- await world.page.waitForTimeout(50);
14
- if (role === 'element')
15
- await expect(world.page.locator(identifier)).toBeVisible();
16
- else
17
- await expect(world.page.getByRole(role, { name: identifier })).toBeVisible();
43
+ let locator = await getLocator(world.page, identifier, role);
44
+ await expect(locator).toBeVisible();
18
45
  });
19
46
  Then('I should not see a(n)/the {string} {word}', async function (world, identifier, role) {
20
- await world.page.waitForTimeout(50);
21
- if (role === 'element')
22
- await expect(world.page.locator(identifier)).not.toBeVisible();
23
- else
24
- await expect(world.page.getByRole(role, { name: identifier })).not.toBeVisible();
47
+ let locator = await getLocator(world.page, identifier, role);
48
+ await expect(locator).not.toBeVisible();
49
+ });
50
+ Then('a/an/the {string} should be disabled', async function (world, identifier) {
51
+ let locator = await getLocator(world.page, identifier, 'element');
52
+ await expect(locator).toBeDisabled();
53
+ });
54
+ Then('a/an/the {string} should be enabled', async function (world, identifier) {
55
+ let locator = await getLocator(world.page, identifier, 'element');
56
+ await expect(locator).toBeEnabled();
57
+ });
58
+ Then('a/an/the {string} should be checked', async function (world, identifier) {
59
+ let locator = await getLocator(world.page, identifier, 'element');
60
+ await expect(locator).toBeChecked();
61
+ });
62
+ Then('a/an/the {string} should be unchecked', async function (world, identifier) {
63
+ let locator = await getLocator(world.page, identifier, 'element');
64
+ await expect(locator).not.toBeChecked();
65
+ });
66
+ Then('a/an/the {string} should be focused/active', async function (world, identifier) {
67
+ let locator = await getLocator(world.page, identifier, 'element');
68
+ await expect(locator).toBeFocused();
69
+ });
70
+ Then('a/an/the {string} should be unfocused/blurred', async function (world, identifier) {
71
+ let locator = await getLocator(world.page, identifier, 'element');
72
+ await expect(locator).not.toBeFocused();
73
+ });
74
+ Then('a/an/the {string} should be visible', async function (world, identifier) {
75
+ let locator = await getLocator(world.page, identifier, 'element');
76
+ await expect(locator).toBeVisible();
77
+ });
78
+ Then('a/an/the {string} should be hidden/invisible', async function (world, identifier) {
79
+ let locator = await getLocator(world.page, identifier, 'element');
80
+ await expect(locator).not.toBeVisible();
81
+ });
82
+ Then('a/an/the {string} {word} should be disabled', async function (world, identifier, role) {
83
+ let locator = await getLocator(world.page, identifier, role);
84
+ await expect(locator).toBeDisabled();
25
85
  });
26
- Then('I should see a(n)/the {string} with the text {string}', async function (world, identifier, text) {
27
- await world.page.waitForTimeout(50);
28
- await expect(world.page.locator(identifier).filter({ hasText: text })).toBeVisible();
86
+ Then('a/an/the {string} {word} should be enabled', async function (world, identifier, role) {
87
+ let locator = await getLocator(world.page, identifier, role);
88
+ await expect(locator).toBeEnabled();
29
89
  });
30
- Then('I should not see a(n)/the {string} with the text {string}', async function (world, identifier, text) {
31
- await world.page.waitForTimeout(50);
32
- await expect(world.page.locator(identifier).filter({ hasText: text })).not.toBeVisible();
90
+ Then('a/an/the {string} {word} should be checked', async function (world, identifier, role) {
91
+ let locator = await getLocator(world.page, identifier, role);
92
+ await expect(locator).toBeChecked();
33
93
  });
34
- Then('the (value of ){string} (value )should contain/include/be/equal {string}', async function (world, identifier, val) {
94
+ Then('a/an/the {string} {word} should be unchecked', async function (world, identifier, role) {
95
+ let locator = await getLocator(world.page, identifier, role);
96
+ await expect(locator).not.toBeChecked();
97
+ });
98
+ Then('a/an/the {string} {word} should be focused/active', async function (world, identifier, role) {
99
+ let locator = await getLocator(world.page, identifier, role);
100
+ await expect(locator).toBeFocused();
101
+ });
102
+ Then('a/an/the {string} {word} should be unfocused/blurred', async function (world, identifier, role) {
103
+ let locator = await getLocator(world.page, identifier, role);
104
+ await expect(locator).not.toBeFocused();
105
+ });
106
+ Then('a/an/the {string} {word} should be visible', async function (world, identifier, role) {
107
+ let locator = await getLocator(world.page, identifier, role);
108
+ await expect(locator).toBeVisible();
109
+ });
110
+ Then('a/an/the {string} {word} should be hidden/invisible', async function (world, identifier, role) {
111
+ let locator = await getLocator(world.page, identifier, role);
112
+ await expect(locator).not.toBeVisible();
113
+ });
114
+ Then('a/an/the {string} {word} with (the )(text ){string} should be disabled', async function (world, identifier, role, text) {
115
+ let locator = await getLocator(world.page, identifier, role, text);
116
+ await expect(locator).toBeDisabled();
117
+ });
118
+ Then('a/an/the {string} {word} with (the )(text ){string} should be enabled', async function (world, identifier, role, text) {
119
+ let locator = await getLocator(world.page, identifier, role, text);
120
+ await expect(locator).toBeEnabled();
121
+ });
122
+ Then('a/an/the {string} {word} with (the )(text ){string} should be checked', async function (world, identifier, role, text) {
123
+ let locator = await getLocator(world.page, identifier, role, text);
124
+ await expect(locator).toBeChecked();
125
+ });
126
+ Then('a/an/the {string} {word} with (the )(text ){string} should be unchecked', async function (world, identifier, role, text) {
127
+ let locator = await getLocator(world.page, identifier, role, text);
128
+ await expect(locator).not.toBeChecked();
129
+ });
130
+ Then('a/an/the {string} {word} with (the )(text ){string} should be focused', async function (world, identifier, role, text) {
131
+ let locator = await getLocator(world.page, identifier, role, text);
132
+ await expect(locator).toBeFocused();
133
+ });
134
+ Then('a/an/the {string} {word} with (the )(text ){string} should be unfocused/blurred', async function (world, identifier, role, text) {
135
+ let locator = await getLocator(world.page, identifier, role, text);
136
+ await expect(locator).not.toBeFocused();
137
+ });
138
+ Then('a/an/the {string} {word} with (the )(text ){string} should be visible', async function (world, identifier, role, text) {
139
+ let locator = await getLocator(world.page, identifier, role, text);
140
+ await expect(locator).toBeVisible();
141
+ });
142
+ Then('a/an/the {string} {word} with (the )(text ){string} should be hidden/invisible', async function (world, identifier, role, text) {
143
+ let locator = await getLocator(world.page, identifier, role, text);
144
+ await expect(locator).not.toBeVisible();
145
+ });
146
+ Then('a/an/the (value of ){string} (value )should contain/include/be/equal {string}', async function (world, identifier, val) {
35
147
  let exact = world.info.step?.match(/should not (?:be|equal) ["']/) ? true : false;
36
- await world.page.waitForTimeout(50);
37
148
  let value = await (await world.page.locator(identifier)).inputValue();
38
149
  if (exact)
39
150
  await expect(value).toEqual(val);
40
151
  else
41
152
  await expect(value).toContain(val);
42
153
  });
43
- Then('the (value of ){string} (value )should not contain/include/be/equal {string}', async function (world, identifier, val) {
154
+ Then('a/an/the (value of ){string} (value )should not contain/include/be/equal {string}', async function (world, identifier, val) {
44
155
  let exact = world.info.step?.match(/should not (?:be|equal) ["']/) ? true : false;
45
- await world.page.waitForTimeout(50);
46
156
  let value = await (await world.page.locator(identifier)).inputValue();
47
157
  if (exact)
48
158
  await expect(value).not.toEqual(val);
@@ -50,7 +160,6 @@ Then('the (value of ){string} (value )should not contain/include/be/equal {strin
50
160
  await expect(value).not.toContain(val);
51
161
  });
52
162
  Then(/^the metatag for "([^"]+)" should (be|equal|contain) "(.*)"$/, async function (world, name, eq, value) {
53
- await world.page.waitForTimeout(50);
54
163
  let val;
55
164
  if (name === 'title')
56
165
  val = await world.page.title();
@@ -63,14 +172,16 @@ Then(/^the metatag for "([^"]+)" should (be|equal|contain) "(.*)"$/, async funct
63
172
  else
64
173
  await expect(val).toBe(value);
65
174
  });
66
- Then('the active element should be {string}', async function (world, identifier) {
67
- await world.page.waitForTimeout(50);
68
- let locator = await world.page.locator(identifier);
69
- await expect(locator).toBeFocused();
175
+ Then('(the )screenshot should match', async function (world) {
176
+ await expect(world.page).toMatchScreenshot(`${world.playwrightConfig.screenshotDir}/${world.info.rule ? world.info.rule + '__' + world.info.scenario : world.info.scenario}__${world.info.line}.png`);
70
177
  });
71
- Then('the active element should be the {string} {word}', async function (world, identifier, role) {
72
- await world.page.waitForTimeout(50);
73
- let locator = await world.page.getByRole(role, { name: identifier });
74
- await expect(locator).toBeFocused();
178
+ Then('(the )screenshot {string} should match', async function (world, name) {
179
+ await expect(world.page).toMatchScreenshot(`${world.playwrightConfig.screenshotDir}/${name}.png`);
180
+ });
181
+ Then('the user agent should contain/be {string}', async function (world, ua) {
182
+ await expect(world.browser.browserType().name()).toContain(ua);
183
+ });
184
+ Then('the url should contain {string}', async function (world, url) {
185
+ await expect(world.page.url()).toContain(url);
75
186
  });
76
187
  //# sourceMappingURL=outcomes.steps.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"outcomes.steps.mjs","sources":["../src/outcomes.steps.ts"],"sourcesContent":[null],"names":[],"mappings":";;;AAIA,IAAI,CAAC,uBAAuB,EAAE,gBAAgB,KAAqB,EAAE,IAAI,EAAA;IACvE,MAAM,KAAK,CAAC,IAAI,CAAC,cAAc,CAAC,EAAE,CAAC,CAAA;AACnC,IAAA,MAAM,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,WAAW,EAAE,CAAA;AACxD,CAAC,CAAC,CAAA;AACF,IAAI,CAAC,2BAA2B,EAAE,gBAAgB,KAAqB,EAAE,IAAI,EAAA;IAC3E,MAAM,KAAK,CAAC,IAAI,CAAC,cAAc,CAAC,EAAE,CAAC,CAAA;AACnC,IAAA,MAAM,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,WAAW,EAAE,CAAA;AAC5D,CAAC,CAAC,CAAA;AAEF,IAAI,CAAC,uCAAuC,EAAE,gBAAgB,KAAqB,EAAE,UAAU,EAAE,IAAI,EAAA;IACnG,MAAM,KAAK,CAAC,IAAI,CAAC,cAAc,CAAC,EAAE,CAAC,CAAA;IACnC,IAAI,IAAI,KAAK,SAAS;AAAE,QAAA,MAAM,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,WAAW,EAAE,CAAA;;QAC7E,MAAM,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC,WAAW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CAAA;AAEF,IAAI,CAAC,+BAA+B,EAAE,gBAAgB,KAAqB,EAAA;IACzE,MAAM,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,iBAAiB,CAAC,CAAA,EAAG,KAAK,CAAC,gBAAgB,CAAC,aAAa,CAAI,CAAA,EAAA,KAAK,CAAC,IAAI,CAAC,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,GAAG,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAK,EAAA,EAAA,KAAK,CAAC,IAAI,CAAC,IAAI,CAAM,IAAA,CAAA,CAAC,CAAA;AACvM,CAAC,CAAC,CAAA;AACF,IAAI,CAAC,wCAAwC,EAAE,gBAAgB,KAAqB,EAAE,IAAW,EAAA;AAC/F,IAAA,MAAM,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,iBAAiB,CAAC,GAAG,KAAK,CAAC,gBAAgB,CAAC,aAAa,IAAI,IAAI,CAAA,IAAA,CAAM,CAAC,CAAA;AACnG,CAAC,CAAC,CAAA;AAEF,IAAI,CAAC,2CAA2C,EAAE,gBAAgB,KAAqB,EAAE,EAAE,EAAA;AACzF,IAAA,MAAM,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC,IAAI,EAAE,CAAC,CAAC,SAAS,CAAC,EAAE,CAAC,CAAA;AAChE,CAAC,CAAC,CAAA;AACF,IAAI,CAAC,iCAAiC,EAAE,gBAAgB,KAAqB,EAAE,GAAG,EAAA;AAChF,IAAA,MAAM,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,CAAA;AAC/C,CAAC,CAAC"}
@@ -0,0 +1,88 @@
1
+ 'use strict';
2
+
3
+ var test = require('@playwright/test');
4
+ var pngjs = require('pngjs');
5
+ var node_fs = require('node:fs');
6
+ var path = require('node:path');
7
+ var pixelmatch = require('pixelmatch');
8
+ var lodashEs = require('lodash-es');
9
+
10
+ const defaultOptions = {
11
+ // Options for the comparison
12
+ maxDiffPercentage: 0,
13
+ // Options for the screenshot
14
+ fullPage: true,
15
+ omitBackground: false,
16
+ mask: [],
17
+ maskColor: 'rgb(255,255,255)',
18
+ timeout: 5000,
19
+ // Options for pixelmatch
20
+ threshold: 0.1,
21
+ alpha: 0.6,
22
+ };
23
+ async function compareImages(actual, expected, opts) {
24
+ const actualImage = pngjs.PNG.sync.read(actual);
25
+ const expectedImage = pngjs.PNG.sync.read(expected);
26
+ const { width, height } = actualImage;
27
+ const diffImage = new pngjs.PNG({ width, height });
28
+ const mismatchedPixels = pixelmatch(actualImage.data, expectedImage.data, diffImage.data, width, height, opts);
29
+ const totalPixels = width * height;
30
+ const diffPercentage = (mismatchedPixels / totalPixels) * 100;
31
+ const pass = diffPercentage <= opts.maxDiffPercentage;
32
+ return { pass, diffPercentage, image: diffImage };
33
+ }
34
+ async function customToHaveScreenshot(pageOrLocator, snapshotPath, opts) {
35
+ const options = lodashEs.defaultsDeep(opts, defaultOptions);
36
+ const pathparts = snapshotPath.split('/');
37
+ const name = pathparts.pop();
38
+ const screenshotDir = pathparts.join('/');
39
+ const filepath = path.join(screenshotDir, name || '');
40
+ const actualScreenshot = await pageOrLocator.screenshot(options);
41
+ try {
42
+ let expectedScreenshot;
43
+ try {
44
+ expectedScreenshot = await node_fs.promises.readFile(snapshotPath);
45
+ }
46
+ catch (error) {
47
+ // If the snapshot doesn't exist, save the current screenshot and pass the test
48
+ await node_fs.promises.mkdir(screenshotDir, { recursive: true });
49
+ await node_fs.promises.writeFile(snapshotPath, actualScreenshot);
50
+ return {
51
+ pass: true,
52
+ message: () => `Screenshot saved as new snapshot: ${snapshotPath}`,
53
+ };
54
+ }
55
+ const { pass, diffPercentage, image } = await compareImages(actualScreenshot, expectedScreenshot, options);
56
+ if (!pass) {
57
+ const filepath = path.join(screenshotDir, name || '');
58
+ await node_fs.promises.mkdir(screenshotDir, { recursive: true });
59
+ await node_fs.promises.writeFile(`${filepath}.diff.png`, pngjs.PNG.sync.write(image));
60
+ await node_fs.promises.writeFile(`${filepath}.actual.png`, actualScreenshot);
61
+ return {
62
+ pass: false,
63
+ message: () => `Screenshot does not match the snapshot.\nDiff percentage: ${diffPercentage.toFixed(2)}%\nDiff image saved at: ${filepath}.(diff|actual).png`,
64
+ };
65
+ }
66
+ return {
67
+ pass: true,
68
+ message: () => `Screenshot matches the snapshot: ${snapshotPath}`,
69
+ };
70
+ }
71
+ catch (error) {
72
+ await node_fs.promises.mkdir(screenshotDir, { recursive: true });
73
+ await node_fs.promises.writeFile(`${filepath}.actual.png`, actualScreenshot);
74
+ return {
75
+ pass: false,
76
+ message: () => `Failed to compare screenshots: ${error.message}`,
77
+ };
78
+ }
79
+ }
80
+ // Override the default implementation
81
+ test.expect.extend({
82
+ async toMatchScreenshot(received, nameOrOptions, optOptions) {
83
+ const name = typeof nameOrOptions === 'string' ? nameOrOptions : 'screenshot';
84
+ const options = typeof nameOrOptions === 'object' ? nameOrOptions : optOptions;
85
+ return customToHaveScreenshot.call(this, received, name, options);
86
+ },
87
+ });
88
+ //# sourceMappingURL=snapshotMatcher.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"snapshotMatcher.cjs","sources":["../src/snapshotMatcher.ts"],"sourcesContent":[null],"names":["PNG","defaultsDeep","fs","playwrightExpect"],"mappings":";;;;;;;;;AA4BA,MAAM,cAAc,GAAG;;AAErB,IAAA,iBAAiB,EAAE,CAAC;;AAGpB,IAAA,QAAQ,EAAE,IAAI;AACd,IAAA,cAAc,EAAE,KAAK;AACrB,IAAA,IAAI,EAAE,EAAE;AACR,IAAA,SAAS,EAAE,kBAAkB;AAC7B,IAAA,OAAO,EAAE,IAAI;;AAGb,IAAA,SAAS,EAAE,GAAG;AACd,IAAA,KAAK,EAAC,GAAG;CACV,CAAC;AAIF,eAAe,aAAa,CAAC,MAAc,EAAE,QAAgB,EAAE,IAA6B,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,CAAA,wBAAA,EAA2B,QAAQ,CAAoB,kBAAA,CAAA;aAC7J,CAAC;SACH;QAED,OAAO;AACL,YAAA,IAAI,EAAE,IAAI;AACV,YAAA,OAAO,EAAE,MAAM,CAAA,iCAAA,EAAoC,YAAY,CAAE,CAAA;SAClE,CAAC;KACH;IAAC,OAAO,KAAS,EAAE;AAClB,QAAA,MAAMA,gBAAE,CAAC,KAAK,CAAC,aAAa,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QACnD,MAAMA,gBAAE,CAAC,SAAS,CAAC,CAAA,EAAG,QAAQ,CAAa,WAAA,CAAA,EAAE,gBAAgB,CAAC,CAAA;QAC9D,OAAO;AACL,YAAA,IAAI,EAAE,KAAK;YACX,OAAO,EAAE,MAAM,kCAAkC,KAAK,CAAC,OAAO,CAAE,CAAA;SACjE,CAAC;KACH;AACH,CAAC;AAWD;AACAC,WAAgB,CAAC,MAAM,CAAC;AACtB,IAAA,MAAM,iBAAiB,CAAC,QAAwB,EAAE,aAAyD,EAAE,UAA6C,EAAA;AACxJ,QAAA,MAAM,IAAI,GAAG,OAAO,aAAa,KAAK,QAAQ,GAAG,aAAa,GAAG,YAAY,CAAC;AAC9E,QAAA,MAAM,OAAO,GAAG,OAAO,aAAa,KAAK,QAAQ,GAAG,aAAa,GAAG,UAAU,CAAC;AAC/E,QAAA,OAAO,sBAAsB,CAAC,IAAI,CAAC,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;KACnE;AACF,CAAA,CAAC;;"}
@@ -0,0 +1,23 @@
1
+ import type { Locator } from 'playwright-core';
2
+ import { PixelmatchOptions } from 'pixelmatch';
3
+ export interface ToHaveScreenshotOptions extends PixelmatchOptions {
4
+ maxDiffPercentage?: number;
5
+ clip?: {
6
+ x: number;
7
+ y: number;
8
+ width: number;
9
+ height: number;
10
+ };
11
+ fullPage?: boolean;
12
+ mask?: Array<Locator>;
13
+ maskColor?: string;
14
+ omitBackground?: boolean;
15
+ timeout?: number;
16
+ }
17
+ declare global {
18
+ namespace PlaywrightTest {
19
+ interface Matchers<R> {
20
+ toMatchScreenshot(nameOrOptions?: string | Partial<ToHaveScreenshotOptions>, optOptions?: Partial<ToHaveScreenshotOptions>): Promise<R>;
21
+ }
22
+ }
23
+ }