QA: unit tests for API logic, Playwright smoke tests, pre-push check, manual QA checklist

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-10-08 20:11:07 +03:30
co-authored by Cursor
parent e6755d0c2e
commit 46a7693ea0
17 changed files with 827 additions and 1 deletions
+27
View File
@@ -0,0 +1,27 @@
import { test as base, expect, type Page } from '@playwright/test';
type Problems = { list: string[] };
/** هر خطای جاوااسکریپت یا پاسخ 5xx از API در طول تست، تست را رد می‌کند */
export const test = base.extend<{ problems: Problems }>({
problems: [
async ({ page }, use) => {
const problems: Problems = { list: [] };
page.on('pageerror', (err) => problems.list.push(`JS error: ${err.message}`));
page.on('response', (res) => {
if (res.url().includes('/api/') && res.status() >= 500) {
problems.list.push(`API ${res.status()}: ${res.request().method()} ${res.url()}`);
}
});
await use(problems);
expect(problems.list, 'خطا در صفحه').toEqual([]);
},
{ auto: true },
],
});
export { expect };
export async function waitForIdle(page: Page) {
await page.waitForLoadState('networkidle', { timeout: 20_000 }).catch(() => undefined);
}