test(e2e): refactor 6 e2e suites with strict assertions, add mutation verification and update test coverage map

This commit is contained in:
parsa aghaei committed 2026-08-25 15:19:22 +03:30
1 parent 3c325c412c
commit 6ef293ea59
28 files changed
+20676 -16743

No files matched your search

+23 -14
View File
@@ -1,7 +1,7 @@
import { test, expect } from '../../fixtures';
test.describe('سناریوی مدیریت درخواست‌های B2B و فرم‌های تماس (Admin B2B Submissions Flow)', () => {
test('ورود به بخش B2B -> مشاهده درخواست‌ها -> فیلتر و بررسی جزئیات', async ({ page }) => {
test('ورود به بخش B2B -> راستی‌آزمایی حضور درخواست‌ها -> تعویض تب و فیلترها', async ({ page }) => {
// Intercept and mock Admin Auth & B2B API calls
await page.route('**/api/auth/admin-login*', async (route) => {
await route.fulfill({
@@ -42,7 +42,7 @@ test.describe('سناریوی مدیریت درخواست‌های B2B و فرم
});
});
await page.route('**/api/admin/b2b-applications*', async (route) => {
await page.route('**/api/b2b/inquiries*', async (route) => {
await route.fulfill({
status: 200,
contentType: 'application/json',
@@ -65,22 +65,31 @@ test.describe('سناریوی مدیریت درخواست‌های B2B و فرم
// 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');
// 2. ورود به صفحه مدیریت درخواست‌های B2B
const submitBtn = page.getByRole('button', { name: /ورود با رمز عبور|ورود به پنل|ورود/i }).first();
await submitBtn.click();
await page.waitForTimeout(500);
// 2. ورود به صفحه مدیریت B2B
await page.goto('/b2b', { waitUntil: 'domcontentloaded' });
await expect(page).toHaveURL(/\/b2b/);
// 3. بررسی ساختار لودینگ صفحه یا جدول اطلاعات
const b2bHeader = page.locator('h1, h2, h3, div').filter({ hasText: /درخواست|B2B|همکاری|کلینیک|پت‌شاپ/i }).first();
// 3. راستی‌آزمایی تیتر اختصاصی مدیریت B2B
const b2bHeader = page.locator('h2').filter({ hasText: 'مدیریت همکاران عمده‌فروشی و B2B' });
await expect(b2bHeader).toBeVisible({ timeout: 15000 });
// 4. راستی‌آزمایی تب‌های درخواست‌ها و همکاران
const partnerTab = page.getByRole('button', { name: /حساب‌های تاییدشده همکار/i });
await expect(partnerTab).toBeVisible();
await partnerTab.click();
const inquiriesTab = page.getByRole('button', { name: /درخواست‌های دریافت نمایندگی/i });
await expect(inquiriesTab).toBeVisible();
await inquiriesTab.click();
});
});