Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions pytest.ini
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ minversion = 6.0
# -n/--numprocesses is passed.
#
# --reruns/--only-rerun: retry a test up to twice, but ONLY when it failed on a
# timing signature (Selenium's TimeoutException, or pytest-timeout's own
# "Failed: Timeout" wrapper) — the kind of failure this suite has repeatedly
# timing signature (Selenium's TimeoutException, pytest-timeout's own
# "Failed: Timeout" wrapper, or a StaleElementReferenceException from a React
# re-render between find and use) — the kind of failure this suite has repeatedly
# turned out to be a race or a throttled backend rather than a real bug.
# AssertionError is deliberately excluded: those are logic/data failures (e.g.
# a hardcoded fixture that no longer exists) and rerunning them would only mask
Expand All @@ -16,6 +17,7 @@ addopts = --json-report --json-report-file=report.json --dist loadfile
--reruns 2 --reruns-delay 5
--only-rerun "TimeoutException"
--only-rerun "Failed: Timeout"
--only-rerun "StaleElementReferenceException"
testpaths = tests

markers =
Expand Down
14 changes: 10 additions & 4 deletions tests/consumer/smoke/test_con_seo_analytics.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import os
import re
import time
from urllib.parse import urlparse

import pytest

Expand Down Expand Up @@ -114,12 +115,18 @@ def test_prod_data_layer_has_config_call(driver):

# ─── Dev: GA must be completely absent ─────────────────────────────────────────

def _require_dev_target():
# HOME_URL_DEV is whichever site the suite targets; prod deploys point it at prod.
host = urlparse(DEV_URL or "").hostname or ""
if not host.startswith("dev."):
pytest.skip(f"HOME_URL_DEV targets '{host or 'nothing'}', not a dev host; GA-absent checks apply to dev only")


@pytest.mark.smoke
@pytest.mark.seo
def test_dev_ga_script_tag_absent(driver):
"""Dev must not load any googletagmanager script (GA intentionally disabled)."""
if not DEV_URL:
pytest.skip("HOME_URL_DEV not set")
_require_dev_target()
driver.get(DEV_URL)
time.sleep(GA_SETTLE_SECONDS)

Expand All @@ -131,8 +138,7 @@ def test_dev_ga_script_tag_absent(driver):
@pytest.mark.seo
def test_dev_gtag_is_undefined(driver):
"""window.gtag must be undefined on dev (GA intentionally disabled)."""
if not DEV_URL:
pytest.skip("HOME_URL_DEV not set")
_require_dev_target()
driver.get(DEV_URL)
time.sleep(GA_SETTLE_SECONDS)

Expand Down
Loading