From ef6e79f31c3fc86163a47f476861966fba1c815f Mon Sep 17 00:00:00 2001
From: Ibrahim <1525200991@qq.com>
Date: Sun, 5 Dec 2021 00:59:43 +0800
Subject: [PATCH] Update 3: test cases 07-16
---
Admin.php | 8 +++++---
Course.php | 10 +++++-----
Courses.php | 8 +++++---
Submissions.php | 8 +++++---
SubmitLab.php | 8 ++++----
test/SeleniumIbrahim/test_kit/admin.py | 8 ++++----
test/SeleniumIbrahim/test_kit/instructor.py | 10 +++++-----
test/SeleniumIbrahim/test_kit/student.py | 16 ++++++++--------
test/SeleniumIbrahim/test_kit/utility.py | 11 ++++++-----
9 files changed, 47 insertions(+), 40 deletions(-)
diff --git a/Admin.php b/Admin.php
index 5c494d9..f2cbee2 100644
--- a/Admin.php
+++ b/Admin.php
@@ -157,7 +157,7 @@ if ($_SESSION['user_type'] != "Lecturer") {
@@ -182,6 +182,7 @@ if ($_SESSION['user_type'] != "Lecturer") {
$result = mysqli_query($con, "SELECT `Course_ID`, `Course_Name`, `Academic_Year`, `Faculty`, `Lecturer_User_ID`, `TA_User_ID`, `Course_Code`, `URL`, `Verify_New_Members` , users_table.Full_Name FROM `courses_table` INNER JOIN users_table ON users_table.User_ID=courses_table.Lecturer_User_ID");
if (mysqli_num_rows($result) == 0) {
} else {
+ $counter = 0;
while ($row = mysqli_fetch_assoc($result)) {
$name = $row['Course_Name'];
$code = $row['Course_Code'];
@@ -189,6 +190,7 @@ if ($_SESSION['user_type'] != "Lecturer") {
$lecturer = $row['Full_Name'];
$academic = $row['Academic_Year'];
$c_id = $row['Course_ID'];
+ $counter += 1;
$resultTA = mysqli_query($con, "SELECT `Course_ID`, `TA`,users_table.Full_Name as TA_NAME FROM `course_ta`
INNER JOIN users_table on users_table.User_ID=course_ta.TA
@@ -200,7 +202,7 @@ where course_ta.Course_ID=$c_id");
}
echo "
- $code - $name $faculty $lecturer $ta
";
}
} ?>
diff --git a/Course.php b/Course.php
index 8946d75..a4b7976 100644
--- a/Course.php
+++ b/Course.php
@@ -90,7 +90,7 @@ if ($_SESSION['user_type'] == "Student") {
Submitted
- Marked
+ Marked
@@ -239,7 +239,7 @@ if ($_SESSION['user_type'] == "Student") {
}
echo "
$title ($type)
$ins
-
Posted : $posted Deadline : $deadline ($Marks Marks) Submit Lab Report Attachments : $full_link
+
Posted : $posted Deadline : $deadline ($Marks Marks) Submit Lab Report Attachments : $full_link
";
}
}
@@ -457,7 +457,7 @@ where Lab_Report_ID=$lab_repo_id and (lab_report_submissions.Student_id='$studen
$remarking_reason = $row['Remarking_Reason'];
if ($status == 'Marked') {
$rm_data = "\Script.php?remarking=yes&id=$Submission_ID&url=$url&status=Remarking";
- $remarking = " Request Remarking ";
+ $remarking = "";
}
if ($status == 'Remarking') {
$remarking = " Remarking Request sent Remarking Reason:$remarking_reason ";
@@ -520,7 +520,7 @@ where Lab_Report_ID=$lab_repo_id and (lab_report_submissions.Student_id='$studen
$count_groups = $row['Course_Group_id'];
}
- echo " Create Group ";
+ echo " Create Group ";
?>
@@ -584,7 +584,7 @@ include 'Footer.php';
try {
$('').dialog({
modal: true,
title: 'Create Group',
diff --git a/Courses.php b/Courses.php
index f4722a2..29b4eee 100644
--- a/Courses.php
+++ b/Courses.php
@@ -30,9 +30,9 @@ if ($_SESSION['user_type'] == "Lecturer" || $_SESSION['user_type'] == "TA") {
$('').dialog({
@@ -259,6 +259,7 @@ New Date/Time $att1";
+ $counter += 1;
if ($att2 != "") {
$full_link = $full_link . "  |  $att2 ";
@@ -307,7 +309,7 @@ New Date/Time Posted : $posted Deadline : $deadline ($marks Marks) "
. " "
- . " $count_subs Submissions ( $count_marked Marked ) Edit | View | Extend Deadline Attachments : $full_link "
+ . " $count_subs Submissions ( $count_marked Marked ) Edit | View | Extend Deadline Attachments : $full_link "
. "
";
}
diff --git a/Submissions.php b/Submissions.php
index 2505d39..b921545 100644
--- a/Submissions.php
+++ b/Submissions.php
@@ -139,6 +139,7 @@ where Lab_Report_ID=$id and lab_report_submissions.Status='Pending' order by Sub
if (mysqli_num_rows($result1) == 0) {
echo "No Un-Marked Submissions for this Lab Report.";
} else {
+ $mark_submission_btn_counter = 0;
while ($row = mysqli_fetch_assoc($result1)) {
$title = $row['Title'];
$Marks = $row['Marks'];
@@ -157,6 +158,7 @@ where Lab_Report_ID=$id and lab_report_submissions.Status='Pending' order by Sub
$groupname = $row['Group_Name'];
$groupleader = $row['Group_Leader'];
$student_id = $row['sub_std'];
+ $mark_submission_btn_counter += 1;
if ($submitted_group == 0) {
$submitted_by = $student_name . "(" . $student_id . ")";
@@ -184,7 +186,7 @@ where Lab_Report_ID=$id and lab_report_submissions.Status='Pending' order by Sub
echo "
$title by: $submitted_by
- Submitted : $posted Mark Submission Attachments : $full_link
+ Submitted : $posted Mark Submission Attachments : $full_link
";
}
}
@@ -419,8 +421,8 @@ where course_group_members_table.Course_Group_id=$id");
try {
$('').dialog({
modal: true,
title: 'Mark Submission',
diff --git a/SubmitLab.php b/SubmitLab.php
index 5515348..0ed44d5 100644
--- a/SubmitLab.php
+++ b/SubmitLab.php
@@ -88,7 +88,7 @@ include 'Header.php';
-
+
@@ -96,10 +96,10 @@ include 'Header.php';
Title
-
+
Attachment 1
-
+
Attachment 2
@@ -115,7 +115,7 @@ include 'Header.php';
-
+
diff --git a/test/SeleniumIbrahim/test_kit/admin.py b/test/SeleniumIbrahim/test_kit/admin.py
index a8958a1..975d144 100644
--- a/test/SeleniumIbrahim/test_kit/admin.py
+++ b/test/SeleniumIbrahim/test_kit/admin.py
@@ -188,18 +188,18 @@ class Admin(Actor):
#Locate the "Admin" tab.
wait = WebDriverWait(driver, 10)
- admin = wait.until(EC.presence_of_element_located((By.XPATH, "/html/body/nav/div/form/a[1]")))
+ admin = wait.until(EC.presence_of_element_located((By.ID, "admin_tab")))
admin.click()
#Navigate to "Existing Courses" table.
wait2 = WebDriverWait(driver, 10)
- courses_table = wait2.until(EC.presence_of_element_located((By.XPATH, "/html/body/div[2]/div[2]/div/ul/li[2]/a")))
+ courses_table = wait2.until(EC.presence_of_element_located((By.ID, "existing_courses")))
courses_table.click()
#Assign TA to the first course in "Existing Courses" table
wait3 = WebDriverWait(driver, 10)
- drop_menu_form = wait3.until(EC.presence_of_element_located((By.XPATH, "//*[@id='menub']/table/tbody/tr[2]/td[5]/form")))
- assign_btn = drop_menu_form.find_element(By.XPATH, "//input[@type='submit'][@value='assign']")
+ drop_menu_form = wait3.until(EC.presence_of_element_located((By.ID, "drop_menu_form_1")))
+ assign_btn = drop_menu_form.find_element(By.ID, "assign_btn_1")
assign_btn.click()
return 0
diff --git a/test/SeleniumIbrahim/test_kit/instructor.py b/test/SeleniumIbrahim/test_kit/instructor.py
index 33ed952..4c71da9 100644
--- a/test/SeleniumIbrahim/test_kit/instructor.py
+++ b/test/SeleniumIbrahim/test_kit/instructor.py
@@ -164,12 +164,12 @@ class Instructor(Actor):
#Wait until the submission portal card appears
wait2 = WebDriverWait(driver, 10)
- view = wait2.until(EC.presence_of_element_located((By.ID, "view_btn")))
+ view = wait2.until(EC.presence_of_element_located((By.ID, "view_submissions_link_1")))
view.click()
#Locate and click the 'Mark Submission' btn
wait3 = WebDriverWait(driver, 10)
- mark_submission = wait3.until(EC.presence_of_element_located((By.ID, "mark_btn")))
+ mark_submission = wait3.until(EC.presence_of_element_located((By.ID, "mark_submission_btn_1")))
mark_submission.click()
#Fill and submit marking descision
@@ -210,7 +210,7 @@ class Instructor(Actor):
#Wait until lab report assignment list appears.
wait = WebDriverWait(driver, 10)
- extend_deadline = wait.until(EC.presence_of_element_located((By.ID, "ext_btn")))
+ extend_deadline = wait.until(EC.presence_of_element_located((By.ID, "extend_deadline_link")))
extend_deadline.click()
#Wait until the extend deadline popup window shows up.
@@ -218,10 +218,10 @@ class Instructor(Actor):
extend_deadline_form = wait2.until(EC.presence_of_element_located((By.ID, "frm")))
#Insert the new deadline and submit for all.
- new_date = extend_deadline_form.find_element(By.XPATH, "//form[@id='frm']/input[3]")
+ new_date = extend_deadline_form.find_element(By.ID, "new_date")
dateStr = self.utility.getTomorrowDate()
new_date.send_keys(str(dateStr))
- target = extend_deadline_form.find_element(By.XPATH, "//form[@id='frm']/input[5]")
+ target = extend_deadline_form.find_element(By.ID, "extend_for_all")
target.click()
submit = extend_deadline_form.find_element(By.XPATH, "/html/body/div[3]/div[2]/div/button[1]")
submit.click()
diff --git a/test/SeleniumIbrahim/test_kit/student.py b/test/SeleniumIbrahim/test_kit/student.py
index e51a67e..ac9c5e5 100644
--- a/test/SeleniumIbrahim/test_kit/student.py
+++ b/test/SeleniumIbrahim/test_kit/student.py
@@ -89,19 +89,19 @@ class Student(Actor):
#Locate and click assignment submission button.
wait2 = WebDriverWait(driver, 10)
- assignment_card = wait2.until(EC.element_to_be_clickable((By.LINK_TEXT, "Submit Lab Report")))
+ assignment_card = wait2.until(EC.element_to_be_clickable((By.ID, "submit_lab_report_btn")))
assignment_card.click()
#Locate the assignment submission form and fill in the required data.
wait3 = WebDriverWait(driver, 10)
- assignment_form = wait3.until(EC.presence_of_element_located((By.ID, "sub_form")))
+ assignment_form = wait3.until(EC.presence_of_element_located((By.ID, "submit_lab_report_form")))
title = assignment_form.find_element(By.ID, "title")
dateStr = self.utility.getTodayDate()
timeStr = self.utility.getTime()
title.send_keys("TESTSUBMISSIOM"+dateStr+timeStr)
- attachment = assignment_form.find_element(By.ID, "att_one")
+ attachment = assignment_form.find_element(By.ID, "attachment1")
attachment.send_keys(os.getcwd()+"/DUMMY_SUBMISSION.txt")
- submit = driver.find_element(By.ID, "submit_btn")
+ submit = driver.find_element(By.ID, "submit_lab_assignment_btn")
submit.click()
return 0
@@ -135,7 +135,7 @@ class Student(Actor):
wait2 = WebDriverWait(driver, 10)
marked_tab = wait2.until(EC.presence_of_element_located((By.ID, "marked_tab")))
marked_tab.click()
- req_remark = driver.find_element(By.ID, "req_remark")
+ req_remark = driver.find_element(By.ID, "request_remarking_btn")
req_remark.click()
#Fill in the remarking form and submit.
@@ -172,7 +172,7 @@ class Student(Actor):
#Locate the create course group button and click it.
wait2 = WebDriverWait(driver, 10)
- create_group = wait2.until(EC.presence_of_element_located((By.ID, "g_create_btn")))
+ create_group = wait2.until(EC.presence_of_element_located((By.ID, "create_group_btn")))
create_group.click()
#Fill in the course group form and create.
@@ -180,9 +180,9 @@ class Student(Actor):
group_form = wait3.until(EC.presence_of_element_located((By.ID, "frm")))
timeStr = self.utility.getTime()
dateStr = self.utility.getTodayDate()
- group_name = group_form.find_element(By.ID, "g_name")
+ group_name = group_form.find_element(By.ID, "group_name")
group_name.send_keys("TESTGROUP"+str(dateStr)+str(timeStr))
- create = group_form.find_element(By.XPATH, "//div[2]/div/button[1]")
+ create = driver.find_element(By.XPATH, "/html/body/div[7]/div[2]/div/button[1]")
create.click()
return 0
diff --git a/test/SeleniumIbrahim/test_kit/utility.py b/test/SeleniumIbrahim/test_kit/utility.py
index a18c958..71b658d 100644
--- a/test/SeleniumIbrahim/test_kit/utility.py
+++ b/test/SeleniumIbrahim/test_kit/utility.py
@@ -175,8 +175,9 @@ class MyUtility:
- date: formatted date string.
"""
- date = datetime.datetime.today().strftime ('%d%m%Y')
- return date
+ date = datetime.datetime.today() + datetime.timedelta(days=1)
+ date_str = date.strftime ('%m%d%Y')
+ return date_str
def getTomorrowDate(self):
@@ -187,8 +188,8 @@ class MyUtility:
- date: formatted date string.
"""
- date = datetime.datetime.today() + datetime.timedelta(days=1)
- date_str = date.strftime('%d%m%Y')
+ date = datetime.datetime.today() + datetime.timedelta(days=2)
+ date_str = date.strftime('%m%d%Y')
return date_str
def getYesterdayDate(self):
@@ -201,7 +202,7 @@ class MyUtility:
"""
date = datetime.datetime.today() - datetime.timedelta(days=1)
- date_str = date.strftime('%d%m%Y')
+ date_str = date.strftime('%m%d%Y')
return date_str
def storeCourseCode(self, course_code):
--
2.17.1