Skip to content

[Feature]: Automatic waiting to resolve strict mode violations #36045

Open
@ErikBrendel

Description

@ErikBrendel

🚀 Feature Request

When there is a strict mode violation, instead of immediately raising an exception, wait the usual time for the strict mode violation to resolve

Example

In a test scenario, where an open dialog should be closed by clicking the close button:

await page.getByLabel('close').click();

If there are still some auto-disappearing toast messages visible on the page, and they have a dismiss-button with the same label, the test will immediately crash.

Current workaround:

await expect(page.getByLabel('close')).toHaveCount(1);
await page.getByLabel('close').click();

Suggested change:

Instead, each action that would raise a strict-mode-violation should first perform an expect wait like from the workaround, and only actually fail when the violation is still present after the timeout.

Motivation

It would make workarounds like above unnecessary, and also align the code generated from the recording feature more aligned with the actual working test code.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions