2020-08-03 22:41:48 +02:00
|
|
|
|
/**
|
|
|
|
|
|
* Copyright 2018 Google Inc. All rights reserved.
|
|
|
|
|
|
* Modifications copyright (c) Microsoft Corporation.
|
|
|
|
|
|
*
|
|
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
|
|
*
|
|
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
|
*
|
|
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
|
|
* limitations under the License.
|
|
|
|
|
|
*/
|
2020-09-03 06:43:38 +02:00
|
|
|
|
|
2024-11-01 21:38:01 +01:00
|
|
|
|
import { stripAnsi } from 'tests/config/utils';
|
2023-05-26 00:11:16 +02:00
|
|
|
|
import type { TestServer } from '../config/testserver';
|
2021-05-06 16:08:22 +02:00
|
|
|
|
import { test as it, expect } from './pageTest';
|
2020-08-03 22:41:48 +02:00
|
|
|
|
|
chore: make noWaitAfter a default
This changes the last actions, namely `click` and `press`, to not wait
for the ongoing navigations after the action.
Maintaining this behavior becomes tricky, because browsers move away from
guaranteed synchronous navigations to optimized performance. See #34377
for more details.
This is technically a breaking change. Most of the time, this should
not be noticeable, because the next action will auto-wait the navigation
and for any required conditions anyway. However, there are some patterns
revealed by our tests that are affected:
- Calling `goBack/goForward` immediately after an action. This pattern
requires `expect(page).toHaveURL()` or a similar check inbetween.
- Listening for network events during the action, and immediately
asserting after the action. This pattern requires `waitForRequest()`
or a similar promise-based waiter as recommended in best practices.
We maintain the opt-out `env.PLAYWRIGHT_WAIT_AFTER_CLICK` that reverts
to the old behavior for now.
Additionally, previous opt-out option `env.PLAYWRIGHT_SKIP_NAVIGATION_CHECK`
has been removed, because there have been just a single issue with it,
that was immediately addressed in a patch release.
2025-02-04 13:51:03 +01:00
|
|
|
|
function initStallingServer(server: TestServer, url?: string) {
|
|
|
|
|
|
let release: () => void;
|
|
|
|
|
|
const releasePromise = new Promise<void>(r => release = r);
|
|
|
|
|
|
let route: () => void;
|
|
|
|
|
|
const routePromise = new Promise<void>(r => route = r);
|
2020-08-03 22:41:48 +02:00
|
|
|
|
const messages = [];
|
chore: make noWaitAfter a default
This changes the last actions, namely `click` and `press`, to not wait
for the ongoing navigations after the action.
Maintaining this behavior becomes tricky, because browsers move away from
guaranteed synchronous navigations to optimized performance. See #34377
for more details.
This is technically a breaking change. Most of the time, this should
not be noticeable, because the next action will auto-wait the navigation
and for any required conditions anyway. However, there are some patterns
revealed by our tests that are affected:
- Calling `goBack/goForward` immediately after an action. This pattern
requires `expect(page).toHaveURL()` or a similar check inbetween.
- Listening for network events during the action, and immediately
asserting after the action. This pattern requires `waitForRequest()`
or a similar promise-based waiter as recommended in best practices.
We maintain the opt-out `env.PLAYWRIGHT_WAIT_AFTER_CLICK` that reverts
to the old behavior for now.
Additionally, previous opt-out option `env.PLAYWRIGHT_SKIP_NAVIGATION_CHECK`
has been removed, because there have been just a single issue with it,
that was immediately addressed in a patch release.
2025-02-04 13:51:03 +01:00
|
|
|
|
server.setRoute(url ?? '/empty.html', async (req, res) => {
|
2020-08-03 22:41:48 +02:00
|
|
|
|
messages.push('route');
|
chore: make noWaitAfter a default
This changes the last actions, namely `click` and `press`, to not wait
for the ongoing navigations after the action.
Maintaining this behavior becomes tricky, because browsers move away from
guaranteed synchronous navigations to optimized performance. See #34377
for more details.
This is technically a breaking change. Most of the time, this should
not be noticeable, because the next action will auto-wait the navigation
and for any required conditions anyway. However, there are some patterns
revealed by our tests that are affected:
- Calling `goBack/goForward` immediately after an action. This pattern
requires `expect(page).toHaveURL()` or a similar check inbetween.
- Listening for network events during the action, and immediately
asserting after the action. This pattern requires `waitForRequest()`
or a similar promise-based waiter as recommended in best practices.
We maintain the opt-out `env.PLAYWRIGHT_WAIT_AFTER_CLICK` that reverts
to the old behavior for now.
Additionally, previous opt-out option `env.PLAYWRIGHT_SKIP_NAVIGATION_CHECK`
has been removed, because there have been just a single issue with it,
that was immediately addressed in a patch release.
2025-02-04 13:51:03 +01:00
|
|
|
|
route();
|
|
|
|
|
|
await releasePromise;
|
2020-08-03 22:41:48 +02:00
|
|
|
|
res.setHeader('Content-Type', 'text/html');
|
chore: make noWaitAfter a default
This changes the last actions, namely `click` and `press`, to not wait
for the ongoing navigations after the action.
Maintaining this behavior becomes tricky, because browsers move away from
guaranteed synchronous navigations to optimized performance. See #34377
for more details.
This is technically a breaking change. Most of the time, this should
not be noticeable, because the next action will auto-wait the navigation
and for any required conditions anyway. However, there are some patterns
revealed by our tests that are affected:
- Calling `goBack/goForward` immediately after an action. This pattern
requires `expect(page).toHaveURL()` or a similar check inbetween.
- Listening for network events during the action, and immediately
asserting after the action. This pattern requires `waitForRequest()`
or a similar promise-based waiter as recommended in best practices.
We maintain the opt-out `env.PLAYWRIGHT_WAIT_AFTER_CLICK` that reverts
to the old behavior for now.
Additionally, previous opt-out option `env.PLAYWRIGHT_SKIP_NAVIGATION_CHECK`
has been removed, because there have been just a single issue with it,
that was immediately addressed in a patch release.
2025-02-04 13:51:03 +01:00
|
|
|
|
res.end(`<button onclick="window.__clicked=true">click me</button>`);
|
2020-08-03 22:41:48 +02:00
|
|
|
|
});
|
chore: make noWaitAfter a default
This changes the last actions, namely `click` and `press`, to not wait
for the ongoing navigations after the action.
Maintaining this behavior becomes tricky, because browsers move away from
guaranteed synchronous navigations to optimized performance. See #34377
for more details.
This is technically a breaking change. Most of the time, this should
not be noticeable, because the next action will auto-wait the navigation
and for any required conditions anyway. However, there are some patterns
revealed by our tests that are affected:
- Calling `goBack/goForward` immediately after an action. This pattern
requires `expect(page).toHaveURL()` or a similar check inbetween.
- Listening for network events during the action, and immediately
asserting after the action. This pattern requires `waitForRequest()`
or a similar promise-based waiter as recommended in best practices.
We maintain the opt-out `env.PLAYWRIGHT_WAIT_AFTER_CLICK` that reverts
to the old behavior for now.
Additionally, previous opt-out option `env.PLAYWRIGHT_SKIP_NAVIGATION_CHECK`
has been removed, because there have been just a single issue with it,
that was immediately addressed in a patch release.
2025-02-04 13:51:03 +01:00
|
|
|
|
return { messages, release, routed: routePromise };
|
2021-03-17 20:03:21 +01:00
|
|
|
|
}
|
2020-08-03 22:41:48 +02:00
|
|
|
|
|
chore: make noWaitAfter a default
This changes the last actions, namely `click` and `press`, to not wait
for the ongoing navigations after the action.
Maintaining this behavior becomes tricky, because browsers move away from
guaranteed synchronous navigations to optimized performance. See #34377
for more details.
This is technically a breaking change. Most of the time, this should
not be noticeable, because the next action will auto-wait the navigation
and for any required conditions anyway. However, there are some patterns
revealed by our tests that are affected:
- Calling `goBack/goForward` immediately after an action. This pattern
requires `expect(page).toHaveURL()` or a similar check inbetween.
- Listening for network events during the action, and immediately
asserting after the action. This pattern requires `waitForRequest()`
or a similar promise-based waiter as recommended in best practices.
We maintain the opt-out `env.PLAYWRIGHT_WAIT_AFTER_CLICK` that reverts
to the old behavior for now.
Additionally, previous opt-out option `env.PLAYWRIGHT_SKIP_NAVIGATION_CHECK`
has been removed, because there have been just a single issue with it,
that was immediately addressed in a patch release.
2025-02-04 13:51:03 +01:00
|
|
|
|
it('should await navigation before clicking anchor', async ({ page, server }) => {
|
|
|
|
|
|
const { messages, release, routed } = initStallingServer(server);
|
|
|
|
|
|
await page.setContent(`<a href="${server.EMPTY_PAGE}">empty.html</a>`);
|
|
|
|
|
|
|
|
|
|
|
|
await page.click('a');
|
|
|
|
|
|
await routed;
|
|
|
|
|
|
expect(messages.join('|')).toBe('route');
|
|
|
|
|
|
|
|
|
|
|
|
const click2 = page.click('button').then(() => messages.push('click2'));
|
|
|
|
|
|
await page.waitForTimeout(1000);
|
|
|
|
|
|
expect(messages.join('|')).toBe('route');
|
|
|
|
|
|
|
|
|
|
|
|
release();
|
|
|
|
|
|
await click2;
|
|
|
|
|
|
expect(messages.join('|')).toBe('route|click2');
|
2020-08-03 22:41:48 +02:00
|
|
|
|
});
|
|
|
|
|
|
|
2022-01-07 02:13:55 +01:00
|
|
|
|
it('should not stall on JS navigation link', async ({ page, browserName }) => {
|
|
|
|
|
|
await page.setContent(`<a href="javascript:console.log(1)">console.log</a>`);
|
|
|
|
|
|
await page.click('a');
|
|
|
|
|
|
});
|
|
|
|
|
|
|
chore: make noWaitAfter a default
This changes the last actions, namely `click` and `press`, to not wait
for the ongoing navigations after the action.
Maintaining this behavior becomes tricky, because browsers move away from
guaranteed synchronous navigations to optimized performance. See #34377
for more details.
This is technically a breaking change. Most of the time, this should
not be noticeable, because the next action will auto-wait the navigation
and for any required conditions anyway. However, there are some patterns
revealed by our tests that are affected:
- Calling `goBack/goForward` immediately after an action. This pattern
requires `expect(page).toHaveURL()` or a similar check inbetween.
- Listening for network events during the action, and immediately
asserting after the action. This pattern requires `waitForRequest()`
or a similar promise-based waiter as recommended in best practices.
We maintain the opt-out `env.PLAYWRIGHT_WAIT_AFTER_CLICK` that reverts
to the old behavior for now.
Additionally, previous opt-out option `env.PLAYWRIGHT_SKIP_NAVIGATION_CHECK`
has been removed, because there have been just a single issue with it,
that was immediately addressed in a patch release.
2025-02-04 13:51:03 +01:00
|
|
|
|
it('should await cross-process navigation before clicking anchor', async ({ page, server }) => {
|
|
|
|
|
|
const { messages, release, routed } = initStallingServer(server);
|
2020-08-03 22:41:48 +02:00
|
|
|
|
await page.setContent(`<a href="${server.CROSS_PROCESS_PREFIX + '/empty.html'}">empty.html</a>`);
|
|
|
|
|
|
|
chore: make noWaitAfter a default
This changes the last actions, namely `click` and `press`, to not wait
for the ongoing navigations after the action.
Maintaining this behavior becomes tricky, because browsers move away from
guaranteed synchronous navigations to optimized performance. See #34377
for more details.
This is technically a breaking change. Most of the time, this should
not be noticeable, because the next action will auto-wait the navigation
and for any required conditions anyway. However, there are some patterns
revealed by our tests that are affected:
- Calling `goBack/goForward` immediately after an action. This pattern
requires `expect(page).toHaveURL()` or a similar check inbetween.
- Listening for network events during the action, and immediately
asserting after the action. This pattern requires `waitForRequest()`
or a similar promise-based waiter as recommended in best practices.
We maintain the opt-out `env.PLAYWRIGHT_WAIT_AFTER_CLICK` that reverts
to the old behavior for now.
Additionally, previous opt-out option `env.PLAYWRIGHT_SKIP_NAVIGATION_CHECK`
has been removed, because there have been just a single issue with it,
that was immediately addressed in a patch release.
2025-02-04 13:51:03 +01:00
|
|
|
|
await page.click('a');
|
|
|
|
|
|
await routed;
|
|
|
|
|
|
expect(messages.join('|')).toBe('route');
|
2020-08-03 22:41:48 +02:00
|
|
|
|
|
chore: make noWaitAfter a default
This changes the last actions, namely `click` and `press`, to not wait
for the ongoing navigations after the action.
Maintaining this behavior becomes tricky, because browsers move away from
guaranteed synchronous navigations to optimized performance. See #34377
for more details.
This is technically a breaking change. Most of the time, this should
not be noticeable, because the next action will auto-wait the navigation
and for any required conditions anyway. However, there are some patterns
revealed by our tests that are affected:
- Calling `goBack/goForward` immediately after an action. This pattern
requires `expect(page).toHaveURL()` or a similar check inbetween.
- Listening for network events during the action, and immediately
asserting after the action. This pattern requires `waitForRequest()`
or a similar promise-based waiter as recommended in best practices.
We maintain the opt-out `env.PLAYWRIGHT_WAIT_AFTER_CLICK` that reverts
to the old behavior for now.
Additionally, previous opt-out option `env.PLAYWRIGHT_SKIP_NAVIGATION_CHECK`
has been removed, because there have been just a single issue with it,
that was immediately addressed in a patch release.
2025-02-04 13:51:03 +01:00
|
|
|
|
const click2 = page.click('button').then(() => messages.push('click2'));
|
|
|
|
|
|
await page.waitForTimeout(1000);
|
|
|
|
|
|
expect(messages.join('|')).toBe('route');
|
|
|
|
|
|
|
|
|
|
|
|
release();
|
|
|
|
|
|
await click2;
|
|
|
|
|
|
expect(messages.join('|')).toBe('route|click2');
|
|
|
|
|
|
});
|
2020-08-03 22:41:48 +02:00
|
|
|
|
|
chore: make noWaitAfter a default
This changes the last actions, namely `click` and `press`, to not wait
for the ongoing navigations after the action.
Maintaining this behavior becomes tricky, because browsers move away from
guaranteed synchronous navigations to optimized performance. See #34377
for more details.
This is technically a breaking change. Most of the time, this should
not be noticeable, because the next action will auto-wait the navigation
and for any required conditions anyway. However, there are some patterns
revealed by our tests that are affected:
- Calling `goBack/goForward` immediately after an action. This pattern
requires `expect(page).toHaveURL()` or a similar check inbetween.
- Listening for network events during the action, and immediately
asserting after the action. This pattern requires `waitForRequest()`
or a similar promise-based waiter as recommended in best practices.
We maintain the opt-out `env.PLAYWRIGHT_WAIT_AFTER_CLICK` that reverts
to the old behavior for now.
Additionally, previous opt-out option `env.PLAYWRIGHT_SKIP_NAVIGATION_CHECK`
has been removed, because there have been just a single issue with it,
that was immediately addressed in a patch release.
2025-02-04 13:51:03 +01:00
|
|
|
|
it('should await form-get navigation before click', async ({ page, server }) => {
|
|
|
|
|
|
const { messages, release, routed } = initStallingServer(server, '/empty.html?foo=bar');
|
2020-08-03 22:41:48 +02:00
|
|
|
|
await page.setContent(`
|
|
|
|
|
|
<form action="${server.EMPTY_PAGE}" method="get">
|
|
|
|
|
|
<input name="foo" value="bar">
|
|
|
|
|
|
<input type="submit" value="Submit">
|
|
|
|
|
|
</form>`);
|
|
|
|
|
|
|
chore: make noWaitAfter a default
This changes the last actions, namely `click` and `press`, to not wait
for the ongoing navigations after the action.
Maintaining this behavior becomes tricky, because browsers move away from
guaranteed synchronous navigations to optimized performance. See #34377
for more details.
This is technically a breaking change. Most of the time, this should
not be noticeable, because the next action will auto-wait the navigation
and for any required conditions anyway. However, there are some patterns
revealed by our tests that are affected:
- Calling `goBack/goForward` immediately after an action. This pattern
requires `expect(page).toHaveURL()` or a similar check inbetween.
- Listening for network events during the action, and immediately
asserting after the action. This pattern requires `waitForRequest()`
or a similar promise-based waiter as recommended in best practices.
We maintain the opt-out `env.PLAYWRIGHT_WAIT_AFTER_CLICK` that reverts
to the old behavior for now.
Additionally, previous opt-out option `env.PLAYWRIGHT_SKIP_NAVIGATION_CHECK`
has been removed, because there have been just a single issue with it,
that was immediately addressed in a patch release.
2025-02-04 13:51:03 +01:00
|
|
|
|
await page.click('input[type=submit]');
|
|
|
|
|
|
await routed;
|
|
|
|
|
|
expect(messages.join('|')).toBe('route');
|
|
|
|
|
|
|
|
|
|
|
|
const click2 = page.click('button').then(() => messages.push('click2'));
|
|
|
|
|
|
await page.waitForTimeout(1000);
|
|
|
|
|
|
expect(messages.join('|')).toBe('route');
|
|
|
|
|
|
|
|
|
|
|
|
release();
|
|
|
|
|
|
await click2;
|
|
|
|
|
|
expect(messages.join('|')).toBe('route|click2');
|
2020-08-03 22:41:48 +02:00
|
|
|
|
});
|
|
|
|
|
|
|
chore: make noWaitAfter a default
This changes the last actions, namely `click` and `press`, to not wait
for the ongoing navigations after the action.
Maintaining this behavior becomes tricky, because browsers move away from
guaranteed synchronous navigations to optimized performance. See #34377
for more details.
This is technically a breaking change. Most of the time, this should
not be noticeable, because the next action will auto-wait the navigation
and for any required conditions anyway. However, there are some patterns
revealed by our tests that are affected:
- Calling `goBack/goForward` immediately after an action. This pattern
requires `expect(page).toHaveURL()` or a similar check inbetween.
- Listening for network events during the action, and immediately
asserting after the action. This pattern requires `waitForRequest()`
or a similar promise-based waiter as recommended in best practices.
We maintain the opt-out `env.PLAYWRIGHT_WAIT_AFTER_CLICK` that reverts
to the old behavior for now.
Additionally, previous opt-out option `env.PLAYWRIGHT_SKIP_NAVIGATION_CHECK`
has been removed, because there have been just a single issue with it,
that was immediately addressed in a patch release.
2025-02-04 13:51:03 +01:00
|
|
|
|
it('should await form-post navigation before click', async ({ page, server }) => {
|
|
|
|
|
|
const { messages, release, routed } = initStallingServer(server);
|
2020-08-03 22:41:48 +02:00
|
|
|
|
await page.setContent(`
|
|
|
|
|
|
<form action="${server.EMPTY_PAGE}" method="post">
|
|
|
|
|
|
<input name="foo" value="bar">
|
|
|
|
|
|
<input type="submit" value="Submit">
|
|
|
|
|
|
</form>`);
|
|
|
|
|
|
|
chore: make noWaitAfter a default
This changes the last actions, namely `click` and `press`, to not wait
for the ongoing navigations after the action.
Maintaining this behavior becomes tricky, because browsers move away from
guaranteed synchronous navigations to optimized performance. See #34377
for more details.
This is technically a breaking change. Most of the time, this should
not be noticeable, because the next action will auto-wait the navigation
and for any required conditions anyway. However, there are some patterns
revealed by our tests that are affected:
- Calling `goBack/goForward` immediately after an action. This pattern
requires `expect(page).toHaveURL()` or a similar check inbetween.
- Listening for network events during the action, and immediately
asserting after the action. This pattern requires `waitForRequest()`
or a similar promise-based waiter as recommended in best practices.
We maintain the opt-out `env.PLAYWRIGHT_WAIT_AFTER_CLICK` that reverts
to the old behavior for now.
Additionally, previous opt-out option `env.PLAYWRIGHT_SKIP_NAVIGATION_CHECK`
has been removed, because there have been just a single issue with it,
that was immediately addressed in a patch release.
2025-02-04 13:51:03 +01:00
|
|
|
|
await page.click('input[type=submit]');
|
|
|
|
|
|
await routed;
|
|
|
|
|
|
expect(messages.join('|')).toBe('route');
|
|
|
|
|
|
|
|
|
|
|
|
const click2 = page.click('button').then(() => messages.push('click2'));
|
|
|
|
|
|
await page.waitForTimeout(1000);
|
|
|
|
|
|
expect(messages.join('|')).toBe('route');
|
|
|
|
|
|
|
|
|
|
|
|
release();
|
|
|
|
|
|
await click2;
|
|
|
|
|
|
expect(messages.join('|')).toBe('route|click2');
|
2020-08-03 22:41:48 +02:00
|
|
|
|
});
|
|
|
|
|
|
|
chore: make noWaitAfter a default
This changes the last actions, namely `click` and `press`, to not wait
for the ongoing navigations after the action.
Maintaining this behavior becomes tricky, because browsers move away from
guaranteed synchronous navigations to optimized performance. See #34377
for more details.
This is technically a breaking change. Most of the time, this should
not be noticeable, because the next action will auto-wait the navigation
and for any required conditions anyway. However, there are some patterns
revealed by our tests that are affected:
- Calling `goBack/goForward` immediately after an action. This pattern
requires `expect(page).toHaveURL()` or a similar check inbetween.
- Listening for network events during the action, and immediately
asserting after the action. This pattern requires `waitForRequest()`
or a similar promise-based waiter as recommended in best practices.
We maintain the opt-out `env.PLAYWRIGHT_WAIT_AFTER_CLICK` that reverts
to the old behavior for now.
Additionally, previous opt-out option `env.PLAYWRIGHT_SKIP_NAVIGATION_CHECK`
has been removed, because there have been just a single issue with it,
that was immediately addressed in a patch release.
2025-02-04 13:51:03 +01:00
|
|
|
|
it('should work without noWaitAfter when navigation is stalled', async ({ page, server }) => {
|
2020-08-03 22:41:48 +02:00
|
|
|
|
server.setRoute('/empty.html', async () => {});
|
2021-03-17 20:03:21 +01:00
|
|
|
|
await page.setContent(`<a id="anchor" href="${server.EMPTY_PAGE}">empty.html</a>`);
|
chore: make noWaitAfter a default
This changes the last actions, namely `click` and `press`, to not wait
for the ongoing navigations after the action.
Maintaining this behavior becomes tricky, because browsers move away from
guaranteed synchronous navigations to optimized performance. See #34377
for more details.
This is technically a breaking change. Most of the time, this should
not be noticeable, because the next action will auto-wait the navigation
and for any required conditions anyway. However, there are some patterns
revealed by our tests that are affected:
- Calling `goBack/goForward` immediately after an action. This pattern
requires `expect(page).toHaveURL()` or a similar check inbetween.
- Listening for network events during the action, and immediately
asserting after the action. This pattern requires `waitForRequest()`
or a similar promise-based waiter as recommended in best practices.
We maintain the opt-out `env.PLAYWRIGHT_WAIT_AFTER_CLICK` that reverts
to the old behavior for now.
Additionally, previous opt-out option `env.PLAYWRIGHT_SKIP_NAVIGATION_CHECK`
has been removed, because there have been just a single issue with it,
that was immediately addressed in a patch release.
2025-02-04 13:51:03 +01:00
|
|
|
|
await page.click('a');
|
2020-08-03 22:41:48 +02:00
|
|
|
|
});
|
|
|
|
|
|
|
2024-07-18 09:19:08 +02:00
|
|
|
|
it('should work with dblclick without noWaitAfter when navigation is stalled', async ({ page, server }) => {
|
2020-08-03 22:41:48 +02:00
|
|
|
|
server.setRoute('/empty.html', async () => {});
|
2021-03-17 20:03:21 +01:00
|
|
|
|
await page.setContent(`<a id="anchor" href="${server.EMPTY_PAGE}">empty.html</a>`);
|
2024-07-18 09:19:08 +02:00
|
|
|
|
await page.dblclick('a');
|
2020-08-03 22:41:48 +02:00
|
|
|
|
});
|
|
|
|
|
|
|
2021-09-27 18:58:08 +02:00
|
|
|
|
it('should work with goto following click', async ({ page, server }) => {
|
2020-08-03 22:41:48 +02:00
|
|
|
|
server.setRoute('/login.html', async (req, res) => {
|
|
|
|
|
|
res.setHeader('Content-Type', 'text/html');
|
|
|
|
|
|
res.end(`You are logged in`);
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
await page.setContent(`
|
|
|
|
|
|
<form action="${server.PREFIX}/login.html" method="get">
|
|
|
|
|
|
<input type="text">
|
|
|
|
|
|
<input type="submit" value="Submit">
|
|
|
|
|
|
</form>`);
|
|
|
|
|
|
|
|
|
|
|
|
await page.fill('input[type=text]', 'admin');
|
|
|
|
|
|
await page.click('input[type=submit]');
|
|
|
|
|
|
await page.goto(server.EMPTY_PAGE);
|
|
|
|
|
|
});
|
|
|
|
|
|
|
2024-11-01 21:38:01 +01:00
|
|
|
|
it('should report and collapse log in action', async ({ page, server, mode }) => {
|
|
|
|
|
|
await page.setContent(`<input id='checkbox' type='checkbox' style="visibility: hidden"></input>`);
|
|
|
|
|
|
const error = await page.locator('input').click({ timeout: 5000 }).catch(e => e);
|
|
|
|
|
|
const message = stripAnsi(error.message);
|
|
|
|
|
|
expect(message).toContain(`Call log:`);
|
|
|
|
|
|
expect(message).toMatch(/\d+ × waiting for/);
|
|
|
|
|
|
const logLines = message.substring(message.indexOf('Call log:')).split('\n');
|
|
|
|
|
|
expect(logLines.length).toBeLessThan(30);
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
it('should report and collapse log in expect', async ({ page, server, mode }) => {
|
|
|
|
|
|
await page.setContent(`<input id='checkbox' type='checkbox' style="visibility: hidden"></input>`);
|
|
|
|
|
|
const error = await expect(page.locator('input')).toBeVisible({ timeout: 5000 }).catch(e => e);
|
|
|
|
|
|
const message = stripAnsi(error.message);
|
|
|
|
|
|
expect(message).toContain(`Call log:`);
|
|
|
|
|
|
expect(message).toMatch(/\d+ × locator resolved to/);
|
|
|
|
|
|
});
|