Compare commits
No commits in common. "6e41cb48cd009191436a5d1b3a986987a63709ac" and "6c663a00a54db37d1944bf97af4e8fc30557a07c" have entirely different histories.
6e41cb48cd
...
6c663a00a5
homepage
test
SeleniumHui
|
@ -151,6 +151,10 @@ echo "<div><a href='Courses.php?course=$url'> $header </a></div>";
|
||||||
$submitted_by = "$student_name ($submitter_student_number) for group $groupname ";
|
$submitted_by = "$student_name ($submitter_student_number) for group $groupname ";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$base_att1 = basename(rawurldecode($att1));
|
||||||
|
$base_att2 = basename(rawurldecode($att2));
|
||||||
|
$base_att3 = basename(rawurldecode($att3));
|
||||||
|
$base_att4 = basename(rawurldecode($att4));
|
||||||
$base_att1 = basename($att1);
|
$base_att1 = basename($att1);
|
||||||
$base_att2 = basename($att2);
|
$base_att2 = basename($att2);
|
||||||
$base_att3 = basename($att3);
|
$base_att3 = basename($att3);
|
||||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
|
@ -6,7 +6,10 @@ include 'NoDirectPhpAcess.php';
|
||||||
include 'Header.php';
|
include 'Header.php';
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
|
=======
|
||||||
|
|
||||||
|
>>>>>>> Initial commit for Bug197-Zayid: Add project files
|
||||||
<br><br><br>
|
<br><br><br>
|
||||||
|
|
||||||
<div class="container">
|
<div class="container">
|
||||||
|
|
|
@ -4,7 +4,6 @@ include 'NoDirectPhpAcess.php';
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
include 'Header.php';
|
include 'Header.php';
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<br><br><br>
|
<br><br><br>
|
||||||
|
|
|
@ -165,7 +165,6 @@ def test_student_with_valid_student_number_can_sign_up(driver, url, restore_data
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def test_student_with_invalid_student_number_cannot_sign_up(driver, url, restore_database):
|
def test_student_with_invalid_student_number_cannot_sign_up(driver, url, restore_database):
|
||||||
# Student with unrecognizable student number cannot sign up an account
|
# Student with unrecognizable student number cannot sign up an account
|
||||||
driver.get(url)
|
driver.get(url)
|
||||||
|
@ -207,7 +206,6 @@ def test_student_with_weak_password_cannot_sign_up(driver, url, restore_database
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def test_student_can_join_course(driver, url, restore_database):
|
def test_student_can_join_course(driver, url, restore_database):
|
||||||
# Student can join (CSC1111) - Project Management
|
# Student can join (CSC1111) - Project Management
|
||||||
login(driver, url, '201825800050', '123')
|
login(driver, url, '201825800050', '123')
|
||||||
|
|
|
@ -12,44 +12,29 @@ def restore_database():
|
||||||
Benefit: we can reproduce the same test result.
|
Benefit: we can reproduce the same test result.
|
||||||
'''
|
'''
|
||||||
|
|
||||||
PASSWORD = 'lrr@123' # root password
|
PASSWORD = 'p-@va9' # root password
|
||||||
DB_NAME = 'lrr' # database name used for LRR
|
DB_NAME = 'lrr' # database name used for LRR
|
||||||
HOST = 'localhost'
|
|
||||||
PORT = 3909 # XAMPP MySQL default port
|
|
||||||
SOCKET = '/Applications/XAMPP/xamppfiles/var/mysql/mysql.sock' # XAMPP MySQL socket (optional)
|
|
||||||
# commands used to import data to DB_NAME
|
# commands used to import data to DB_NAME
|
||||||
cmds = [
|
cmds = [
|
||||||
f'mysql -u root -p{PASSWORD} -h {HOST} -P {PORT} --socket={SOCKET} -e "DROP DATABASE IF EXISTS {DB_NAME};"',
|
f'mysql -u root -p{PASSWORD} -e "DROP DATABASE IF EXISTS {DB_NAME};"',
|
||||||
f'mysql -u root -p{PASSWORD} -h {HOST} -P {PORT} --socket={SOCKET} -e "CREATE DATABASE {DB_NAME};"',
|
f'mysql -u root -p{PASSWORD} -e "CREATE DATABASE {DB_NAME};"',
|
||||||
f'mysql -u root -p{PASSWORD} -h {HOST} -P {PORT} --socket={SOCKET} -e "CREATE USER IF NOT EXISTS \'lrr\'@\'localhost\' IDENTIFIED BY \'lrr@123\';"',
|
f'mysql -u root -p{PASSWORD} -e "GRANT ALL PRIVILEGES ON {DB_NAME}.* TO lrr@localhost WITH GRANT OPTION;"',
|
||||||
f'mysql -u root -p{PASSWORD} -h {HOST} -P {PORT} --socket={SOCKET} -e "GRANT ALL PRIVILEGES ON {DB_NAME}.* TO lrr@localhost WITH GRANT OPTION;"',
|
f'mysql -u root -p{PASSWORD} {DB_NAME} < ../lrr_database.sql']
|
||||||
f'mysql -u root -p{PASSWORD} -h {HOST} -P {PORT} --socket={SOCKET} {DB_NAME} < ../../lrr_database_hui.sql'
|
|
||||||
]
|
for command in cmds:
|
||||||
try:
|
os.system(command)
|
||||||
for command in cmds:
|
|
||||||
print(f"Executing command: {command}")
|
|
||||||
result = os.system(command)
|
|
||||||
if result != 0:
|
|
||||||
raise Exception(f"Command failed with exit code {result}: {command}")
|
|
||||||
print("Database restored successfully.")
|
|
||||||
except Exception as e:
|
|
||||||
print(f"An error occurred while restoring the database: {e}")
|
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def url():
|
def url():
|
||||||
# return 'http://localhost/LRR/' # URL of LRR
|
return 'http://localhost/LRR/' # URL of LRR
|
||||||
return 'http://localhost:8081/LRR-Hui-Organize/' # local URL of LRR-Hui-Organize
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def driver():
|
def driver():
|
||||||
# Use the locally downloaded ChromeDriver
|
return webdriver.Chrome()
|
||||||
chrome_driver_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '../../chromedriver-mac-x64 2/chromedriver'))
|
|
||||||
print(f"Using ChromeDriver at: {chrome_driver_path}")
|
|
||||||
driver = webdriver.Chrome(executable_path=chrome_driver_path)
|
|
||||||
return driver
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
|
|
Loading…
Reference in New Issue