Compare commits

...

4 Commits

Author SHA1 Message Date
nartey 5639ce4c6b test script 2024-06-21 13:32:50 +08:00
nartey 8f3919d3bb TestScript 2024-06-21 13:16:11 +08:00
Nartey Sylvester Amanor 9f03d380cd Fix Bug486 2023-12-31 19:43:47 +08:00
Nartey Sylvester Amanor c1f95ce017 Bug Fix 486 2023-12-31 18:20:22 +08:00
9 changed files with 86 additions and 9 deletions

View File

@ -88,21 +88,21 @@ if( $_SESSION['user_type'] == "Student")
<ul class="nav nav-tabs" role="tablist">
<li class="nav-item">
<a class="nav-link active" data-toggle="tab" href="#menu1">New</a>
<a class="nav-link <?php if (!isset($_GET['tab']) || $_GET['tab'] == 'New') echo 'active'; ?>" data-toggle="tab" href="#menu1">New</a>
</li>
<li class="nav-item">
<a class="nav-link" data-toggle="tab" href="#menu2">Missed</a>
<a class="nav-link <?php if ($_GET['tab'] == 'Missed') echo 'active'; ?>" data-toggle="tab" href="#menu2">Missed</a>
</li>
<li class="nav-item">
<a class="nav-link" data-toggle="tab" href="#menu3">Submitted</a>
<a class="nav-link <?php if ($_GET['tab'] == 'Submitted') echo 'active'; ?>" 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 <?php if ($_GET['tab'] == 'Marked') echo 'active'; ?>" data-toggle="tab" href="#menu4">Marked</a>
</li>
</ul>
<div class="tab-content">
<div id="menu1" class="container tab-pane active"><br>
<div id="menu1" class="tab-pane <?php if (!isset($_GET['tab']) || $_GET['tab'] == 'New') echo 'active'; ?>">
<?php
@ -180,7 +180,7 @@ if( $_SESSION['user_type'] == "Student")
<div id="menu2" class="container tab-pane"><br>
<div id="menu2" class="tab-pane <?php if ($_GET['tab'] == 'Missed') echo 'active'; ?>">
<?php
$group_id=$_SESSION['group_id'];
@ -245,7 +245,7 @@ Lab_Report_ID not in (select Lab_Report_ID from lab_report_submissions where (St
<div id="menu3" class="container tab-pane"><br>
<div id="menu3" class="tab-pane <?php if ($_GET['tab'] == 'Submitted') echo 'active'; ?>">
<?php
@ -376,7 +376,7 @@ where Lab_Report_ID=$lab_repo_id and (lab_report_submissions.Student_id='$studen
<div id="menu4" class="container tab-pane"><br>
<div id="menu4" class="tab-pane <?php if ($_GET['tab'] == 'Marked') echo 'active'; ?>">
<?php
$resultx = mysqli_query($con,"SELECT `Submission_ID`, `Submission_Date`, lab_reports_table.`Lab_Report_ID`, `Student_id`, "
. "`Course_Group_id`, `Notes`, lab_report_submissions.`Marks`,

View File

@ -693,7 +693,7 @@ if (!empty($_GET["remarking"])) {
if ($con->query($sql) === TRUE) {
$_SESSION["info_general"] = "Remarking Request Sent";
header("Location: Course.php?url=" . $url);
header("Location: Course.php?url=" . $url . "&tab=Marked");
} else {
echo "Error: " . $sql . "<br>" . $con->error;
}

View File

@ -0,0 +1,77 @@
import pytest
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.common.exceptions import NoSuchElementException, TimeoutException
import time
import traceback
driver = webdriver.Chrome()
try:
# Navigate to the page with tabs
driver.get("http://localhost:8080/lrr/")
driver.maximize_window()
wait = WebDriverWait(driver, 10)
# Login as a Lecturer
username_input = wait.until(EC.presence_of_element_located((By.NAME, "user")))
password_input = driver.find_element(By.NAME, "password")
login_button = driver.find_element(By.ID, "login_btn")
username_input.send_keys("ashly@qq.com")
password_input.send_keys("admin123")
time.sleep(5)
login_button.click()
course_but= driver.find_element(By.XPATH, "(//div[@class='btn btn-default'])[1]") # Adjust this XPATH as needed
# Click on the alert
course_but.click()
time.sleep(5)
marked_tab = wait.until(
EC.element_to_be_clickable((By.XPATH, "//a[text()='Marked']"))
)
marked_tab.click()
# Wait for the Marked tab content to be present
marked_tab_content = wait.until(
EC.presence_of_element_located((By.XPATH, "//div[@id='menu4' and contains(@class, 'active')]"))
)
time.sleep(5)
remark_but = wait.until(
EC.presence_of_element_located((By.XPATH, "//button[normalize-space()='Request remarking']"))
)
remark_but.click()
time.sleep(2)
# Switch to the alert
alert = driver.switch_to.alert
# Send keys to the prompt
alert.send_keys("Number 2 was correct")
# Accept the prompt (click OK)
alert.accept()
time.sleep(5)
except NoSuchElementException as e:
print("NoSuchElementException: Could not find an element.")
traceback.print_exc()
except TimeoutException as e:
print("TimeoutException: An element took too long to load.")
traceback.print_exc()
except Exception as e:
print(f"An unexpected error occurred: {e}")
traceback.print_exc()
finally:
driver.quit()