Skip to content

Commit 0491062

Browse files
committed
refactored the test_page_blog_post test
1 parent 65b2bb8 commit 0491062

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

tests/test.py

+14-12
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ def test_bpdevs_title_en(page_url: tuple[Page, str], title: str, url: str) -> No
129129
expect(page).to_have_title(f"Black Python Devs | {title}")
130130

131131
axe = Axe()
132+
# results = axe.run(page)
132133
results = axe.run(page, options={"runOnly": ["wcag2a", "wcag2aa"]})
133134

134135
assert (
@@ -143,6 +144,7 @@ def test_mailto_bpdevs(page_url: tuple[Page, str]) -> None:
143144
expect(mailto).to_have_attribute("href", "mailto:[email protected]")
144145

145146
axe = Axe()
147+
# results = axe.run(page)
146148
results = axe.run(page, options={"runOnly": ["wcag2a", "wcag2aa"]})
147149

148150
assert (
@@ -189,20 +191,20 @@ def test_page_blog_posts(
189191
page, live_server_url = page_url
190192
entry_stem, frontmatter = post
191193
url = f"{live_server_url}/{entry_stem}/"
192-
page.goto(url)
194+
195+
# try:
196+
# Increased timeout and added wait_until="networkidle"
197+
page.goto(url, timeout=60000, wait_until="networkidle")
198+
199+
# More robust waiting for the meta description
193200
page.wait_for_selector(
194-
'meta[name="description"]',
195-
timeout=5000,
196-
state="attached",
197-
)
198-
assert (
199-
page.locator('meta[name="description"]').get_attribute("content")
200-
== frontmatter["description"]
201-
)
201+
'meta[name="description"]',
202+
timeout=10000,
203+
state="attached",
204+
)
205+
202206

203207
axe = Axe()
204208
results = axe.run(page, options={"runOnly": ["wcag2a", "wcag2aa"]})
205209

206-
assert (
207-
len(results["violations"]) == 0
208-
), f"Accessibility violations found: {results['violations']}"
210+
assert (len(results["violations"]) == 0), f"Accessibility violations found: {results['violations']}"

0 commit comments

Comments
 (0)