summaryrefslogtreecommitdiffstats
path: root/testing/webcompat/interventions/tests/test_1610026_mobilesuica.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 17:32:43 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 17:32:43 +0000
commit6bf0a5cb5034a7e684dcc3500e841785237ce2dd (patch)
treea68f146d7fa01f0134297619fbe7e33db084e0aa /testing/webcompat/interventions/tests/test_1610026_mobilesuica.py
parentInitial commit. (diff)
downloadthunderbird-6bf0a5cb5034a7e684dcc3500e841785237ce2dd.tar.xz
thunderbird-6bf0a5cb5034a7e684dcc3500e841785237ce2dd.zip
Adding upstream version 1:115.7.0.upstream/1%115.7.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/webcompat/interventions/tests/test_1610026_mobilesuica.py')
-rw-r--r--testing/webcompat/interventions/tests/test_1610026_mobilesuica.py49
1 files changed, 49 insertions, 0 deletions
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)