From 6c6e60aac2e2b3449d19c776cc4aad2ca4661210 Mon Sep 17 00:00:00 2001 From: Ibrahim <1525200991@qq.com> Date: Mon, 29 Nov 2021 02:19:37 +0800 Subject: [PATCH] Update 2: test cases 05-07 --- Courses.php | 34 ++++++++++----------- test/SeleniumIbrahim/test_kit/instructor.py | 19 ++++++------ test/SeleniumIbrahim/test_kit/student.py | 6 ++-- 3 files changed, 29 insertions(+), 30 deletions(-) diff --git a/Courses.php b/Courses.php index 8db2318..9ba60e7 100644 --- a/Courses.php +++ b/Courses.php @@ -190,7 +190,7 @@ New Date/Time
Post new Lab Assignment -
+ @@ -205,11 +205,11 @@ New Date/Time
Title - + Instructions - + Marks - + Attachment 1 @@ -222,11 +222,11 @@ New Date/Time

- Submission Type Individual + Submission Type Individual - Group + Group
-
+




Course Name - + Course Code - + URL (Leave blank to use Course Code & Year) Academic Year - + Faculty
- + Verify Joining Students - Yes - No + Yes + No
-
+
@@ -529,7 +529,7 @@ if ($_SESSION['user_type'] == "Student") { } echo "
- [$code] $name
($url)
$msg2 + [$code] $name
($url)
$msg2
Faculty: $faculty | Year: $academic | Lecturer: $lecturer
$msg
"; } @@ -578,7 +578,7 @@ INNER JOIN course_students_table on course_students_table.Course_ID=courses_tabl
Find course by Code - +
List courses by faculty @@ -597,7 +597,7 @@ List courses by faculty

- +
diff --git a/test/SeleniumIbrahim/test_kit/instructor.py b/test/SeleniumIbrahim/test_kit/instructor.py index a738c2d..762b7c5 100644 --- a/test/SeleniumIbrahim/test_kit/instructor.py +++ b/test/SeleniumIbrahim/test_kit/instructor.py @@ -60,26 +60,25 @@ class Instructor(Actor): #wait until the lab submission form shows up wait2 = WebDriverWait(driver, 10) - new_lab_assignment_form = wait2.until(EC.presence_of_element_located((By.XPATH, "//form[@id='nlaf']"))) + new_lab_assignment_form = wait2.until(EC.presence_of_element_located((By.ID, "newlab_frm"))) #Fill the required form fields and submit. - lab_date = new_lab_assignment_form.find_element(By.XPATH, "//input[@id='date'][@name='deadlinedate']") - timeStr = self.utility.getTodayDate() - lab_date.send_keys(timeStr) - lab_title = new_lab_assignment_form.find_element(By.XPATH, "//form[@id='nlaf']/input[@id='ltitle']") + lab_date = new_lab_assignment_form.find_element(By.ID, "date") + lab_date.send_keys(dateStr) + lab_title = new_lab_assignment_form.find_element(By.ID, "lab_title") lab_title.send_keys("TESTASSIGNMENT"+str(dateStr)) - lab_instructions = new_lab_assignment_form.find_element(By.XPATH, "//form[@id='nlaf']/textarea[@id='linstruct']") + lab_instructions = new_lab_assignment_form.find_element(By.ID, "lab_inst") lab_instructions.send_keys("TESTINSTRUCTIONS"+str(dateStr)) - lab_marks = new_lab_assignment_form.find_element(By.XPATH, "//form[@id='nlaf']/input[@id='lmark']") + lab_marks = new_lab_assignment_form.find_element(By.ID, "lab_mark") lab_marks.send_keys("4") #if group == 0 select individual submission, if group == 1 select group submission if group == 0: - submission_type = new_lab_assignment_form.find_element(By.XPATH, "//form[@id='nlaf']/input[@id='lindi']") + submission_type = new_lab_assignment_form.find_element(By.ID, "lab_ind") elif group == 1: - submission_type = new_lab_assignment_form.find_element(By.XPATH, "//form[@id='nlaf']/input[@id='lgrp']") + submission_type = new_lab_assignment_form.find_element(By.ID, "lab_grp") submission_type.click() - submit = new_lab_assignment_form.find_element(By.XPATH, "//form[@id='nlaf']/input[@id='lbtn']") + submit = new_lab_assignment_form.find_element(By.ID, "submit_btn") submit.click() return 0 except: diff --git a/test/SeleniumIbrahim/test_kit/student.py b/test/SeleniumIbrahim/test_kit/student.py index acbe814..e51a67e 100644 --- a/test/SeleniumIbrahim/test_kit/student.py +++ b/test/SeleniumIbrahim/test_kit/student.py @@ -55,10 +55,10 @@ class Student(Actor): #Wait until the course is found, and join. wait2 = WebDriverWait(driver, 10) - course_card = wait.until(EC.element_to_be_clickable((By.LINK_TEXT, str("Join Course")))) - course_card.click() + join_btn = wait2.until(EC.element_to_be_clickable((By.ID, "join_btn"))) + join_btn.click() - #If the joined course successfully, proceed. + #If joined course successfully, proceed. wait3 = WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.XPATH, "/html/body/div[1]/div[1]/span"))) return 0