From 15bbbeeae99b32bd25bc1b79c569844e3dddebe3 Mon Sep 17 00:00:00 2001 From: zhouqi Date: Wed, 13 May 2026 17:11:43 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=96=AD=E8=A8=80=EF=BC=8C?= =?UTF-8?q?=E4=B8=8D=E9=9C=80=E8=A6=81=E5=9C=A8ci=E4=B8=AD=E7=9C=9F?= =?UTF-8?q?=E7=9A=84=E6=89=93=E5=BC=80=E5=A4=96=E7=BD=91=E7=A4=BE=E5=AA=92?= =?UTF-8?q?=E5=9C=B0=E5=9D=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Joyhub_ui_auto_test/tests/test_navigation_pages.py | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/Joyhub_ui_auto_test/tests/test_navigation_pages.py b/Joyhub_ui_auto_test/tests/test_navigation_pages.py index 51157ba..f6a267f 100644 --- a/Joyhub_ui_auto_test/tests/test_navigation_pages.py +++ b/Joyhub_ui_auto_test/tests/test_navigation_pages.py @@ -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__":