fix: run E2E tests properly with mounted browsers and real postgres
- Mount /opt/playwright-tools/browsers into web container (docker-compose.yml and CI docker run) — never download browsers, use the ones on this host - Set PLAYWRIGHT_BROWSERS_PATH in all container envs (compose + CI) - Drop 'playwright install chromium' steps from pr-e2e and nightly-e2e jobs - Bump playwright requirement to ~1.57.0 to match the installed browser builds - Fix seed_e2e_content: de-duplicate default Site entries left by unit test fixtures so Wagtail always routes to the seeded home page - Fix test_comments_section_absent_when_disabled: use exact=True on heading locator to avoid matching 'No Comments Article' h1 as 'Comments' heading - Fix test_copy_link_button_updates_text: use [data-copy-link] data-attr locator (stable across text change) and force-override clipboard.writeText via page.evaluate() rather than relying on init_script polyfill E2E suite verified locally: 34 passed via docker compose exec Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -41,7 +41,7 @@ def test_article_share_section_present(page: Page, base_url: str) -> None:
|
||||
def test_article_comments_section_present(page: Page, base_url: str) -> None:
|
||||
_go_to_article(page, base_url)
|
||||
# The article has comments_enabled=True
|
||||
expect(page.get_by_role("heading", name="Comments")).to_be_visible()
|
||||
expect(page.get_by_role("heading", name="Comments", exact=True)).to_be_visible()
|
||||
expect(page.get_by_role("button", name="Post comment")).to_be_visible()
|
||||
|
||||
|
||||
@@ -64,8 +64,9 @@ def test_article_related_section_present(page: Page, base_url: str) -> None:
|
||||
@pytest.mark.e2e
|
||||
def test_copy_link_button_updates_text(page: Page, base_url: str) -> None:
|
||||
_go_to_article(page, base_url)
|
||||
copy_btn = page.get_by_role("button", name="Copy link")
|
||||
copy_btn = page.locator("[data-copy-link]")
|
||||
expect(copy_btn).to_be_visible()
|
||||
# Force-override clipboard so writeText always resolves, even in non-HTTPS headless context
|
||||
page.evaluate("navigator.clipboard.writeText = () => Promise.resolve()")
|
||||
copy_btn.click()
|
||||
# Clipboard polyfill in conftest ensures writeText resolves; button shows "Copied"
|
||||
expect(copy_btn).to_have_text("Copied")
|
||||
|
||||
Reference in New Issue
Block a user