test: fix should not fulfill with redirect status (#23459)

This commit is contained in:
Dmitry Gozman 2023-06-01 23:11:03 -07:00 committed by GitHub
parent d1666d2dde
commit 1d5add6d99
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -552,10 +552,10 @@ it('should not fulfill with redirect status', async ({ page, server, browserName
}); });
for (status = 300; status < 310; status++) { for (status = 300; status < 310; status++) {
const exception = await Promise.race([ const [, exception] = await Promise.all([
page.evaluate(url => location.href = url, server.PREFIX + '/redirect_this'), page.evaluate(url => location.href = url, server.PREFIX + '/redirect_this'),
new Promise((f, r) => {fulfill = f; reject = r;}) new Promise<Error>((f, r) => {fulfill = f; reject = r;})
]) as any; ]);
expect(exception).toBeTruthy(); expect(exception).toBeTruthy();
expect(exception.message.includes('Cannot fulfill with redirect status')).toBe(true); expect(exception.message.includes('Cannot fulfill with redirect status')).toBe(true);
} }