summaryrefslogtreecommitdiffstats
path: root/testing/webcompat/interventions/tests/test_1800000_www_honda_co_uk.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
commit36d22d82aa202bb199967e9512281e9a53db42c9 (patch)
tree105e8c98ddea1c1e4784a60a5a6410fa416be2de /testing/webcompat/interventions/tests/test_1800000_www_honda_co_uk.py
parentInitial commit. (diff)
downloadfirefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz
firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip
Adding upstream version 115.7.0esr.upstream/115.7.0esrupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/webcompat/interventions/tests/test_1800000_www_honda_co_uk.py')
-rw-r--r--testing/webcompat/interventions/tests/test_1800000_www_honda_co_uk.py50
1 files changed, 50 insertions, 0 deletions
diff --git a/testing/webcompat/interventions/tests/test_1800000_www_honda_co_uk.py b/testing/webcompat/interventions/tests/test_1800000_www_honda_co_uk.py
new file mode 100644
index 0000000000..70f968dc1d
--- /dev/null
+++ b/testing/webcompat/interventions/tests/test_1800000_www_honda_co_uk.py
@@ -0,0 +1,50 @@
+import pytest
+from webdriver.error import NoSuchElementException
+
+URL = "https://www.honda.co.uk/cars/book-a-service.html#search?query=tf33bu"
+COOKIES_CSS = "#onetrust-accept-btn-handler"
+CHOOSE_DEALER_CSS = "a[data-analytics-template*='Make a booking']"
+BOOK_ONLINE_CSS = "select#requiredService"
+SITE_DOWN_CSS = ".no-results"
+
+
+async def check_choose_dealer_works(client):
+ await client.navigate(URL)
+
+ cookies = client.css(COOKIES_CSS)
+ client.await_element(cookies).click()
+ client.await_element_hidden(cookies)
+
+ down, dealer = client.await_first_element_of(
+ [
+ client.css(SITE_DOWN_CSS),
+ client.css(CHOOSE_DEALER_CSS),
+ ],
+ timeout=5,
+ )
+
+ if down:
+ pytest.skip("Service is down right now, so testing is impossible")
+ return True
+
+ client.scroll_into_view(dealer)
+ client.mouse.click(element=dealer).perform()
+ try:
+ client.await_css(BOOK_ONLINE_CSS, is_displayed=True, timeout=3)
+ except NoSuchElementException:
+ return False
+ return True
+
+
+@pytest.mark.skip_platforms("android")
+@pytest.mark.asyncio
+@pytest.mark.with_interventions
+async def test_enabled(client):
+ assert await check_choose_dealer_works(client)
+
+
+@pytest.mark.skip_platforms("android")
+@pytest.mark.asyncio
+@pytest.mark.without_interventions
+async def test_disabled(client):
+ assert not await check_choose_dealer_works(client)