89 lines
2.8 KiB
Python
89 lines
2.8 KiB
Python
from helper import login, logout
|
|
import time
|
|
from selenium.webdriver.common.by import By
|
|
from selenium.webdriver.support.wait import WebDriverWait
|
|
from selenium.webdriver.support import expected_conditions as EC
|
|
|
|
|
|
def test_admin_can_create_lecturer_account(driver, url, admin_username, admin_password, restore_database):
|
|
# Administrator (admin@qq.com, password 123) logs in
|
|
driver.maximize_window()
|
|
login(driver, url, admin_username, admin_password)
|
|
|
|
# Create a Lecturer account for Mr Lan (mrlan@qq.com, password [123Abc!])
|
|
tab = driver.find_element(By.ID, 'tab_ins_accounts')
|
|
tab.click()
|
|
elem = driver.find_element(By.NAME, 'fullname')
|
|
elem.send_keys('Mr Lan')
|
|
elem = driver.find_element(By.NAME, 'email')
|
|
elem.send_keys('mrlan@qq.com')
|
|
elem = driver.find_element(By.NAME, 'password')
|
|
elem.send_keys('123Abc!!')
|
|
radio_button = driver.find_element(By.NAME, 'type')
|
|
radio_button.click()
|
|
button = driver.find_element(By.NAME, 'create_btn')
|
|
button.click()
|
|
|
|
# Log out Admin account
|
|
logout(driver)
|
|
|
|
# Log in Lecturer account
|
|
login(driver, url, 'mrlan@qq.com', '123Abc!!')
|
|
elems = driver.find_elements(By.CLASS_NAME, 'nav-link')
|
|
assert '(Lecturer)' in elems[0].text
|
|
assert 'Mr Lan' in elems[0].text
|
|
driver.quit()
|
|
|
|
|
|
def test_lecturer_can_create_course(driver, url, restore_database):
|
|
# Lecturer lanhui@qq.com logs in
|
|
driver.maximize_window()
|
|
login(driver, url, 'lanhui@qq.com', '123')
|
|
|
|
# Create a course called CSC1001 Advanced Software Engineering, 2024
|
|
elem = driver.find_element(By.NAME, 'name')
|
|
elem.send_keys('Advanced Software Engineering')
|
|
elem = driver.find_element(By.NAME, 'code')
|
|
elem.send_keys('CSC1001')
|
|
elem = driver.find_element(By.NAME, 'academic')
|
|
elem.send_keys('2004')
|
|
elem = driver.find_element(By.NAME, 'faculty')
|
|
elem.send_keys('School of Computer Science and Technology')
|
|
elem = driver.find_element(By.CLASS_NAME, 'btn-primary')
|
|
elem.click()
|
|
elems = driver.find_elements(By.CLASS_NAME, 'btn-default')
|
|
last_elem = elems[-1]
|
|
assert 'Advanced Software Engineering' in last_elem.text
|
|
assert '(CSC1001)' in last_elem.text
|
|
|
|
# Logout
|
|
logout(driver)
|
|
driver.quit()
|
|
|
|
|
|
def test_lecturer_can_post_assignment():
|
|
# Lecturer mrlan@qq.com logs in
|
|
# Create an assignment called Take-home quiz 1 for course CSC1001
|
|
assert True
|
|
|
|
|
|
def test_lecturer_can_add_student_numbers():
|
|
# Lecturer mrlan@qq.com logs in
|
|
# Add 6 ASE student numbers
|
|
assert True
|
|
|
|
|
|
def test_student_can_sign_up():
|
|
# Student with recognizable student number can sign up an account
|
|
assert True
|
|
|
|
|
|
def test_student_can_join_course():
|
|
# Student can join CSC1001 Advanced Software Engineering
|
|
assert True
|
|
|
|
|
|
def test_student_can_submit_assignment():
|
|
# Student can submit Take-home quiz 1 for CSC1001
|
|
assert True
|