test_1729435_milkbarstore_com.py (1404B)
1 import pytest 2 3 URL = "https://milkbarstore.com/products/assorted-cookie-tin" 4 ADD_TO_CART_CSS = "#ProductSubmitButton-pdp__main" 5 INCREASE_QUANTITY_CSS = ".quantity-wrapper button.change-quantity.inc" 6 QUANTITY_WRAPPER_CSS = ".quantity-wrapper" 7 8 9 async def do_cart_quantities_appear(client): 10 # A screenshot of the quantity lines will show the spinner 11 # arrows of the number-inputs when the site bug manifests. 12 client.hide_elements("[id^=alia-root]") 13 await client.navigate(URL, wait="none") 14 client.await_css(ADD_TO_CART_CSS, is_displayed=True).click() 15 inc = client.await_css(INCREASE_QUANTITY_CSS, is_displayed=True) 16 await client.stall(1) 17 pre = client.await_css(QUANTITY_WRAPPER_CSS).screenshot() 18 inc.click() 19 await client.stall(1) 20 post = client.await_css(QUANTITY_WRAPPER_CSS).screenshot() 21 return pre != post 22 23 24 @pytest.mark.skip_platforms("android") 25 @pytest.mark.asyncio 26 @pytest.mark.with_interventions 27 async def test_enabled(client): 28 assert await do_cart_quantities_appear(client) 29 30 31 @pytest.mark.skip_platforms("android") 32 @pytest.mark.asyncio 33 @pytest.mark.without_interventions 34 async def test_disabled(client): 35 assert not await do_cart_quantities_appear(client) 36 37 38 @pytest.mark.only_platforms("android") 39 @pytest.mark.asyncio 40 @pytest.mark.without_interventions 41 async def test_works_on_android(client): 42 assert await do_cart_quantities_appear(client)