Merge pull request 'Update 3: test cases 07-16' (#30) from SeleniumIbrahim-Ibrahim into master

Reviewed-on: http://121.4.94.30:3000/mrlan/LRR/pulls/30
mrlan 2021-12-14 12:45:51 +08:00
commit 3f81266852
9 changed files with 47 additions and 40 deletions

View File

@ -157,7 +157,7 @@ if ($_SESSION['user_type'] != "Lecturer") {
<!-- Nav tabs -->
<ul class="nav nav-tabs" role="tablist">
<li class="nav-item">
<a class="nav-link active" data-toggle="tab" href="#menub">Existing Courses</a>
<a class="nav-link active" data-toggle="tab" href="#menub" id="existing_courses">Existing Courses</a>
</li>
</ul>
@ -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 "
<tr> <td>$code - $name</td> <td>$faculty </td> <td>$lecturer</td><td>$ta</td> <td><form method='get' action='Script.php'> <select name='ta' class=''>";
<tr> <td>$code - $name</td> <td>$faculty </td> <td>$lecturer</td><td>$ta</td> <td><form method='get' action='Script.php' id='drop_menu_form_$counter'> <select name='ta' class=''>";
$resultx = mysqli_query($con, "SELECT * FROM Users_Table WHERE UserType='TA'");
if (mysqli_num_rows($resultx) == 0) {
@ -212,7 +214,7 @@ where course_ta.Course_ID=$c_id");
}
}
echo "</select> <input type='hidden' name='assignTA' value='true'> <input type='hidden' name='id' value='$c_id'> <input type='submit' value='assign'></form> </td></tr>
echo "</select> <input type='hidden' name='assignTA' value='true'> <input type='hidden' name='id' value='$c_id'> <input type='submit' value='assign' id='assign_btn_$counter'></form> </td></tr>
";
}
} ?>

View File

@ -90,7 +90,7 @@ if ($_SESSION['user_type'] == "Student") {
<a class="nav-link" data-toggle="tab" href="#menu3">Submitted</a>
</li>
<li class="nav-item">
<a class="nav-link" data-toggle="tab" href="#menu4">Marked</a>
<a class="nav-link" data-toggle="tab" href="#menu4" id="marked_tab">Marked</a>
</li>
<!----------Delete Course Button----------->
@ -239,7 +239,7 @@ if ($_SESSION['user_type'] == "Student") {
}
echo " <k href='#'> <div class='btn btn-default break-word' style='dislay:block; word-wrap: break-word; border: 1px solid #F0F0F0;border-left: 4px solid #03407B;'>
$title ($type) <br> <span style='font-size:8pt'> $ins</span>
<br> <span style='font-size:8pt'>Posted : $posted &nbsp;&nbsp;&nbsp;&nbsp; Deadline : $deadline &nbsp;&nbsp;&nbsp;&nbsp;($Marks Marks) &nbsp; &nbsp;&nbsp;&nbsp; &nbsp;<a href='~\..\SubmitLab.php?id=$labid&url=$url' class='btn-sm btn-info' style='margin-left:50px;'> Submit Lab Report</a><br> Attachments : $full_link </span>
<br> <span style='font-size:8pt'>Posted : $posted &nbsp;&nbsp;&nbsp;&nbsp; Deadline : $deadline &nbsp;&nbsp;&nbsp;&nbsp;($Marks Marks) &nbsp; &nbsp;&nbsp;&nbsp; &nbsp;<a href='~\..\SubmitLab.php?id=$labid&url=$url' class='btn-sm btn-info' style='margin-left:50px;' id='submit_lab_report_btn'> Submit Lab Report</a><br> Attachments : $full_link </span>
</div></k>";
}
}
@ -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 = "<button onclick='remarking(\"$rm_data\")' class='btn-sm btn-success'> Request Remarking </button>";
$remarking = "<button onclick='remarking(\"$rm_data\")' class='btn-sm btn-success' id='request_remarking_btn'> Request Remarking </button>";
}
if ($status == 'Remarking') {
$remarking = "<span style='color:orange'><i class='fa fa-info-circle'></i> Remarking Request sent </span> <br> Remarking Reason:<i>$remarking_reason </i> <br>";
@ -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 " <button onclick='CreateGroup()' class='btn btn-primary'> Create Group</button>";
echo " <button onclick='CreateGroup()' class='btn btn-primary' id='create_group_btn'> Create Group</button>";
?>
@ -584,7 +584,7 @@ include 'Footer.php';
try {
$('<form id="frm" method="get" action="Script.php"><input type="hidden" name="creategroup" value="true">\n\
<input type="hidden" name="student_id" value="<?php echo $student_id; ?>" > Group Name <input type="text" name="name">\n\
<input type="hidden" name="student_id" value="<?php echo $student_id; ?>" > Group Name <input type="text" name="name" id="group_name">\n\
<input type="hidden" name="url" value="<?php echo $url; ?>"> <input type="hidden" name="id" value="<?php echo $course_id; ?>"> </form>').dialog({
modal: true,
title: 'Create Group',

View File

@ -30,9 +30,9 @@ if ($_SESSION['user_type'] == "Lecturer" || $_SESSION['user_type'] == "TA") {
$('<form id="frm" method="get" action="Script.php">\n\
<input type="hidden" name="extenddeadline" value="true" >\n\
<input type="hidden" name="id" value="' + id + '" > \n\
New Date/Time <br><input type="date" name="date" required=""> <input type="time" name="time" required=""> \n\
New Date/Time <br><input type="date" name="date" required="" id="new_date"> <input type="time" name="time" required=""> \n\
\n\
<br><input type="radio" value="1" name="type" required=""> Extend for All<hr> \n\
<br><input type="radio" value="1" name="type" required="" id="extend_for_all"> Extend for All<hr> \n\
<input type="radio" value="2" name="type" required=""> Extend for these Individual Students \n\
' + dropstudents + ' \n\
</form>').dialog({
@ -259,6 +259,7 @@ New Date/Time <br><input type="date" name="date" required=""> <input type="time"
if (mysqli_num_rows($result) == 0) {
echo "No assignments posted so far.";
} else {
$counter = 0;
while ($row = mysqli_fetch_assoc($result)) {
$marks = $row['Marks'];
$title = $row['Title'];
@ -273,6 +274,7 @@ New Date/Time <br><input type="date" name="date" required=""> <input type="time"
$cours_id = $row['Course_ID'];
$as_type = $row['Type'];
$full_link = "<a href='~\..\Lab_Report_Assignments\\$att1'>$att1</a>";
$counter += 1;
if ($att2 != "") {
$full_link = $full_link . " &nbsp|&nbsp <a href='~\..\Lab_Report_Assignments\\$att2'>$att2</a>";
@ -307,7 +309,7 @@ New Date/Time <br><input type="date" name="date" required=""> <input type="time"
<br> <span style='font-size:8pt'>Posted : $posted Deadline : <b> $deadline </b> &nbsp; ($marks Marks) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "
. "<br>"
. "<span class='btn-default'> &nbsp;&nbsp; $count_subs Submissions ( $count_marked Marked ) &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href='Courses.php?course=" . $url . "&act=edit&cid=" . $id . "'>Edit</a>&nbsp;&nbsp; |&nbsp;&nbsp;<a href='~\..\Submissions.php?id=$id&header=$header&total=$marks' onclick=''> View </a> &nbsp;&nbsp; |&nbsp;&nbsp; <a href='#' onclick='extend_deadline($id)'> Extend Deadline </a> </span> <hr> Attachments : $full_link </span>"
. "<span class='btn-default'> &nbsp;&nbsp; $count_subs Submissions ( $count_marked Marked ) &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href='Courses.php?course=" . $url . "&act=edit&cid=" . $id . "'>Edit</a>&nbsp;&nbsp; |&nbsp;&nbsp;<a href='~\..\Submissions.php?id=$id&header=$header&total=$marks' onclick='' id='view_submissions_link_$counter'> View </a> &nbsp;&nbsp; |&nbsp;&nbsp; <a href='#' onclick='extend_deadline($id)' id='extend_deadline_link'> Extend Deadline </a> </span> <hr> Attachments : $full_link </span>"
. "&nbsp;&nbsp;</div>
";
}

View File

@ -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 " <k href='#'> <div class='btn btn-default break-word' style='dislay:block; word-wrap: break-word; border: 1px solid #F0F0F0;border-left: 4px solid #03407B;'>
$title <br> by: <b> $submitted_by </b>
<br> <span style='font-size:8pt'>Submitted : $posted <button class='btn-sm btn-info' style='margin-left:50px;' onclick='mark($Submission_ID,\"$title\",$total)'> Mark Submission</button><br> Attachments : $full_link </span>
<br> <span style='font-size:8pt'>Submitted : $posted <button class='btn-sm btn-info' style='margin-left:50px;' onclick='mark($Submission_ID,\"$title\",$total)' id='mark_submission_btn_$mark_submission_btn_counter'> Mark Submission</button><br> Attachments : $full_link </span>
</div></k>";
}
}
@ -419,8 +421,8 @@ where course_group_members_table.Course_Group_id=$id");
try {
$('<form id="submit-form" method="get" action="Script.php">' + title + '(' + marks + ' marks) <input type="hidden" name="savemarks" value="true">\n\
<input type="hidden" name="total" value="' + marks + '" > <input type="hidden" name="id" value="' + id + '" ><br> Marks <input type="text" name="marks">\n\
Comments <textarea name="feedback"></textarea> \n\
<input type="hidden" name="total" value="' + marks + '" > <input type="hidden" name="id" value="' + id + '" ><br> Marks <input type="text" name="marks" id="marks">\n\
Comments <textarea name="feedback" id="feedback"></textarea> \n\
<input type="hidden" name="labid" value="<?php echo $course_id; ?>"> <input type="hidden" name="header" value="<?php echo $header; ?>"> </form>').dialog({
modal: true,
title: 'Mark Submission',

View File

@ -88,7 +88,7 @@ include 'Header.php';
<div class="col-md-6">
<form method='post' enctype='multipart/form-data' action='Script.php'>
<form method='post' enctype='multipart/form-data' action='Script.php' id="submit_lab_report_form">
<input type='hidden' name='frm_submitlab' value='true' required='' />
<input type='hidden' name='lab_id' value='<?php echo $id; ?>' required='' />
<input type='hidden' name='student_id' value='<?php echo $student_id; ?>' required='' />
@ -96,10 +96,10 @@ include 'Header.php';
<input type='hidden' name='url' value='<?php echo $url; ?>' required='' />
Title
<input type='text' name='title' placeholder='Ttle' class='form-control' required=''>
<input type='text' name='title' placeholder='Ttle' class='form-control' required='' id="title">
Attachment 1
<input type='file' name='attachment1' placeholder='Attachment 1' class='form-control' required=''>
<input type='file' name='attachment1' placeholder='Attachment 1' class='form-control' required='' id="attachment1">
Attachment 2
<input type='file' name='attachment2' placeholder='Attachment 2' class='form-control'>
@ -115,7 +115,7 @@ include 'Header.php';
<input type='file' name='attachment4' placeholder='Attachment 4' class='form-control'>
<br>
<input type='submit' class='btn btn-primary' value='Submit Lab Assignment'><br>
<input type='submit' class='btn btn-primary' value='Submit Lab Assignment' id="submit_lab_assignment_btn"><br>
</form>
</div>

View File

@ -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

View File

@ -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()

View File

@ -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

View File

@ -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):