fix(test): актуализировать данные общей UX регрессии

This commit is contained in:
Denozordec committed 2026-10-04 03:55:30 +07:00
1 parent c4110fa323
commit 91c1194550
9 files changed
+1238 -15

No files matched your search

+9 -7
View File
@@ -1,6 +1,7 @@
import { test, expect, type Page } from "@playwright/test"
import { appUserReadSchema } from "../../packages/contracts/src/users"
import { certificatesListResponseSchema } from "../../packages/contracts/src/certificates"
import { certificatesStateSchema } from "../../packages/contracts/src/certificates"
import { certificateState, server } from "./fixtures/certificates"
import type { BackupItem } from "../../shared/api/backups"
const ids = Array.from({ length: 12 }, (_, i) => i + 1)
@@ -9,11 +10,12 @@ const users = ids.map(i => appUserReadSchema.parse({
role: "viewer", active: true, avatar: "U", lastSeen: null, sections: [], servers: [], bindings: [],
createdAt: "2026-09-14T00:00:00Z", updatedAt: "2026-09-14T00:00:00Z",
}))
const certificates = certificatesListResponseSchema.parse({ failures: [], certificates: ids.map(i => ({
id: String(i), name: `cert-${i}`, serverId: "1", commonName: `host${i}.example.test`,
sans: [`alt${i}.example.test`], issuedBy: "Test CA", validFrom: "2026-09-01", validUntil: "2027-09-01",
const certificates = certificatesStateSchema.parse(certificateState(ids.map(i => ({
id: `1:*${i}`, rosId: `*${i}`, name: `cert-${i}`, serverId: "1", commonName: `host${i}.example.test`,
sans: [`alt${i}.example.test`], issuedBy: "Test CA", validFrom: "2026-09-01T00:00:00Z", validUntil: "2027-09-01T00:00:00Z",
rawValidFrom: "2026-09-01", rawValidUntil: "2027-09-01",
daysLeft: 300 + i, keySize: 2048, usage: ["server"], trusted: true, status: "valid",
})) })
}))))
const backups: BackupItem[] = ids.map(i => ({ id: String(i), serverId: 1, serverName: "Тестовый роутер",
filename: `backup-${i}.backup`, sizeBytes: i === 12 ? 1048576 : i * 1024, createdAt: "2026-09-14T00:00:00Z", kind: i > 6 ? "auto" : "manual", storage: "local" }))
@@ -22,12 +24,12 @@ async function setup(page: Page, url: string) {
await page.route("**/api/**", route => {
const path = new URL(route.request().url()).pathname
return route.fulfill({ json: path === "/api/users" ? { users }
: path === "/api/certificates" ? certificates : path === "/api/backups" ? backups
: path === "/api/certificates/state" ? certificates : path === "/api/backups" ? backups
: path === "/api/certificates/acme-settings" ? { directoryUrl: "https://acme.example.test/directory", defaultZoneId: "", tokenConfigured: false }
: path === "/api/certificates/renew-settings" ? { enabled: false, intervalSec: 3600, renewBeforeDays: 30 }
: path === "/api/backups/schedule" ? { enabled: false, frequency: "daily", hour: 3, minute: 0, weekDay: 0, monthDay: 1, keepCount: 7, format: "backup", serverIds: [] }
: path === "/api/backups/storage" ? { provider: "local", s3Endpoint: "", s3Region: "", s3Bucket: "", s3Prefix: "", s3AccessKeyId: "", secretConfigured: false, s3ForcePathStyle: false, keepLocalCopy: true }
: path === "/api/auth/config" ? { required: false } : path === "/api/servers" ? [] : {} })
: path === "/api/auth/config" ? { required: false } : path === "/api/servers" ? [server] : {} })
})
await page.goto(url)
}