74 lines
2.3 KiB
Python
74 lines
2.3 KiB
Python
|
from helper import login
|
||
|
from selenium.webdriver.common.by import By
|
||
|
from selenium.webdriver.support.wait import WebDriverWait
|
||
|
from selenium.webdriver.support import expected_conditions as EC
|
||
|
import time
|
||
|
|
||
|
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 Lecture account for 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()
|
||
|
time.sleep(1)
|
||
|
|
||
|
# Log out Admin
|
||
|
logout_button = WebDriverWait(driver, 10).until(
|
||
|
EC.element_to_be_clickable(
|
||
|
(By.XPATH, "//a[contains(@class, 'nav-link') and contains(@href, 'logout.php')]"))
|
||
|
)
|
||
|
logout_button.click()
|
||
|
time.sleep(1)
|
||
|
|
||
|
# Log in Lecture account
|
||
|
login(driver, url, 'mrlan@qq.com', '123Abc!!')
|
||
|
elems = driver.find_elements(By.CLASS_NAME, 'nav-link')
|
||
|
assert '(Lecturer)' in elems[0].text
|
||
|
driver.quit()
|
||
|
|
||
|
|
||
|
|
||
|
def test_lecturer_can_create_course():
|
||
|
# Lecturer mrlan@qq.com logs in
|
||
|
# Create a course called CSC1001 Advanced Software Engineering, 2024
|
||
|
assert True
|
||
|
|
||
|
|
||
|
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
|