-
Notifications
You must be signed in to change notification settings - Fork 3.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug]: addLocatorHandler blocks #30424
Comments
I missed an test('play wordle', async ({ page }) => {
await page.addLocatorHandler(page.getByRole('heading', { name: 'How To Play' }), async () => {
await page.getByLabel('Close').click();
});
await page.goto('https://www.nytimes.com/games/wordle/index.html');
await page.getByTestId('Play').click();
for (const letter of 'salet')
await page.locator(`[data-key=${letter}]`).click();
}); And it's still failing. Trace: |
Ok, I figured it out. The callback was being called twice because clicking the Close button was not closing the dialog immediately. To fix it, I have to wait for the locator to disappear: test('play wordle', async ({ page }) => {
await page.addLocatorHandler(page.getByRole('heading', { name: 'How To Play' }), async () => {
await page.getByLabel('Close').click();
await page.getByRole('heading', { name: 'How To Play' }).waitFor({ state: 'hidden' });
});
await page.goto('https://www.nytimes.com/games/wordle/index.html');
await page.getByTestId('Play').click();
for (const letter of 'salet')
await page.locator(`[data-key=${letter}]`).click();
}); This pattern happens a lot due to fadeout animations. Maybe it would be worth to add a paragraph explaining this in the documentation. |
You spared me a lot of time and frustration! Thanks for sharing this, I was having the same issue and adding the |
@cyrus-afshari Implicit |
I am on version 1.43.1, so I believe I don't have that new default behavior |
Version
1.43.1
Steps to reproduce
Run the following test:
Expected behavior
It should close the help dialog and type SALET
Actual behavior
It closes the help dialog and blocks, not typing any letter. I'm attaching the captured trace:
trace.zip
Additional context
No response
Environment
The text was updated successfully, but these errors were encountered: