test(e2e): refactor 6 e2e suites with strict assertions, add mutation verification and update test coverage map
This commit is contained in:
1 parent
3c325c412c
commit
6ef293ea59
28 files changed
+20676
-16743
No files matched your search
@@ -1,7 +1,7 @@
|
||||
import { test, expect } from '../../fixtures';
|
||||
|
||||
test.describe('سناریوی مدیریت سفارشات و تغییر وضعیت در پنل ادمین (Admin Orders Management)', () => {
|
||||
test('ورود به بخش سفارشات -> فیلتر وضعیت -> مشاهده جزئیات فاکتور', async ({ page }) => {
|
||||
test.describe('سناریوی مدیریت سفارشات و فیلترها در پنل ادمین (Admin Orders Management)', () => {
|
||||
test('ورود به بخش سفارشات -> راستیآزمایی رندر جدول فاکتورها -> فیلتر وضعیت و مشاهده جزییات', async ({ page }) => {
|
||||
// Intercept and mock Admin Auth & Orders API calls
|
||||
await page.route('**/api/auth/admin-login*', async (route) => {
|
||||
await route.fulfill({
|
||||
@@ -55,9 +55,9 @@ test.describe('سناریوی مدیریت سفارشات و تغییر وضعی
|
||||
customerName: 'علی رضایی',
|
||||
customerPhone: '09121112233',
|
||||
totalAmount: 1850000,
|
||||
status: 'PROCESSING',
|
||||
status: 'processing',
|
||||
createdAt: new Date().toISOString(),
|
||||
items: [{ id: 'item-1', productName: 'مکمل مفاصل سگ', quantity: 2, price: 925000 }],
|
||||
items: [{ id: 'item-1', name: 'مکمل مفاصل سگ', quantity: 2, priceValue: 925000 }],
|
||||
},
|
||||
],
|
||||
meta: { total: 1, lastPage: 1 },
|
||||
@@ -67,28 +67,28 @@ test.describe('سناریوی مدیریت سفارشات و تغییر وضعی
|
||||
|
||||
// 1. لاگین ادمین
|
||||
await page.goto('/login', { waitUntil: 'domcontentloaded' });
|
||||
const emailInput = page.locator('input[type="email"], input[placeholder*="ایمیل"]').first();
|
||||
const passwordInput = page.locator('input[type="password"], input[placeholder*="رمز"]').first();
|
||||
if (await emailInput.isVisible()) {
|
||||
await emailInput.fill('admin@canina.ir');
|
||||
await passwordInput.fill('Admin@123456');
|
||||
const submitBtn = page.getByRole('button', { name: /ورود به پنل|ورود/i }).first();
|
||||
await submitBtn.click();
|
||||
await page.waitForTimeout(500);
|
||||
}
|
||||
const emailInput = page.locator('input[type="email"]');
|
||||
const passwordInput = page.locator('input[type="password"]');
|
||||
await expect(emailInput).toBeVisible({ timeout: 10000 });
|
||||
await emailInput.fill('admin@canina.ir');
|
||||
await passwordInput.fill('Admin@123456');
|
||||
|
||||
const submitBtn = page.getByRole('button', { name: /ورود با رمز عبور|ورود به پنل|ورود/i }).first();
|
||||
await submitBtn.click();
|
||||
await page.waitForTimeout(500);
|
||||
|
||||
// 2. ورود به صفحه مدیریت سفارشات
|
||||
await page.goto('/orders', { waitUntil: 'domcontentloaded' });
|
||||
await expect(page).toHaveURL(/\/orders/);
|
||||
|
||||
// 3. بررسی تیتر صفحه و لیست سفارشات
|
||||
const ordersHeader = page.locator('h1, h2, div').filter({ hasText: /سفارشات|مدیریت سفارش/i }).first();
|
||||
await expect(ordersHeader).toBeVisible({ timeout: 15000 });
|
||||
// 3. راستیآزمایی دقیق تیتر مدیریت سفارشات
|
||||
const ordersHeading = page.locator('h2').filter({ hasText: 'مدیریت سفارشات' });
|
||||
await expect(ordersHeading).toBeVisible({ timeout: 15000 });
|
||||
|
||||
// 4. تست فیلترهای وضعیت سفارش (در حال پردازش، ارسال شده، تکمیل شده)
|
||||
const statusFilter = page.locator('select, button').filter({ hasText: /وضعیت|همه|پردازش/i }).first();
|
||||
if (await statusFilter.isVisible()) {
|
||||
await statusFilter.click();
|
||||
}
|
||||
// 4. راستیآزمایی دراپداون فیلتر وضعیت و انتخاب وضعیت جدید
|
||||
const statusSelect = page.locator('select').first();
|
||||
await expect(statusSelect).toBeVisible();
|
||||
await statusSelect.selectOption({ label: 'در حال پردازش' });
|
||||
await expect(page).toHaveURL(/status=/);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user