@@ -133,7 +133,7 @@ test('should support toHaveJSProperty with builtin types', async ({ runInlineTes
133
133
await page.setContent('<div></div>');
134
134
await page.$eval('div', e => e.foo = 'string');
135
135
const locator = page.locator('div');
136
- await expect(locator).toHaveJSProperty('foo', 'error', {timeout: 1000 });
136
+ await expect(locator).toHaveJSProperty('foo', 'error', {timeout: 200 });
137
137
});
138
138
139
139
test('pass number', async ({ page }) => {
@@ -147,7 +147,7 @@ test('should support toHaveJSProperty with builtin types', async ({ runInlineTes
147
147
await page.setContent('<div></div>');
148
148
await page.$eval('div', e => e.foo = 2021);
149
149
const locator = page.locator('div');
150
- await expect(locator).toHaveJSProperty('foo', 1, {timeout: 1000 });
150
+ await expect(locator).toHaveJSProperty('foo', 1, {timeout: 200 });
151
151
});
152
152
153
153
test('pass boolean', async ({ page }) => {
@@ -161,13 +161,40 @@ test('should support toHaveJSProperty with builtin types', async ({ runInlineTes
161
161
await page.setContent('<div></div>');
162
162
await page.$eval('div', e => e.foo = false);
163
163
const locator = page.locator('div');
164
- await expect(locator).toHaveJSProperty('foo', true, {timeout: 1000});
164
+ await expect(locator).toHaveJSProperty('foo', true, {timeout: 200});
165
+ });
166
+
167
+ test('pass boolean 2', async ({ page }) => {
168
+ await page.setContent('<div></div>');
169
+ await page.$eval('div', e => e.foo = false);
170
+ const locator = page.locator('div');
171
+ await expect(locator).toHaveJSProperty('foo', false);
172
+ });
173
+
174
+ test('fail boolean 2', async ({ page }) => {
175
+ await page.setContent('<div></div>');
176
+ await page.$eval('div', e => e.foo = false);
177
+ const locator = page.locator('div');
178
+ await expect(locator).toHaveJSProperty('foo', true, {timeout: 200});
179
+ });
180
+
181
+ test('pass undefined', async ({ page }) => {
182
+ await page.setContent('<div></div>');
183
+ const locator = page.locator('div');
184
+ await expect(locator).toHaveJSProperty('foo', undefined);
185
+ });
186
+
187
+ test('pass null', async ({ page }) => {
188
+ await page.setContent('<div></div>');
189
+ await page.$eval('div', e => e.foo = null);
190
+ const locator = page.locator('div');
191
+ await expect(locator).toHaveJSProperty('foo', null);
165
192
});
166
193
` ,
167
194
} , { workers : 1 } ) ;
168
195
const output = stripAnsi ( result . output ) ;
169
- expect ( result . passed ) . toBe ( 3 ) ;
170
- expect ( result . failed ) . toBe ( 3 ) ;
196
+ expect ( result . passed ) . toBe ( 6 ) ;
197
+ expect ( result . failed ) . toBe ( 4 ) ;
171
198
expect ( result . exitCode ) . toBe ( 1 ) ;
172
199
expect ( output ) . toContain ( 'Expected: "error"' ) ;
173
200
expect ( output ) . toContain ( 'Received: "string"' ) ;
0 commit comments