test: unflake and enable some Firefox tests (#30461)

Fixes #30399.
This commit is contained in:
Dmitry Gozman 2024-04-22 11:25:10 -07:00 committed by GitHub
parent 42f91e30d1
commit 4046d154ae
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 7 additions and 2 deletions

View File

@ -188,7 +188,6 @@ browserTest('should focus with more than one page/context', async ({ contextFact
});
browserTest('should not fire blur events when interacting with more than one page/context', async ({ contextFactory, browserName }) => {
it.fixme(browserName === 'firefox', 'Firefox issues blur events for tabs');
browserTest.info().annotations.push({ type: 'issue', description: 'https://github.com/microsoft/playwright/issues/30399' });
const page1 = await (await contextFactory()).newPage();
const page2 = await (await contextFactory()).newPage();

View File

@ -265,7 +265,7 @@ it('should not click an element overlaying iframe with the target', async ({ pag
`);
const target = page.frameLocator('iframe').frameLocator('iframe').locator('text=inner');
const error = await target.click({ timeout: 1000 }).catch(e => e);
const error = await target.click({ timeout: 3000 }).catch(e => e);
expect(await page.evaluate('window._clicked')).toBe(undefined);
expect(error.message).toContain(`<div onclick="window.top._clicked=5">PINK OVERLAY</div> intercepts pointer events`);

View File

@ -123,6 +123,8 @@ it('should wait for stable position', async ({ page, server, browserName, platfo
button.style.transition = 'margin 10000ms linear 0s';
button.style.marginLeft = '20000px';
});
// rafraf for Firefox to kick in the animation.
await page.evaluate(() => new Promise(f => requestAnimationFrame(() => requestAnimationFrame(f))));
let done = false;
const promise = button.waitForElementState('stable').then(() => done = true);
await giveItAChanceToResolve(page);

View File

@ -24,6 +24,8 @@ it('should timeout waiting for stable position', async ({ page, server }) => {
button.style.transition = 'margin 5s linear 0s';
button.style.marginLeft = '200px';
});
// rafraf for Firefox to kick in the animation.
await page.evaluate(() => new Promise(f => requestAnimationFrame(() => requestAnimationFrame(f))));
const error = await button.click({ timeout: 3000 }).catch(e => e);
expect(error.message).toContain('elementHandle.click: Timeout 3000ms exceeded.');
expect(error.message).toContain('waiting for element to be visible, enabled and stable');

View File

@ -455,6 +455,8 @@ it('should wait for stable position', async ({ page, server }) => {
button.style.display = 'block';
document.body.style.margin = '0';
});
// rafraf for Firefox to kick in the animation.
await page.evaluate(() => new Promise(f => requestAnimationFrame(() => requestAnimationFrame(f))));
await page.click('button');
expect(await page.evaluate(() => window['result'])).toBe('Clicked');
expect(await page.evaluate('pageX')).toBe(300);