test_2003826_tjoy_jp.py (2174B)
1 import asyncio 2 3 import pytest 4 5 URL = "https://tjoy.jp/shinjuku_wald9#schedule-content" 6 7 DATES_CSS = ".calendar-item" 8 CARD_CSS = ".card-header.js-card-click" 9 RESERVE_CSS = ".schedule-box-body[onclick*=reservation]" 10 ZOOM_WRAPPER_CSS = ".js-zoom-in" 11 MAP_CSS = ".js-map" 12 13 14 # It's necessary to navigate to the seat choice screen from the movie list because of the session management. 15 async def does_correct_zoom(client): 16 # Open and wait for the movie list to be loaded. 17 await client.navigate(URL, wait="load") 18 19 # Navigate to the seat choice screen. 20 # Display tomorrow's movies and reserve the seat for one of them. 21 # Note that today's movies can be already closed for sale. 22 dates = client.await_css(DATES_CSS, all=True) 23 dates[1].click() 24 tomorrows_movie_cards = client.await_css(CARD_CSS, is_displayed=True, all=True) 25 26 # some movies don't always have any available seats, so open the first five. 27 for elem in tomorrows_movie_cards[:5]: 28 elem.click() 29 30 reserve = client.await_css(RESERVE_CSS, is_displayed=True) 31 # The element is overlapped by another one, so we have to use javascript to click it. 32 client.execute_script("arguments[0].click()", reserve) 33 34 # The seat map takes time to be displayed. 35 await asyncio.sleep(4) 36 37 # Zoom in to the seat map and check if it sets only 'zoom' without '-moz-transform'. 38 seat_map_zoom_wrapper = client.await_css(ZOOM_WRAPPER_CSS) 39 client.execute_script("arguments[0].click()", seat_map_zoom_wrapper) 40 seat_map = client.await_css(MAP_CSS) 41 moz_transform = client.execute_script( 42 "return getComputedStyle(arguments[0]).MozTransform", seat_map 43 ) 44 zoom = client.execute_script("return getComputedStyle(arguments[0]).zoom", seat_map) 45 return (moz_transform in {"none", ""}) and (zoom not in {"", "none"}) 46 47 48 @pytest.mark.only_platforms("android") 49 @pytest.mark.asyncio 50 @pytest.mark.with_interventions 51 async def test_enabled(client): 52 assert await does_correct_zoom(client) 53 54 55 @pytest.mark.only_platforms("android") 56 @pytest.mark.asyncio 57 @pytest.mark.without_interventions 58 async def test_disabled(client): 59 assert not await does_correct_zoom(client)