playwright
playwright copied to clipboard
[BUG] Firefox browserContext does not isolate link history
Context:
- Playwright Version: 1.27.1
- Operating System: Linux
- Node.js version: 16.15.0
- Browser: Firefox
Code Snippet
import { test, expect } from "@playwright/test";
test("Page", async ({ page }) => {
await page.goto("/page");
});
test("Homepage with link to /page", async ({ page }) => {
await page.goto("/");
await expect(page).toHaveScreenshot();
});
Describe the bug
The index page / has an anchor pointing to /page.
When running the tests in separate workers, the anchor shows as not visited (blue). This is correct behaviour.
However, when running the tests in the same worker, the anchor tag displays as visited (purple) in firefox only. This leads to the screenshot comparison failing the first time.
Evidently, firefox's browserContexts are not truly isolated.
I can repro with:
test("Page", async ({ page }) => {
await page.goto("https://example.com/page");
});
test("Homepage with link to /page", async ({ page }) => {
await page.goto("https://example.com/");
await page.setContent(`<a href="/page">Page</a>`);
await expect(page).toHaveScreenshot();
});
Investigation notes: Firefox keeps visited links history in the "places db", see ConcurrentStatementsHolder in History.cpp that reads it from the db.
Workaround - set firefox user preference in project settings
{ name: 'firefox', use: { ...devices['Desktop Firefox'], launchOptions: { firefoxUserPrefs: {'layout.css.visited_links_enabled':false} } }, },
Why was this issue closed?
Thank you for your contribution to our project. This issue has been closed due to its limited upvotes and recent activity, and insufficient feedback for us to effectively act upon. Our priority is to focus on bugs that reflect higher user engagement and have actionable feedback, to ensure our bug database stays manageable.
Should you feel this closure was in error, please create a new issue and reference this one. We're open to revisiting it given increased support or additional clarity. Your understanding and cooperation are greatly appreciated.