test: make test not depend on line endings (#4497)

This commit is contained in:
Yury Semikhatsky 2020-11-19 12:10:44 -08:00 committed by GitHub
parent 09f9a35198
commit de43de7a8c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -450,13 +450,14 @@ it('should fulfill with redirect status', (test, { browserName, headful}) => {
test.fixme(browserName === 'webkit', 'in WebKit the redirects are handled by the network stack and we intercept before'); test.fixme(browserName === 'webkit', 'in WebKit the redirects are handled by the network stack and we intercept before');
}, async ({page, server}) => { }, async ({page, server}) => {
await page.goto(server.PREFIX + '/title.html'); await page.goto(server.PREFIX + '/title.html');
server.setRoute('/final', (req, res) => res.end('foo'));
await page.route('**/*', async (route, request) => { await page.route('**/*', async (route, request) => {
if (request.url() !== server.PREFIX + '/redirect_this') if (request.url() !== server.PREFIX + '/redirect_this')
return route.continue(); return route.continue();
await route.fulfill({ await route.fulfill({
status: 301, status: 301,
headers: { headers: {
'location': '/title.html', 'location': '/final',
} }
}); });
}); });
@ -465,7 +466,7 @@ it('should fulfill with redirect status', (test, { browserName, headful}) => {
const data = await fetch(url); const data = await fetch(url);
return data.text(); return data.text();
}, server.PREFIX + '/redirect_this'); }, server.PREFIX + '/redirect_this');
expect(text).toBe('<title>Woof-Woof</title>\n'); expect(text).toBe('foo');
}); });
it('should not fulfill with redirect status', (test, { browserName, headful}) => { it('should not fulfill with redirect status', (test, { browserName, headful}) => {