Skip to content
Open
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
32 changes: 32 additions & 0 deletions tests/2-TR-4-TC-1.js
Original file line number Diff line number Diff line change
@@ -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 });
});
});
27 changes: 27 additions & 0 deletions tests/2-TR-5-TC-2.js
Original file line number Diff line number Diff line change
@@ -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);
});
});
34 changes: 34 additions & 0 deletions tests/2-TR-5-TC-3.js
Original file line number Diff line number Diff line change
@@ -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 });
});
});
32 changes: 32 additions & 0 deletions tests/2-TR-5-TC-4.js
Original file line number Diff line number Diff line change
@@ -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 });
});
});
22 changes: 22 additions & 0 deletions tests/2-TR-5-TC-6.js
Original file line number Diff line number Diff line change
@@ -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);
});
});
Loading