test: improve autowaiting tests (#3168)

This commit is contained in:
Darío Kondratiuk 2020-07-26 03:58:03 -03:00 committed by GitHub
parent 98cc9db8e8
commit d0b758a8d2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -107,12 +107,11 @@ describe('Auto waiting', () => {
const messages = [];
server.setRoute('/empty.html?cancel', async (req, res) => { res.end('done'); });
server.setRoute('/empty.html?override', async (req, res) => { messages.push('routeoverride'); res.end('done'); });
await Promise.all([
page.evaluate(`
await page.evaluate(`
window.location.href = "${server.EMPTY_PAGE}?cancel";
window.location.href = "${server.EMPTY_PAGE}?override";
`).then(() => messages.push('evaluate')),
]);
`);
messages.push('evaluate');
expect(messages.join('|')).toBe('routeoverride|evaluate');
});
it('should await navigation when evaluating reload', async({page, server}) => {
@ -172,7 +171,6 @@ describe('Auto waiting', () => {
});
it('should work with goto following click', async({page, server}) => {
server.setRoute('/login.html', async (req, res) => {
messages.push('route');
res.setHeader('Content-Type', 'text/html');
res.end(`You are logged in`);
});