Update 2: test cases 05-07

SeleniumIbrahimUpdate-Ibrahim
Ibrahim 2021-11-29 02:19:37 +08:00
parent a64a4e1053
commit 6c6e60aac2
3 changed files with 29 additions and 30 deletions

View File

@ -190,7 +190,7 @@ New Date/Time <br><input type="date" name="date" required=""> <input type="time"
<h3> Post new Lab Assignment </a></h3> <h3> Post new Lab Assignment </a></h3>
<form method='post' enctype='multipart/form-data' action='Script.php'> <form method='post' enctype='multipart/form-data' action='Script.php' id="newlab_frm">
<?php <?php
$_SESSION['url'] = $url; $_SESSION['url'] = $url;
?> ?>
@ -205,11 +205,11 @@ New Date/Time <br><input type="date" name="date" required=""> <input type="time"
</div> </div>
Title Title
<input type='text' name='title' placeholder='Ttle' class='form-control' required='' value=""> <input type='text' name='title' placeholder='Ttle' class='form-control' required='' value="" id="lab_title">
Instructions Instructions
<textarea name='instructions' placeholder='Assignment Instructions' class='form-control' required='' value=""></textarea> <textarea name='instructions' placeholder='Assignment Instructions' class='form-control' required='' value="" id="lab_inst"></textarea>
Marks Marks
<input type='text' name='marks' placeholder='Marks' class='form-control' required='' value=""> <input type='text' name='marks' placeholder='Marks' class='form-control' required='' value="" id="lab_mark">
Attachment 1 Attachment 1
<input type='file' name='attachment1' placeholder='Attachment 1' class='form-control'> <input type='file' name='attachment1' placeholder='Attachment 1' class='form-control'>
@ -222,11 +222,11 @@ New Date/Time <br><input type="date" name="date" required=""> <input type="time"
Attachment 4 Attachment 4
<input type='file' name='attachment4' placeholder='Attachment 4' class='form-control'> <input type='file' name='attachment4' placeholder='Attachment 4' class='form-control'>
<br> <br>
Submission Type <input type='radio' name='type' value='Individual' required=''> Individual Submission Type <input type='radio' name='type' value='Individual' required='' id="lab_ind"> Individual
<input type='radio' name='type' value='Group' required=''> Group <input type='radio' name='type' value='Group' required='' id="lab_grp"> Group
<hr> <hr>
<input type='submit' class='btn btn-primary' value='Post Lab Assignment'><br> <input type='submit' class='btn btn-primary' value='Post Lab Assignment' id="submit_btn"><br>
</form><br><br><br><br> </form><br><br><br><br>
<?php <?php
} }
@ -431,28 +431,28 @@ WHERE Lecturer_User_ID=$lecturer_id and course_students_table.Status='Pending'"
<input type="hidden" name="frm_createCourse" value="true" required="" /> <input type="hidden" name="frm_createCourse" value="true" required="" />
<input type="hidden" name="l" value="l" required="" /> <input type="hidden" name="l" value="l" required="" />
Course Name Course Name
<input type="text" name="name" placeholder="Course Name" class="form-control" required=""> <input type="text" name="name" placeholder="Course Name" class="form-control" required="" id="cname">
Course Code Course Code
<input type="text" name="code" placeholder="Course Code" class="form-control" required=""> <input type="text" name="code" placeholder="Course Code" class="form-control" required="" id="ccode">
URL (Leave blank to use Course Code & Year) URL (Leave blank to use Course Code & Year)
<input type="text" name="url" placeholder="Choose Custom URL " class="form-control"> <input type="text" name="url" placeholder="Choose Custom URL " class="form-control">
Academic Year Academic Year
<input type="text" name="academic" placeholder="Academic Year" class="form-control" required=""> <input type="text" name="academic" placeholder="Academic Year" class="form-control" required="" id="ayear">
Faculty <br> Faculty <br>
<input type="text" name="faculty" placeholder="Faculty" class="form-control" required=""> <input type="text" name="faculty" placeholder="Faculty" class="form-control" required="" id="fac">
<input type="hidden" name="lecturer" value="<?php echo $_SESSION['user_id']; ?>"> <input type="hidden" name="lecturer" value="<?php echo $_SESSION['user_id']; ?>">
Verify Joining Students Verify Joining Students
<input type="radio" name="verify" value="1"> Yes <input type="radio" name="verify" value="1" id="jyes"> Yes
<input type="radio" name="verify" value="0" checked=""> No <input type="radio" name="verify" value="0" checked="" id="jno"> No
<br> <br>
<input type="submit" class="btn btn-primary" value="Create Portal"><br> <input type="submit" class="btn btn-primary" value="Create Portal" id="portal_btn"><br>
</form> </form>
@ -529,7 +529,7 @@ if ($_SESSION['user_type'] == "Student") {
} }
echo "<div class='btn btn-default' style='word-wrap:break-word'> echo "<div class='btn btn-default' style='word-wrap:break-word'>
[$code] $name <br>($url) <br> <a href='~\..\Script.php?JoinCourse=y&id=$id&std=$student_id&joining=$v' class='btn-sm btn-success' onclick=return confirm(\"Are you sure to join this course?\")' > $msg2 </a> [$code] $name <br>($url) <br> <a href='~\..\Script.php?JoinCourse=y&id=$id&std=$student_id&joining=$v' class='btn-sm btn-success' onclick=return confirm(\"Are you sure to join this course?\")' id='join_btn'> $msg2 </a>
<br> <span style='font-size:10pt'>Faculty: $faculty | Year: $academic | Lecturer: $lecturer </span><br>$msg</div> <br> <span style='font-size:10pt'>Faculty: $faculty | Year: $academic | Lecturer: $lecturer </span><br>$msg</div>
"; ";
} }
@ -578,7 +578,7 @@ INNER JOIN course_students_table on course_students_table.Course_ID=courses_tabl
<div class='row'> <div class='row'>
<div class='col-md-10'> <div class='col-md-10'>
<div class='row'><div class='col-md-6'> Find course by Code <div class='row'><div class='col-md-6'> Find course by Code
<input type='text' class='form-control' name='search' placeholder='Enter Course Code'> <input type='text' class='form-control' name='search' placeholder='Enter Course Code' id='search_field'>
</div><div class='col-md-6'> </div><div class='col-md-6'>
List courses by faculty List courses by faculty
@ -597,7 +597,7 @@ List courses by faculty
</div> </div>
<div class='col-md-1'> <br> <div class='col-md-1'> <br>
<input type='submit' class='btn btn-primary' value='Find'> <input type='submit' class='btn btn-primary' value='Find' id='find_btn'>
</div> </div>
</div> </div>

View File

@ -60,26 +60,25 @@ class Instructor(Actor):
#wait until the lab submission form shows up #wait until the lab submission form shows up
wait2 = WebDriverWait(driver, 10) 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. #Fill the required form fields and submit.
lab_date = new_lab_assignment_form.find_element(By.XPATH, "//input[@id='date'][@name='deadlinedate']") lab_date = new_lab_assignment_form.find_element(By.ID, "date")
timeStr = self.utility.getTodayDate() lab_date.send_keys(dateStr)
lab_date.send_keys(timeStr) lab_title = new_lab_assignment_form.find_element(By.ID, "lab_title")
lab_title = new_lab_assignment_form.find_element(By.XPATH, "//form[@id='nlaf']/input[@id='ltitle']")
lab_title.send_keys("TESTASSIGNMENT"+str(dateStr)) 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_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") lab_marks.send_keys("4")
#if group == 0 select individual submission, if group == 1 select group submission #if group == 0 select individual submission, if group == 1 select group submission
if group == 0: 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: 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() 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() submit.click()
return 0 return 0
except: except:

View File

@ -55,10 +55,10 @@ class Student(Actor):
#Wait until the course is found, and join. #Wait until the course is found, and join.
wait2 = WebDriverWait(driver, 10) wait2 = WebDriverWait(driver, 10)
course_card = wait.until(EC.element_to_be_clickable((By.LINK_TEXT, str("Join Course")))) join_btn = wait2.until(EC.element_to_be_clickable((By.ID, "join_btn")))
course_card.click() 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"))) wait3 = WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.XPATH, "/html/body/div[1]/div[1]/span")))
return 0 return 0