Add test case: test_lecturer_can_post_assignment

Hui-Organize
Lan Hui 2024-09-25 16:10:55 +08:00
parent a34ab61916
commit 1ed7e2e394
1 changed files with 33 additions and 4 deletions

View File

@ -1,5 +1,6 @@
from helper import login, logout from helper import login, logout
import time import time
import pytest
from selenium.webdriver.common.by import By from selenium.webdriver.common.by import By
from selenium.webdriver.support.wait import WebDriverWait from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC from selenium.webdriver.support import expected_conditions as EC
@ -61,28 +62,56 @@ def test_lecturer_can_create_course(driver, url, restore_database):
driver.quit() driver.quit()
def test_lecturer_can_post_assignment(): def test_lecturer_can_post_assignment(driver, url, restore_database):
# Lecturer mrlan@qq.com logs in # Lecturer mrlan@qq.com logs in
# Create an assignment called Take-home quiz 1 for course CSC1001 driver.maximize_window()
assert True login(driver, url, 'lanhui@qq.com', '123')
# Create an assignment called Take-home quiz 1 for course (P.M2019) - Project Management
elems = driver.find_elements(By.CLASS_NAME, 'btn-default')
elems[1].click()
elem = driver.find_element(By.NAME, 'deadlinedate')
elem.send_keys('002024/12/30')
elem = driver.find_element(By.NAME, 'deadlinetime')
elem.send_keys('23:59')
elem = driver.find_element(By.NAME, 'title')
elem.send_keys('Take-home quiz 1')
elem = driver.find_element(By.NAME, 'instructions')
elem.send_keys('This is a closed-book quiz.')
elem = driver.find_element(By.NAME, 'marks')
elem.send_keys('10')
radio_button = driver.find_element(By.NAME, 'type')
radio_button.click()
elem = driver.find_element(By.CLASS_NAME, 'btn-primary')
elem.click()
# Check if the assignment has been successfully posted
elem = driver.find_element(By.CLASS_NAME, 'card-title')
assert 'Take-home quiz 1 (10 Marks, Individual)' in elem.text
elem = driver.find_element(By.CLASS_NAME, 'text-muted')
assert 'Deadline: 2024-12-30' in elem.text
@pytest.mark.skip()
def test_lecturer_can_add_student_numbers(): def test_lecturer_can_add_student_numbers():
# Lecturer mrlan@qq.com logs in # Lecturer mrlan@qq.com logs in
# Add 6 ASE student numbers # Add 6 ASE student numbers
assert True assert True
@pytest.mark.skip()
def test_student_can_sign_up(): def test_student_can_sign_up():
# Student with recognizable student number can sign up an account # Student with recognizable student number can sign up an account
assert True assert True
@pytest.mark.skip()
def test_student_can_join_course(): def test_student_can_join_course():
# Student can join CSC1001 Advanced Software Engineering # Student can join CSC1001 Advanced Software Engineering
assert True assert True
@pytest.mark.skip()
def test_student_can_submit_assignment(): def test_student_can_submit_assignment():
# Student can submit Take-home quiz 1 for CSC1001 # Student can submit Take-home quiz 1 for CSC1001
assert True assert True