This repository was archived by the owner on Jun 7, 2023. It is now read-only.
File tree Expand file tree Collapse file tree
runestone/activecode/test Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ import time
2+
13import pytest
24from selenium .webdriver import ActionChains
35from selenium .webdriver .support import expected_conditions as EC
@@ -124,21 +126,10 @@ def test_activity_count(selenium_utils_progress):
124126def test_sql_activecode (selenium_utils_get ):
125127 div_id = "test_activecode_6"
126128 t2 = find_ac (selenium_utils_get , div_id )
127- import time
129+ # Without this line, tests fail on Github actions. They run on my local Windows machine with no problem without this line. I don't know why.
128130 time .sleep (1 )
129131 click_run (selenium_utils_get , t2 )
130- # Some hacky debug code to try and understand why this fails on Github actions.
131- for _ in selenium_utils_get .driver .get_log ("browser" ):
132- print (_ )
133- from selenium .webdriver .support .ui import WebDriverWait
134- long_wait = WebDriverWait (selenium_utils_get .driver , 30 )
135- start = time .time ()
136- try :
137- long_wait .until (EC .text_to_be_present_in_element ((By .ID , f"{ div_id } _stdout" ), "You" ))
138- except :
139- print (selenium_utils_get .driver .find_element_by_id (f"{ div_id } _stdout" ).text )
140- print (time .time () - start )
141- raise
132+ selenium_utils_get .wait .until (EC .text_to_be_present_in_element ((By .ID , f"{ div_id } _stdout" ), "You" ))
142133 res = selenium_utils_get .driver .find_element_by_id (f"{ div_id } _sql_out" )
143134 assert res
144135 out = selenium_utils_get .driver .find_element_by_id (f"{ div_id } _stdout" )
You can’t perform that action at this time.
0 commit comments