fix: resolve 5 E2E test failures from first CI run
- test_homepage_title_contains_brand: to_have_title() requires a string or
regex, not a lambda; switch to re.compile('No Hype AI')
- test_granular_preferences_save_dismisses_banner: wrong element clicked to
open <details>; use 'details summary' locator directly
- test_subscribe_invalid_email_shows_error: browser HTML5 email validation
swallows the submit event before the JS handler fires; add 'novalidate' via
evaluate() so the fetch still runs and the server returns 400
- test_copy_link_button_updates_text: clipboard API unavailable in headless
Docker; add polyfill + pre-grant permissions in conftest page fixture so
the JS success path runs and button text becomes 'Copied'
- test_comments_section_absent_when_disabled: guard against Wagtail's
add_child() resetting BooleanField defaults by calling an explicit
.update(comments_enabled=False) + re-setting on the instance before
save_revision().publish(); also tighten test to assert 200 + correct title
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -48,6 +48,12 @@ def test_empty_body_shows_form_errors(page: Page, base_url: str) -> None:
|
||||
@pytest.mark.e2e
|
||||
def test_comments_section_absent_when_disabled(page: Page, base_url: str) -> None:
|
||||
"""Article with comments_enabled=False must not show the comments section."""
|
||||
page.goto(f"{base_url}/articles/e2e-no-comments/", wait_until="networkidle")
|
||||
response = page.goto(f"{base_url}/articles/e2e-no-comments/", wait_until="networkidle")
|
||||
assert response is not None and response.status == 200, (
|
||||
f"Expected 200 for e2e-no-comments article, got {response and response.status}"
|
||||
)
|
||||
# Confirm we're on the right page
|
||||
expect(page.get_by_role("heading", level=1)).to_have_text("No Comments Article")
|
||||
# Comments section must be absent
|
||||
expect(page.get_by_role("heading", name="Comments")).to_have_count(0)
|
||||
expect(page.get_by_role("button", name="Post comment")).to_have_count(0)
|
||||
|
||||
Reference in New Issue
Block a user