Add a new regression test: test_lecturer_can_add_student_numbers
parent
1ed7e2e394
commit
39c14f7425
|
@ -63,7 +63,7 @@ def test_lecturer_can_create_course(driver, url, restore_database):
|
|||
|
||||
|
||||
def test_lecturer_can_post_assignment(driver, url, restore_database):
|
||||
# Lecturer mrlan@qq.com logs in
|
||||
# Lecturer lanhui@qq.com logs in
|
||||
driver.maximize_window()
|
||||
login(driver, url, 'lanhui@qq.com', '123')
|
||||
|
||||
|
@ -92,11 +92,47 @@ def test_lecturer_can_post_assignment(driver, url, restore_database):
|
|||
assert 'Deadline: 2024-12-30' in elem.text
|
||||
|
||||
|
||||
@pytest.mark.skip()
|
||||
def test_lecturer_can_add_student_numbers():
|
||||
# Lecturer mrlan@qq.com logs in
|
||||
# Add 6 ASE student numbers
|
||||
assert True
|
||||
def test_lecturer_can_add_student_numbers(driver, url, restore_database):
|
||||
# Lecturer lanhui@qq.com logs in
|
||||
driver.maximize_window()
|
||||
login(driver, url, 'lanhui@qq.com', '123')
|
||||
|
||||
# Add ASE student numbers
|
||||
student_numbers = '''
|
||||
202420781739
|
||||
202420781740
|
||||
202420781741
|
||||
202420781742
|
||||
202420781743
|
||||
202420781745
|
||||
202420581366
|
||||
202420581368
|
||||
202420581369
|
||||
202420581370
|
||||
202420581372
|
||||
202420581373
|
||||
202420581374
|
||||
202420581376
|
||||
202420581378
|
||||
202420581381
|
||||
'''
|
||||
elem = driver.find_element(By.ID, 'admin_tab')
|
||||
elem.click()
|
||||
elem = driver.find_element(By.NAME, 'users')
|
||||
elem.send_keys(student_numbers)
|
||||
elem = driver.find_element(By.ID, 'register_btn')
|
||||
elem.click()
|
||||
|
||||
elems = driver.find_elements(By.CSS_SELECTOR, 'p')
|
||||
added = 0
|
||||
student_lst = [number.strip() for number in student_numbers.strip().split('\n')]
|
||||
print(student_lst)
|
||||
for student_no in student_lst:
|
||||
for elem in elems:
|
||||
if student_no in elem.text and 'added' in elem.text:
|
||||
added += 1
|
||||
break
|
||||
assert added == len(student_lst)
|
||||
|
||||
|
||||
@pytest.mark.skip()
|
||||
|
|
Loading…
Reference in New Issue