test: stabilize browser session setup and OpenAPI assertions
CI / Rust Checks (pull_request) Successful in 15m33s
CI / UI Checks (pull_request) Successful in 5s
CI / Community Image Smoke (pull_request) Successful in 6m28s
CI / Frontend E2E (pull_request) Successful in 7m27s
CI / Deploy (pull_request) Skipped

This commit is contained in:
bsodfather committed 2026-10-05 02:13:18 +03:00
1 parent ca32d3767f
commit eacfab0dd8
12 files changed
+459 -2

No files matched your search

+4
View File
@@ -15,6 +15,10 @@ async function login(page) {
await page.locator('.btn-signin').click();
await expect(page).toHaveURL(/\/$/);
await expect(page.locator('.page-title, .page-heading').first()).toBeVisible();
await page.waitForFunction(() => Boolean(window.CrankAuth && typeof window.CrankAuth.fetchSession === 'function'));
await page.evaluate(async () => {
await window.CrankAuth.fetchSession(false);
});
}
async function browserJson(page, method, urlPath, body, okStatuses = [200]) {
+19
View File
@@ -0,0 +1,19 @@
const { test, expect } = require('@playwright/test');
const { login } = require('./helpers');
test('login helper leaves a ready CSRF session under a delayed csrf refresh', async ({ page }) => {
let csrfRequests = 0;
await page.route('**/api/auth/session/csrf', async (route) => {
csrfRequests += 1;
await new Promise((resolve) => setTimeout(resolve, 800));
await route.continue();
});
await login(page);
const tokenReady = await page.evaluate(
() => Boolean(window.CrankAuth && typeof window.CrankAuth.getCsrfToken === 'function' && window.CrankAuth.getCsrfToken())
);
expect(tokenReady).toBe(true);
expect(csrfRequests).toBeGreaterThan(0);
});
+4 -1
View File
@@ -201,7 +201,10 @@ test('validation, upstream and compatibility errors recover from the last author
});
await page.goto('/');
await page.getByTestId('onboarding-trigger').click();
if (!await page.getByTestId('onboarding-checklist').isVisible()) {
await page.getByTestId('onboarding-trigger').click();
}
await expect(page.getByTestId('onboarding-checklist')).toBeVisible();
for (let index = 0; index < failures.length; index += 1) {
failureIndex = index;
await page.getByTestId('onboarding-refresh').click();
+1 -1
View File
@@ -112,7 +112,7 @@ paths:
await expect(importedOperation.locator('.openapi-import-mapping-preview')).toContainText('Header');
await expect(importedOperation.locator('.openapi-import-mapping-preview')).toContainText('X-API-Version');
await expect(importedOperation.locator('.openapi-import-mapping-preview')).toContainText('Body');
await expect(importedOperation.locator('.openapi-import-mapping-preview')).toContainText('symbols');
await expect(importedOperation.locator('.openapi-import-mapping-chip').filter({ hasText: /^body$/ })).toHaveCount(1);
await expect(importedOperation.locator('.openapi-import-mapping-preview')).toContainText(localized('Response', 'Ответ'));
await expect(page.locator('#openapi-import-selection')).toContainText(localized('Selected: 2', 'Выбрано: 2'));
await page.locator('#openapi-import-search').fill('status');