From 36d22d82aa202bb199967e9512281e9a53db42c9 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 21:33:14 +0200 Subject: Adding upstream version 115.7.0esr. Signed-off-by: Daniel Baumann --- .../tests/test_1610026_mobilesuica.py | 49 ++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 testing/webcompat/interventions/tests/test_1610026_mobilesuica.py (limited to 'testing/webcompat/interventions/tests/test_1610026_mobilesuica.py') diff --git a/testing/webcompat/interventions/tests/test_1610026_mobilesuica.py b/testing/webcompat/interventions/tests/test_1610026_mobilesuica.py new file mode 100644 index 0000000000..444fe8471f --- /dev/null +++ b/testing/webcompat/interventions/tests/test_1610026_mobilesuica.py @@ -0,0 +1,49 @@ +import pytest + +ADDRESS_CSS = "input[name=MailAddress]" +PASSWORD_CSS = "input[name=Password]" +CLOSE_BUTTON_CSS = "input[name=winclosebutton]" +UNAVAILABLE_TEXT = "時間をお確かめの上、再度実行してください。" +UNSUPPORTED_TEXT = "ご利用のブラウザでは正しく" + + +async def load_site(client): + await client.navigate("https://www.mobilesuica.com/") + + address = client.find_css(ADDRESS_CSS) + password = client.find_css(PASSWORD_CSS) + error1 = client.find_css(CLOSE_BUTTON_CSS) + error2 = client.find_text(UNSUPPORTED_TEXT) + + # The page can be down at certain times, making testing impossible. For instance: + # "モバイルSuicaサービスが可能な時間は4:00~翌日2:00です。 + # 時間をお確かめの上、再度実行してください。" + # "Mobile Suica service is available from 4:00 to 2:00 the next day. + # Please check the time and try again." + site_is_down = client.find_text(UNAVAILABLE_TEXT) + if site_is_down is not None: + pytest.xfail("Site is currently down") + + return address, password, error1 or error2, site_is_down + + +@pytest.mark.asyncio +@pytest.mark.with_interventions +async def test_enabled(client): + address, password, error, site_is_down = await load_site(client) + if site_is_down: + return + assert client.is_displayed(address) + assert client.is_displayed(password) + assert error is None + + +@pytest.mark.asyncio +@pytest.mark.without_interventions +async def test_disabled(client): + address, password, error, site_is_down = await load_site(client) + if site_is_down: + return + assert address is None + assert password is None + assert client.is_displayed(error) -- cgit v1.2.3