From 31981a3945a8ee4cca19d2a11911d8d8ee4f4d16 Mon Sep 17 00:00:00 2001 From: warinee341-6 Date: Wed, 12 Feb 2025 18:57:29 +0700 Subject: [PATCH 1/3] Revert "update log system" --- .../app/Http/Controllers/LogController.php | 3 --- .../views/logs/layout/logs-menu.blade.php | 12 +++++++++--- .../resources/views/logs/logs-login.blade.php | 16 ++++++++-------- .../resources/views/logs/logs-over-all.blade.php | 16 ++++++++-------- 4 files changed, 25 insertions(+), 22 deletions(-) diff --git a/code/Project_2-master/app/Http/Controllers/LogController.php b/code/Project_2-master/app/Http/Controllers/LogController.php index 1f26db1..2adb90f 100644 --- a/code/Project_2-master/app/Http/Controllers/LogController.php +++ b/code/Project_2-master/app/Http/Controllers/LogController.php @@ -125,9 +125,6 @@ public function overall(Request $request) 'direction' => $direction ]); } - - - public function login(Request $request) { $id = auth()->id(); diff --git a/code/Project_2-master/resources/views/logs/layout/logs-menu.blade.php b/code/Project_2-master/resources/views/logs/layout/logs-menu.blade.php index f5e2fbd..830cfec 100644 --- a/code/Project_2-master/resources/views/logs/layout/logs-menu.blade.php +++ b/code/Project_2-master/resources/views/logs/layout/logs-menu.blade.php @@ -51,7 +51,6 @@ --> diff --git a/code/Project_2-master/resources/views/logs/logs-login.blade.php b/code/Project_2-master/resources/views/logs/logs-login.blade.php index d5d5930..ae6e103 100644 --- a/code/Project_2-master/resources/views/logs/logs-login.blade.php +++ b/code/Project_2-master/resources/views/logs/logs-login.blade.php @@ -3,7 +3,7 @@ @section('content')
-

User Login Logs

+

User Login Logs

@@ -57,32 +57,32 @@ class="mb-2 border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:ou - + No - + User - + Action - + Description - + IP Address - + Date @@ -110,4 +110,4 @@ class="mb-2 border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:ou

No logs found.

@endif
-@endsection \ No newline at end of file +@endsection diff --git a/code/Project_2-master/resources/views/logs/logs-over-all.blade.php b/code/Project_2-master/resources/views/logs/logs-over-all.blade.php index aa3cd50..6ebea96 100644 --- a/code/Project_2-master/resources/views/logs/logs-over-all.blade.php +++ b/code/Project_2-master/resources/views/logs/logs-over-all.blade.php @@ -3,7 +3,7 @@ @section('content')
-

Over all

+

Overall

@@ -71,42 +71,42 @@ class="mb-2 border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:ou - No @if(request('sort') === 'id') @endif + No @if(request('sort') === 'id') {{ request('direction') === 'asc' ? '๐Ÿ”ผ' : '๐Ÿ”ฝ' }} @endif User - {{ request('sort') === 'user' ? '' : '' }} - + {{ request('sort') === 'user' ? (request('direction') === 'asc' ? '๐Ÿ”ผ' : '๐Ÿ”ฝ') : '๐Ÿ”ผ' }} Action - {{ request('sort') === 'action' ? '' : ''}} + {{ request('sort') === 'action' ? (request('direction') === 'asc' ? '๐Ÿ”ผ' : '๐Ÿ”ฝ') : '๐Ÿ”ผ' }} Description - {{ request('sort') === 'description' ? '' : '' }} + {{ request('sort') === 'description' ? (request('direction') === 'asc' ? '๐Ÿ”ผ' : '๐Ÿ”ฝ') : '๐Ÿ”ผ' }} IP Address - {{ request('sort') === 'ip_address' ? '' : ''}} + {{ request('sort') === 'ip_address' ? (request('direction') === 'asc' ? '๐Ÿ”ผ' : '๐Ÿ”ฝ') : '๐Ÿ”ผ' }} - Date {{ request('sort') === 'created_at' ? '' : ''}} + Created At + {{ request('sort') === 'created_at' ? (request('direction') === 'asc' ? '๐Ÿ”ผ' : '๐Ÿ”ฝ') : '๐Ÿ”ผ' }} From 9e0645d1a8dbabc13fd6e80f3fec1f1fd1f74f5d Mon Sep 17 00:00:00 2001 From: warinee341-6 Date: Wed, 12 Feb 2025 20:42:31 +0700 Subject: [PATCH 2/3] update log-menu --- .../app/Http/Middleware/ActivityLog.php | 9 +-------- .../views/logs/layout/logs-menu.blade.php | 12 +++--------- .../resources/views/logs/logs-login.blade.php | 14 +++++++------- .../resources/views/logs/logs-over-all.blade.php | 16 ++++++++-------- 4 files changed, 19 insertions(+), 32 deletions(-) diff --git a/code/Project_2-master/app/Http/Middleware/ActivityLog.php b/code/Project_2-master/app/Http/Middleware/ActivityLog.php index fdff6a6..e18cbce 100644 --- a/code/Project_2-master/app/Http/Middleware/ActivityLog.php +++ b/code/Project_2-master/app/Http/Middleware/ActivityLog.php @@ -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 } } diff --git a/code/Project_2-master/resources/views/logs/layout/logs-menu.blade.php b/code/Project_2-master/resources/views/logs/layout/logs-menu.blade.php index 830cfec..ca0e371 100644 --- a/code/Project_2-master/resources/views/logs/layout/logs-menu.blade.php +++ b/code/Project_2-master/resources/views/logs/layout/logs-menu.blade.php @@ -51,6 +51,7 @@ --> diff --git a/code/Project_2-master/resources/views/logs/logs-login.blade.php b/code/Project_2-master/resources/views/logs/logs-login.blade.php index ae6e103..d59771b 100644 --- a/code/Project_2-master/resources/views/logs/logs-login.blade.php +++ b/code/Project_2-master/resources/views/logs/logs-login.blade.php @@ -3,7 +3,7 @@ @section('content')
-

User Login Logs

+

User Login Logs

@@ -57,32 +57,32 @@ class="mb-2 border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:ou - + No - + User - + Action - + Description - + IP Address - + Date diff --git a/code/Project_2-master/resources/views/logs/logs-over-all.blade.php b/code/Project_2-master/resources/views/logs/logs-over-all.blade.php index 6ebea96..aa3cd50 100644 --- a/code/Project_2-master/resources/views/logs/logs-over-all.blade.php +++ b/code/Project_2-master/resources/views/logs/logs-over-all.blade.php @@ -3,7 +3,7 @@ @section('content')
-

Overall

+

Over all

@@ -71,42 +71,42 @@ class="mb-2 border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:ou - No @if(request('sort') === 'id') {{ request('direction') === 'asc' ? '๐Ÿ”ผ' : '๐Ÿ”ฝ' }} @endif + No @if(request('sort') === 'id') @endif User - {{ request('sort') === 'user' ? (request('direction') === 'asc' ? '๐Ÿ”ผ' : '๐Ÿ”ฝ') : '๐Ÿ”ผ' }} + {{ request('sort') === 'user' ? '' : '' }} + Action - {{ request('sort') === 'action' ? (request('direction') === 'asc' ? '๐Ÿ”ผ' : '๐Ÿ”ฝ') : '๐Ÿ”ผ' }} + {{ request('sort') === 'action' ? '' : ''}} Description - {{ request('sort') === 'description' ? (request('direction') === 'asc' ? '๐Ÿ”ผ' : '๐Ÿ”ฝ') : '๐Ÿ”ผ' }} + {{ request('sort') === 'description' ? '' : '' }} IP Address - {{ request('sort') === 'ip_address' ? (request('direction') === 'asc' ? '๐Ÿ”ผ' : '๐Ÿ”ฝ') : '๐Ÿ”ผ' }} + {{ request('sort') === 'ip_address' ? '' : ''}} - Created At - {{ request('sort') === 'created_at' ? (request('direction') === 'asc' ? '๐Ÿ”ผ' : '๐Ÿ”ฝ') : '๐Ÿ”ผ' }} + Date {{ request('sort') === 'created_at' ? '' : ''}} From 7c23826a7ea363eabf9797fbf33058d6963e2e9c Mon Sep 17 00:00:00 2001 From: warinee341-6 Date: Thu, 13 Feb 2025 04:38:42 +0700 Subject: [PATCH 3/3] commit Test UAT-Project-002 and UAT-Project-006 --- test/code/UAT-Project-002.robot | 38 + test/code/UAT-Project-006.robot | 43 + test/code/log.html | 2454 +++++++++++++++++++++++++++ test/code/output.xml | 146 ++ test/code/report.html | 2735 +++++++++++++++++++++++++++++++ 5 files changed, 5416 insertions(+) create mode 100644 test/code/UAT-Project-002.robot create mode 100644 test/code/UAT-Project-006.robot create mode 100644 test/code/log.html create mode 100644 test/code/output.xml create mode 100644 test/code/report.html diff --git a/test/code/UAT-Project-002.robot b/test/code/UAT-Project-002.robot new file mode 100644 index 0000000..0da7b15 --- /dev/null +++ b/test/code/UAT-Project-002.robot @@ -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 diff --git a/test/code/UAT-Project-006.robot b/test/code/UAT-Project-006.robot new file mode 100644 index 0000000..55df30e --- /dev/null +++ b/test/code/UAT-Project-006.robot @@ -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 diff --git a/test/code/log.html b/test/code/log.html new file mode 100644 index 0000000..9e0741c --- /dev/null +++ b/test/code/log.html @@ -0,0 +1,2454 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

Opening Robot Framework log failed

+
    +
  • Verify that you have JavaScript enabled in your browser.
  • +
  • Make sure you are using a modern enough browser. If using Internet Explorer, version 11 is required.
  • +
  • Check are there messages in your browser's JavaScript error log. Please report the problem if you suspect you have encountered a bug.
  • +
+
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/test/code/output.xml b/test/code/output.xml new file mode 100644 index 0000000..e8c9ba8 --- /dev/null +++ b/test/code/output.xml @@ -0,0 +1,146 @@ + + + + + +Opening browser 'Chrome' to base url 'http://127.0.0.1:8000/login'. +${LOGIN URL} +${BROWSER} +Opens a new browser instance to the optional ``url``. + + + +${DELAY} +Sets the delay that is waited after each Selenium command. + + + + + + +Typing text 'admin@gmail.com' into text field 'id=username'. +id=username +${VALID USER} +Types the given ``text`` into the text field identified by ``locator``. + + + +Typing text '12345678' into text field 'id=password'. +id=password +${VALID PASSWORD} +Types the given ``text`` into the text field identified by ``locator``. + + + +Clicking element 'xpath=//button[text()='Log In']'. +xpath=//button[text()='Log In'] +Click the element identified by ``locator``. + + + +Slept 3 seconds. +3s +Pauses the test executed for the given time. + + + + + + +Current page contains text 'Research Information Management System'. +Research Information Management System +Verifies that current page contains ``text``. + + + + + + +Current page contains element 'xpath=//span[@class='menu-title' and text()='Logs System']'. +${LOGS_SYSTEM_BUTTON} +Verifies that element ``locator`` is found on the current page. + + + +${LOGS_SYSTEM_BUTTON} +10s +Waits until the element ``locator`` is visible. + + + +${LOGS_SYSTEM_BUTTON} +Scrolls the element identified by ``locator`` into view. + + + +Clicking element 'xpath=//span[@class='menu-title' and text()='Logs System']'. +${LOGS_SYSTEM_BUTTON} +Click the element identified by ``locator``. + + + +Logs System +Waits until ``text`` appears on the current page. + + + +Slept 3 seconds. +3s +Pauses the test executed for the given time. + + + + + + +</td></tr><tr><td colspan="3"><a href="selenium-screenshot-1.png"><img src="selenium-screenshot-1.png" width="800px"></a> +Element 'xpath=//input[@id='selected_date']' not visible after 10 seconds. +${SELECTED_DATE} +10s +Waits until the element ``locator`` is visible. +Element 'xpath=//input[@id='selected_date']' not visible after 10 seconds. + + +${SELECTED_DATE} +2025-02-13 +Types the given ``text`` into the text field identified by ``locator``. + + + +2s +Pauses the test executed for the given time. + + + +${FILTER_BUTTON} +Clicks the button identified by ``locator``. + + + +2s +Pauses the test executed for the given time. + + + +2025-02-13 +timeout=10s +Waits until ``text`` appears on the current page. + + +Element 'xpath=//input[@id='selected_date']' not visible after 10 seconds. + + + + + +All Tests + + + + +UAT-Project-006 + + + + + diff --git a/test/code/report.html b/test/code/report.html new file mode 100644 index 0000000..279a206 --- /dev/null +++ b/test/code/report.html @@ -0,0 +1,2735 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

Opening Robot Framework report failed

+
    +
  • Verify that you have JavaScript enabled in your browser.
  • +
  • Make sure you are using a modern enough browser. If using Internet Explorer, version 11 is required.
  • +
  • Check are there messages in your browser's JavaScript error log. Please report the problem if you suspect you have encountered a bug.
  • +
+
+ +
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +