1+ import difflib
12import os
23from time import sleep
34
@@ -26,6 +27,8 @@ def test_basic_training():
2627 chrome_options .add_experimental_option ('detach' , True )
2728 driver = Chrome (options = chrome_options )
2829
30+ sleep (5 )
31+
2932 driver .request ('POST' , 'http://127.0.0.1:5000/lti' , data = {
3033 'lis_person_name_full' : Config .c .testing .lis_person_name_full ,
3134 'ext_user_username' : Config .c .testing .session_id ,
@@ -40,11 +43,22 @@ def test_basic_training():
4043 'oauth_consumer_key' : Config .c .testing .oauth_consumer_key ,
4144 })
4245
43- # driver.get('http://127.0.0.1:5000/upload_presentation/')
44- # file_input = WebDriverWait(driver, 20).until(EC.visibility_of_element_located((By.CSS_SELECTOR, "input[type=file]")))
45- # file_input.send_keys(f'{os.getcwd()}/test_data/test_presentation_file_0.pdf')
46- # WebDriverWait(driver, 5).until(EC.element_to_be_clickable((By.ID, "button-submit"))).click()
47- # WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.ID, "record"))).click()
46+ driver .get ('http://web:5000/upload_presentation/' )
47+
48+ file_input = WebDriverWait (driver , 20 ).until (EC .visibility_of_element_located ((By .CSS_SELECTOR , "input[type=file]" )))
49+ file_input .send_keys (f'{ os .getcwd ()} /test_data/test_presentation_file_0.pdf' )
50+
51+ cur = driver .page_source
52+ print (cur )
53+ WebDriverWait (driver , 5 ).until (EC .element_to_be_clickable ((By .ID , "button-submit" ))).click ()
54+
55+ sleep (10 )
56+ print (* difflib .unified_diff (cur , driver .page_source )) # <p id="error-text">No task attempt with task_attempt_id = None.</p>
57+ print (driver .page_source )
58+
59+ WebDriverWait (driver , 10 ).until (EC .element_to_be_clickable ((By .ID , "record" ))).click ()
60+
61+
4862 # WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.ID, "model-timer")))
4963 # WebDriverWait(driver, 10).until(EC.invisibility_of_element((By.ID, "model-timer")))
5064 # WebDriverWait(driver, 10).until(EC.visibility_of_element_located((By.ID, "next")))
@@ -69,4 +83,5 @@ def test_basic_training():
6983 # except:
7084 # sleep(step)
7185 # driver.close()
86+
7287 # assert feedback_flag, f"Проверка тренировки заняла более {step_count*step} секунд"
0 commit comments