Add one new regression test: test_student_with_weak_password_cannot_sign_up
parent
0a12b69d2c
commit
aa82e9b5db
|
@ -192,6 +192,33 @@ def test_student_with_invalid_student_number_cannot_sign_up(driver, url, restore
|
||||||
driver.quit()
|
driver.quit()
|
||||||
|
|
||||||
|
|
||||||
|
def test_student_with_weak_password_cannot_sign_up(driver, url, restore_database):
|
||||||
|
driver.get(url)
|
||||||
|
driver.maximize_window()
|
||||||
|
weak_password = '123Abc'
|
||||||
|
elem = driver.find_element(By.ID, 'signup_link')
|
||||||
|
elem.click()
|
||||||
|
elem = driver.find_element(By.NAME, 'fullname')
|
||||||
|
elem.send_keys('Good Student')
|
||||||
|
elem = driver.find_element(By.NAME, 'user_student_id')
|
||||||
|
elem.send_keys('202400000001')
|
||||||
|
elem = driver.find_element(By.NAME, 'email')
|
||||||
|
elem.send_keys('goodstudent@qq.com')
|
||||||
|
elem = driver.find_element(By.NAME, 'password')
|
||||||
|
elem.send_keys(weak_password)
|
||||||
|
elem = driver.find_element(By.NAME, 'confirmpassword')
|
||||||
|
elem.send_keys(weak_password)
|
||||||
|
elem = driver.find_element(By.ID, 'signup_btn')
|
||||||
|
elem.click()
|
||||||
|
|
||||||
|
# Log in Student account
|
||||||
|
login(driver, url, '202400000001', weak_password)
|
||||||
|
elems = driver.find_elements(By.CLASS_NAME, 'nav-link')
|
||||||
|
assert not 'Student ID' in elems[0].text
|
||||||
|
assert not 'Good Student' in elems[0].text
|
||||||
|
driver.quit()
|
||||||
|
|
||||||
|
|
||||||
def test_student_can_join_course(driver, url, restore_database):
|
def test_student_can_join_course(driver, url, restore_database):
|
||||||
# Student can join (CSC1111) - Project Management
|
# Student can join (CSC1111) - Project Management
|
||||||
login(driver, url, '201825800050', '123')
|
login(driver, url, '201825800050', '123')
|
||||||
|
@ -226,11 +253,9 @@ def test_student_can_submit_assignment(driver, url, restore_database):
|
||||||
|
|
||||||
# Enter into the course and the find the assignment
|
# Enter into the course and the find the assignment
|
||||||
elems = driver.find_elements(By.CLASS_NAME, 'btn-default')
|
elems = driver.find_elements(By.CLASS_NAME, 'btn-default')
|
||||||
time.sleep(3)
|
|
||||||
elems[1].click()
|
elems[1].click()
|
||||||
|
|
||||||
elem = driver.find_element(By.XPATH, '//div[@id="menu1"]/div/div/p/a[text()="Submit"]') # find the submit button
|
elem = driver.find_element(By.XPATH, '//div[@id="menu1"]/div/div/p/a[text()="Submit"]') # find the submit button
|
||||||
time.sleep(3)
|
|
||||||
elem.click()
|
elem.click()
|
||||||
|
|
||||||
# Fill submission title, attach file, and submit
|
# Fill submission title, attach file, and submit
|
||||||
|
@ -239,14 +264,12 @@ def test_student_can_submit_assignment(driver, url, restore_database):
|
||||||
elem = driver.find_element(By.NAME, 'attachment1')
|
elem = driver.find_element(By.NAME, 'attachment1')
|
||||||
elem.send_keys('/home/mrlan/Downloads/test/SeleniumHui/helper.py') # attach a file
|
elem.send_keys('/home/mrlan/Downloads/test/SeleniumHui/helper.py') # attach a file
|
||||||
elem = driver.find_element(By.XPATH, '//form/button')
|
elem = driver.find_element(By.XPATH, '//form/button')
|
||||||
time.sleep(3)
|
|
||||||
elem.click()
|
elem.click()
|
||||||
|
|
||||||
# Go the Submitted tab
|
# Go the Submitted tab
|
||||||
elem = driver.find_element(By.ID, 'myTab')
|
elem = driver.find_element(By.ID, 'myTab')
|
||||||
elems = elem.find_elements(By.CLASS_NAME, 'nav-link')
|
elems = elem.find_elements(By.CLASS_NAME, 'nav-link')
|
||||||
elems[2].click()
|
elems[2].click()
|
||||||
time.sleep(3)
|
|
||||||
|
|
||||||
elem = driver.find_element(By.XPATH, '//div[@id="menu3"]/div')
|
elem = driver.find_element(By.XPATH, '//div[@id="menu3"]/div')
|
||||||
assert 'Reading 2 (6 Marks)' in elem.text
|
assert 'Reading 2 (6 Marks)' in elem.text
|
||||||
|
|
Loading…
Reference in New Issue