From 8a0264baa4214a10d7559f0f472b93b608633731 Mon Sep 17 00:00:00 2001 From: Tarikuzuma <83963273+tarikuzuma@users.noreply.github.com> Date: Tue, 21 Oct 2025 01:20:06 +0800 Subject: [PATCH 1/4] tests:added test for 1-2 --- tests/2-TR-4-TC-1.js | 32 ++++++++++++++++++++++++++++++++ tests/2-TR-5-TC-2.js | 27 +++++++++++++++++++++++++++ 2 files changed, 59 insertions(+) create mode 100644 tests/2-TR-4-TC-1.js create mode 100644 tests/2-TR-5-TC-2.js diff --git a/tests/2-TR-4-TC-1.js b/tests/2-TR-4-TC-1.js new file mode 100644 index 0000000..0367717 --- /dev/null +++ b/tests/2-TR-4-TC-1.js @@ -0,0 +1,32 @@ +import { test, expect } from '@playwright/test'; + +test.describe('Admin Client Management', () => { + test('should log in as admin and add a new client', async ({ page }) => { + // Go to the login page + await page.goto('https://darkviolet-tarsier-894132.hostingersite.com/login.php'); + + // Login as admin + await page.getByRole('textbox', { name: /Email Address/i }).fill('admin@example.com'); + await page.getByRole('textbox', { name: /Password/i }).fill('password123'); + await page.getByRole('button', { name: /Login Now/i }).click(); + + // Expect to reach dashboard + await expect(page).toHaveURL(/dashboard/i); + + // Navigate to Clients -> Add Client + await page.getByRole('link', { name: /Clients/i }).click(); + await page.getByRole('link', { name: /Add Client/i }).click(); + + // Fill out client details + await page.getByLabel('Client Name').selectOption('225'); + await page.getByLabel('Assign to Lawyer').selectOption('2'); + await page.getByRole('textbox', { name: /Phone Number/i }).fill('09761144420'); + await page.getByRole('textbox', { name: /Address/i }).fill('Somewhere inside the Calipso'); + + // Save client + await page.getByRole('button', { name: /Save Client/i }).click(); + + // Verify success + await expect(page.locator('text=Client added successfully')).toBeVisible({ timeout: 5000 }); + }); +}); diff --git a/tests/2-TR-5-TC-2.js b/tests/2-TR-5-TC-2.js new file mode 100644 index 0000000..b532a46 --- /dev/null +++ b/tests/2-TR-5-TC-2.js @@ -0,0 +1,27 @@ +import { test, expect } from '@playwright/test'; + +test.describe('Admin Dashboard Navigation', () => { + test('should log in as admin and navigate to Clients page', async ({ page }) => { + // Go to login page + await page.goto('https://darkviolet-tarsier-894132.hostingersite.com/login.php'); + + // Fill in login form + await page.getByRole('textbox', { name: /Email Address/i }).fill('admin@example.com'); + await page.getByRole('textbox', { name: /Password/i }).fill('password123'); + + // Submit the form + await page.getByRole('button', { name: /Login Now/i }).click(); + + // Verify successful login + await expect(page).toHaveURL(/dashboard/i); + + // Navigate to Dashboard + await page.getByRole('link', { name: /Dashboard/i }).click(); + + // Navigate to Clients page + await page.getByRole('link', { name: /Clients/i }).click(); + + // Verify Clients page loaded + await expect(page).toHaveURL(/clients/i); + }); +}); From 8b04172f18c9e54753b1088ed9de7167b48adce0 Mon Sep 17 00:00:00 2001 From: Tarikuzuma <83963273+tarikuzuma@users.noreply.github.com> Date: Tue, 21 Oct 2025 01:24:57 +0800 Subject: [PATCH 2/4] test: added 2-TR-5-TC-4 more on deletion --- tests/2-TR-5-TC-4.js | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 tests/2-TR-5-TC-4.js diff --git a/tests/2-TR-5-TC-4.js b/tests/2-TR-5-TC-4.js new file mode 100644 index 0000000..4a86ab6 --- /dev/null +++ b/tests/2-TR-5-TC-4.js @@ -0,0 +1,32 @@ +import { test, expect } from '@playwright/test'; + +test.describe('Admin User Management', () => { + test('should log in and delete a user successfully', async ({ page }) => { + // Go to the login page + await page.goto('https://darkviolet-tarsier-894132.hostingersite.com/login.php'); + + // --- LOGIN --- + await page.getByRole('textbox', { name: /Email Address/i }).fill('admin@example.com'); + await page.getByRole('textbox', { name: /Password/i }).fill('password123'); + await page.getByRole('button', { name: /Login Now/i }).click(); + + // Verify redirect to dashboard + await expect(page).toHaveURL(/dashboard/i); + + // --- NAVIGATE TO USERS --- + await page.getByRole('link', { name: /Users/i }).click(); + await expect(page).toHaveURL(/users/i); + + // --- DELETE A USER --- + // Click the first action button for a user + await page.locator('.action-buttons').first().click(); + + // Confirm deletion + await page.getByRole('button', { name: /Delete User/i }).click(); + await page.getByRole('button', { name: /^OK$/i }).click(); + + // --- VERIFY USER IS DELETED --- + // Example: check for success message or absence of user name + await expect(page.locator('text=User deleted successfully')).toBeVisible({ timeout: 5000 }); + }); +}); From 3d777d7b7a8f7a64785c3d9416cda59cf4402655 Mon Sep 17 00:00:00 2001 From: Tarikuzuma <83963273+tarikuzuma@users.noreply.github.com> Date: Tue, 21 Oct 2025 01:27:56 +0800 Subject: [PATCH 3/4] test: added 2-tr-5-tc-3 more on editing --- tests/2-TR-5-TC-3.js | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 tests/2-TR-5-TC-3.js diff --git a/tests/2-TR-5-TC-3.js b/tests/2-TR-5-TC-3.js new file mode 100644 index 0000000..c49eff2 --- /dev/null +++ b/tests/2-TR-5-TC-3.js @@ -0,0 +1,34 @@ +import { test, expect } from '@playwright/test'; + +test.describe('Admin User Editing', () => { + test('should log in and update user information successfully', async ({ page }) => { + // --- LOGIN --- + await page.goto('https://darkviolet-tarsier-894132.hostingersite.com/login.php'); + await page.getByRole('textbox', { name: /Email Address/i }).fill('admin@example.com'); + await page.getByRole('textbox', { name: /Password/i }).fill('password123'); + await page.getByRole('button', { name: /Login Now/i }).click(); + + // Verify successful login + await expect(page).toHaveURL(/dashboard/i); + + // --- NAVIGATE TO USERS PAGE --- + await page.getByRole('link', { name: /Users/i }).click(); + await expect(page).toHaveURL(/users/i); + + // --- EDIT SPECIFIC USER --- + // Click the 3rd edit button (index 2) + await page.getByRole('button', { name: // }).nth(2).click(); + + // Update form fields + await page.locator('input[name="last_name"]').fill('Cheessezeronio'); + await page.locator('input[name="first_name"]').fill('Eddie_cheesecake'); + await page.getByRole('combobox').selectOption('partner'); + + // Save changes + await page.getByRole('button', { name: /Save Changes/i }).click(); + + // --- VERIFY SUCCESS --- + // Optional: update this to match your real success message + await expect(page.locator('text=User updated successfully')).toBeVisible({ timeout: 5000 }); + }); +}); From 304b8de56d2c67a98c5be779ec13960e08aece2c Mon Sep 17 00:00:00 2001 From: Tarikuzuma <83963273+tarikuzuma@users.noreply.github.com> Date: Tue, 21 Oct 2025 01:34:29 +0800 Subject: [PATCH 4/4] tes: added view --- tests/2-TR-5-TC-6.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 tests/2-TR-5-TC-6.js diff --git a/tests/2-TR-5-TC-6.js b/tests/2-TR-5-TC-6.js new file mode 100644 index 0000000..068fde3 --- /dev/null +++ b/tests/2-TR-5-TC-6.js @@ -0,0 +1,22 @@ +import { test, expect } from '@playwright/test'; + +test.describe('Lawyer Dashboard Navigation', () => { + test('should log in as lawyer and access the Clients page', async ({ page }) => { + // --- LOGIN --- + await page.goto('https://darkviolet-tarsier-894132.hostingersite.com/login.php'); + + await page.getByRole('textbox', { name: /Email Address/i }).fill('lawyer@example.com'); + await page.getByRole('textbox', { name: /Password/i }).fill('password123'); + await page.getByRole('button', { name: /Login Now/i }).click(); + + // Verify successful login + await expect(page).toHaveURL(/dashboard/i); + await expect(page.locator('span.badge-role')).toHaveText(/Lawyer/i); + + // --- NAVIGATE TO CLIENTS --- + await page.getByRole('link', { name: /Clients/i }).click(); + + // Verify Clients page loaded + await expect(page).toHaveURL(/clients/i); + }); +});