修改断言,不需要在ci中真的打开外网社媒地址
This commit is contained in:
@@ -149,7 +149,7 @@ def test_footer_social_media_links_open_then_return_home(page, ensure_guest_user
|
||||
ensure_guest_user()
|
||||
|
||||
for name, selector, expected_url in social_links:
|
||||
logger.info("滚动到首页底部,点击 %s 社交媒体按钮", name)
|
||||
logger.info("滚动到首页底部,校验 %s 社交媒体链接 href", name)
|
||||
page.evaluate("window.scrollTo(0, document.body.scrollHeight)")
|
||||
link = page.locator(selector).first
|
||||
expect(link).to_be_attached(timeout=settings.default_timeout)
|
||||
@@ -157,15 +157,7 @@ def test_footer_social_media_links_open_then_return_home(page, ensure_guest_user
|
||||
|
||||
social_href = link.get_attribute("href")
|
||||
assert social_href is not None
|
||||
|
||||
logger.info("校验 %s 社交媒体页面跳转成功", name)
|
||||
page.goto(social_href, wait_until="domcontentloaded")
|
||||
expect(page).to_have_url(expected_url, timeout=settings.default_timeout)
|
||||
|
||||
logger.info("从 %s 页面返回 JoyHub 首页", name)
|
||||
page.goto(settings.base_url, wait_until="domcontentloaded")
|
||||
expect(page).to_have_url(re.compile(r".*/?$"), timeout=settings.default_timeout)
|
||||
expect(page.locator('a[href="https://x.com/JoyhubOfficial"]')).to_be_attached(timeout=settings.default_timeout)
|
||||
assert expected_url.search(social_href), f"{name} 社交媒体链接不符合预期: {social_href}"
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
Reference in New Issue
Block a user