@@ -27,10 +27,11 @@ def test_hello(selenium_utils_get):
2727 4. Check the output from the ac_output element
2828 :return:
2929 """
30- t1 = find_ac (selenium_utils_get , "test1" )
30+ div_id = "test_activecode_2"
31+ t1 = find_ac (selenium_utils_get , div_id )
3132 click_run (t1 )
3233 selenium_utils_get .wait .until (
33- EC .text_to_be_present_in_element ((By .ID , "test1_stdout " ), "Hello World" ),
34+ EC .text_to_be_present_in_element ((By .ID , f" { div_id } _stdout " ), "Hello World" ),
3435 message = "Did not find expected text" ,
3536 )
3637 output = t1 .find_element_by_class_name ("ac_output" )
@@ -65,17 +66,17 @@ def test_history(selenium_utils_get):
6566 4. Check the output from the ac_output element
6667 :return:
6768 """
68- #import pdb; pdb.set_trace()
69- t1 = find_ac (selenium_utils_get , "test1" )
70- selenium_utils_get . driver . execute_script ( "window.scrollTo(0, 0);" )
69+ div_id = "test_activecode_2"
70+ t1 = find_ac (selenium_utils_get , div_id )
71+ time . sleep ( 1 )
7172 rb = t1 .find_element_by_class_name ("run-button" )
7273 rb .click ()
7374 time .sleep (2 )
7475
7576 ta = t1 .find_element_by_class_name ("cm-s-default" )
7677 assert ta
7778 selenium_utils_get .driver .execute_script (
78- """window.edList['test1 '].editor.setValue("print('GoodBye')")"""
79+ f """window.edList['{ div_id } '].editor.setValue("print('GoodBye')")"""
7980 )
8081 selenium_utils_get .wait .until (EC .element_to_be_clickable ((By .CLASS_NAME , "run-button" )))
8182 try :
@@ -109,7 +110,7 @@ def test_livecode_datafile(selenium_utils_get):
109110 Runs test2 example
110111 Code is dependent on supplementary file
111112 """
112- t2 = find_ac (selenium_utils_get , "test2 " )
113+ t2 = find_ac (selenium_utils_get , "test_activecode_3 " )
113114 click_run (t2 )
114115 output = t2 .find_element_by_class_name ("ac_output" )
115116
@@ -133,7 +134,7 @@ def selenium_utils_progress(selenium_utils):
133134
134135
135136def test_activity_count (selenium_utils_progress ):
136- t2 = find_ac (selenium_utils_progress , "test_p1 " )
137+ t2 = find_ac (selenium_utils_progress , "test_activecode_5 " )
137138 click_run (t2 )
138139 pb = selenium_utils_progress .driver .find_element_by_id ("subchapterprogress" )
139140 assert pb
@@ -151,19 +152,19 @@ def test_activity_count(selenium_utils_progress):
151152
152153
153154def test_sql_activecode (selenium_utils_get ):
154- t2 = find_ac ( selenium_utils_get , "sql1" )
155- time . sleep ( 1 )
155+ div_id = "test_activecode_6"
156+ t2 = find_ac ( selenium_utils_get , div_id )
156157 click_run (t2 )
157- selenium_utils_get .wait .until (EC .text_to_be_present_in_element ((By .ID , "sql1_stdout " ), "You" ))
158- res = selenium_utils_get .driver .find_element_by_id ("sql1_sql_out " )
158+ selenium_utils_get .wait .until (EC .text_to_be_present_in_element ((By .ID , f" { div_id } _stdout " ), "You" ))
159+ res = selenium_utils_get .driver .find_element_by_id (f" { div_id } _sql_out " )
159160 assert res
160- out = selenium_utils_get .driver .find_element_by_id ("sql1_stdout " )
161+ out = selenium_utils_get .driver .find_element_by_id (f" { div_id } _stdout " )
161162 assert "You passed 2 out of 3 tests" in out .text
162163
163- t2 = selenium_utils_get . driver . find_element_by_id ( "sql2" )
164- time . sleep ( 1 )
164+ div_id = "test_activecode_7"
165+ t2 = find_ac ( selenium_utils_get , div_id )
165166 click_run (t2 )
166- out = selenium_utils_get .driver .find_element_by_id ("sql2_stdout " )
167+ out = selenium_utils_get .driver .find_element_by_id (f" { div_id } _stdout " )
167168 assert "" == out .text .strip ()
168169
169170
0 commit comments