Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions code/Project_2-master/app/Http/Controllers/LogController.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,6 @@ public function overall(Request $request)
'direction' => $direction
]);
}



public function login(Request $request)
{
$id = auth()->id();
Expand Down
9 changes: 1 addition & 8 deletions code/Project_2-master/app/Http/Middleware/ActivityLog.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,7 @@ private function getAction(Request $request)
return 'Login';
} elseif ($request->is('logout')) {
return 'Logout';
} elseif ($request->is('update-profile-info')) {
return 'Update Profile';
} elseif ($request->is('change-profile-picture')) {
return 'User Change Picture';
} elseif ($request->is('change-password')) {
return 'User Change Password';
}
else {
} else {
return 'User Activity'; // ค่า default
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
-->
<nav class=" navbar default-layout col-lg-12 col-12 p-0 fixed-top d-flex align-items-top flex-row">
<div class="text-center navbar-brand-wrapper d-flex align-items-center justify-content-start">

<div class="me-3">
<button class="navbar-toggler navbar-toggler align-self-center" type="button"
data-bs-toggle="minimize">
Expand Down Expand Up @@ -120,7 +120,7 @@ class="dropdown-item-icon mdi mdi-help-circle-outline text-primary me-2"></i>
class="dropdown-item-icon mdi mdi-power text-primary me-2"></i>Sign Out</a> --> --}}
<h2 class="ps-3">Logs System</h2>
<li class="nav-item d-none d-sm-inline-block ms-auto">

<a class="nav-link text-dark" href="{{ route('logout') }}" onclick="event.preventDefault();
document.getElementById('logout-form').submit();">
{{ __('Logout') }} <i class="mdi mdi-logout"></i>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,4 +110,4 @@ class="mb-2 border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:ou
<p class="text-center">No logs found.</p>
@endif
</div>
@endsection
@endsection
38 changes: 38 additions & 0 deletions test/code/UAT-Project-002.robot
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
*** Settings ***
Library SeleniumLibrary

*** Variables ***
${URL} http://127.0.0.1:8000
${BROWSER} Chrome
${LOGIN_URL} ${URL}/login
${INVALID_ADMIN} admin@gmail.com
${ERROR_MESSAGE} Login Failed: Your user ID or password is incorrect
${WAIT_TIME} 5s

*** Keywords ***
Open Browser To App
Open Browser ${URL} ${BROWSER}

Go To Login Page
Go To ${LOGIN_URL}

Enter Invalid Credentials
Input Text id=username ${INVALID_ADMIN}
Input Text id=password 123456789
Wait Until Element Is Visible xpath=//button[@type='submit'] ${WAIT_TIME}
Click Button xpath=//button[@type='submit']

Verify Login Error
Wait Until Element Is Visible xpath=//div[contains(@class, 'alert-danger')] ${WAIT_TIME}
Page Should Contain ${ERROR_MESSAGE}

Close Browser
Run Keyword If '${BROWSER}' == 'Chrome' Close All Browsers

*** Test Cases ***
Invalid Login Test
Open Browser To App
Go To Login Page
Enter Invalid Credentials
Verify Login Error
[Teardown] Close Browser
43 changes: 43 additions & 0 deletions test/code/UAT-Project-006.robot
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
*** Settings ***
Library SeleniumLibrary

*** Variables ***
${BROWSER} Chrome
${DELAY} 0.01
${VALID USER} admin@gmail.com
${VALID PASSWORD} 12345678
${LOGIN URL} http://127.0.0.1:8000/login
${WELCOME URL} http://127.0.0.1:8000/dashboard
${LOGS_SYSTEM_BUTTON} xpath=//span[@class='menu-title' and text()='Logs System']
${FILTER_BUTTON} xpath=//button[@type='submit' and text()='Filter']
${SELECTED_DATE} xpath=//input[@id='selected_date']

*** Test Cases ***
Show Login Page
Open Browser ${LOGIN URL} ${BROWSER}
Set Selenium Speed ${DELAY}

Input username and password
Input Text id=username ${VALID USER}
Input Text id=password ${VALID PASSWORD}
Click Element xpath=//button[text()='Log In']
Sleep 3s

Verify Login Success
Page Should Contain Research Information Management System

Logs System Button
Page Should Contain Element ${LOGS_SYSTEM_BUTTON}
Wait Until Element Is Visible ${LOGS_SYSTEM_BUTTON} 10s
Scroll Element Into View ${LOGS_SYSTEM_BUTTON}
Click Element ${LOGS_SYSTEM_BUTTON}
Wait Until Page Contains Logs System
Sleep 3s

Filter System Logs by Date
Wait Until Element Is Visible ${SELECTED_DATE} 10s
Input Text ${SELECTED_DATE} 2025-02-13
Sleep 2s
Click Button ${FILTER_BUTTON}
Sleep 2s
Wait Until Page Contains 2025-02-13 timeout=10s
Loading