test_1911243_tsu-results_rf_gd.py (1345B)
1 import pytest 2 3 URL = "http://tsu-results.rf.gd/tsu_results/f3_championship/season_3/F3%20Championship%20-%20season%203.html?i=1" 4 5 TABLE_HEADER_CSS = ".w3-table-container table.sortable thead th:first-of-type" 6 TABLE_CELL_CSS = ".w3-table-container table.sortable tbody td:first-of-type" 7 8 9 async def check_header_is_positioned_correctly(client): 10 await client.navigate(URL, wait="none") 11 header = client.await_css(TABLE_HEADER_CSS, is_displayed=True) 12 cell = client.await_css(TABLE_CELL_CSS, is_displayed=True) 13 # the boxes of the leftmost header and cells will perfectly align if the layout is "broken", 14 # since the header is rotated, and likewise its width will be wider than the normal cell width. 15 return client.execute_script( 16 """ 17 const [header, cell] = arguments; 18 const headerBB = header.getBoundingClientRect(); 19 const cellBB = cell.getBoundingClientRect(); 20 return headerBB.left != cellBB.left && headerBB.width > cellBB.width; 21 """, 22 header, 23 cell, 24 ) 25 26 27 @pytest.mark.asyncio 28 @pytest.mark.with_interventions 29 async def test_enabled(client): 30 assert await check_header_is_positioned_correctly(client) 31 32 33 @pytest.mark.asyncio 34 @pytest.mark.without_interventions 35 async def test_disabled(client): 36 assert not await check_header_is_positioned_correctly(client)