test_1939248_rosasthai_com.py (1135B)
1 import pytest 2 from webdriver.error import NoSuchElementException, StaleElementReferenceException 3 4 URL = "https://rosasthai.com/locations" 5 6 COOKIES_CSS = "#ccc" 7 VIEW_ALL_CSS = "#view-all" 8 FIRST_CARD_CSS = "#location-results [id^=card-]" 9 10 11 async def does_clicking_work(client): 12 await client.navigate(URL, wait="none") 13 client.await_css(COOKIES_CSS, is_displayed=True) 14 client.hide_elements(COOKIES_CSS) 15 # on failure, the location cards don't load. we also confirm that the 16 # cards change after clicking "view all", just in case. 17 try: 18 first_card = client.await_css(FIRST_CARD_CSS, is_displayed=True) 19 except NoSuchElementException: 20 return False 21 client.await_css(VIEW_ALL_CSS, is_displayed=True).click() 22 try: 23 first_card.click() 24 return False 25 except StaleElementReferenceException: 26 return True 27 28 29 @pytest.mark.asyncio 30 @pytest.mark.with_interventions 31 async def test_enabled(client): 32 assert await does_clicking_work(client) 33 34 35 @pytest.mark.asyncio 36 @pytest.mark.without_interventions 37 async def test_disabled(client): 38 assert not await does_clicking_work(client)