diff --git a/test/SeleniumHui/test_lrr.py b/test/SeleniumHui/test_lrr.py index c1010fa..e5ec1a8 100644 --- a/test/SeleniumHui/test_lrr.py +++ b/test/SeleniumHui/test_lrr.py @@ -1,5 +1,6 @@ from helper import login, logout import time +import pytest from selenium.webdriver.common.by import By from selenium.webdriver.support.wait import WebDriverWait from selenium.webdriver.support import expected_conditions as EC @@ -33,7 +34,7 @@ def test_admin_can_create_lecturer_account(driver, url, admin_username, admin_pa 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 @@ -61,28 +62,56 @@ def test_lecturer_can_create_course(driver, url, restore_database): driver.quit() -def test_lecturer_can_post_assignment(): +def test_lecturer_can_post_assignment(driver, url, restore_database): # Lecturer mrlan@qq.com logs in - # Create an assignment called Take-home quiz 1 for course CSC1001 - assert True + driver.maximize_window() + 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(): # Lecturer mrlan@qq.com logs in # Add 6 ASE student numbers assert True +@pytest.mark.skip() def test_student_can_sign_up(): # Student with recognizable student number can sign up an account assert True +@pytest.mark.skip() def test_student_can_join_course(): # Student can join CSC1001 Advanced Software Engineering assert True +@pytest.mark.skip() def test_student_can_submit_assignment(): # Student can submit Take-home quiz 1 for CSC1001 assert True