fix(test): актуализировать данные общей UX регрессии
This commit is contained in:
1 parent
c4110fa323
commit
91c1194550
9 files changed
+1238
-15
No files matched your search
@@ -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)
|
||||
}
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
import { test, expect } from "@playwright/test"
|
||||
import { mkdirSync } from "node:fs"
|
||||
import { evoSettings, evoCatalog } from "./fixtures/evobgp"
|
||||
import { parseEvoBgpCatalog } from "../../lib/evobgp-catalog"
|
||||
|
||||
const catalog = parseEvoBgpCatalog({ ...evoCatalog, communities: [{
|
||||
id: "blackhole", value: "65535:666", name: "RFC Blackhole", description: "RTBH",
|
||||
type: "standard", filterIds: [], serverCount: 2, prefixCount: null, action: "deny", enabled: true,
|
||||
}] })
|
||||
|
||||
for (const device of ["desktop", "mobile"] as const) {
|
||||
test(`Filters: клавиатурный ввод и layout ${device}`, async ({ page }) => {
|
||||
@@ -27,6 +34,8 @@ for (const device of ["desktop", "mobile"] as const) {
|
||||
return route.fulfill({ json: path === "/api/filters/rules" ? { rulesets: id ? rulesets.filter(rs => rs.serverId === id) : rulesets, greTunnels: [], live: true }
|
||||
: path === "/api/servers" ? [1, 2].map(i => ({ id: i, name: i === 1 ? "Основной роутер" : "Резервный роутер", host: "192.0.2." + i, type: "exit-node", enabled: true, country: "RU", site: "CORE", asn: "65001", status: "online", latency: 3 }))
|
||||
: path === "/api/filters/gre-tunnels" ? { tunnels: [tunnel(id ?? "1")] }
|
||||
: path === "/api/evobgp/settings" ? evoSettings
|
||||
: path === "/api/evobgp/catalog" ? catalog
|
||||
: path === "/api/recursive-routes" ? { routes: [], stale: false }
|
||||
: path === "/api/auth/config" ? { required: false } : {} })
|
||||
})
|
||||
@@ -53,6 +62,7 @@ for (const device of ["desktop", "mobile"] as const) {
|
||||
await expect(dialog.getByRole("alert")).toContainText("BGP Community обязательно")
|
||||
const community = dialog.getByRole("combobox", { name: /BGP Community/ })
|
||||
await community.fill("65535")
|
||||
await expect(page.getByRole("option", { name: /65535:666/ })).toBeVisible()
|
||||
await page.keyboard.press("ArrowDown")
|
||||
await page.keyboard.press("Enter")
|
||||
await expect(community).toHaveValue("65535:666")
|
||||
|
||||
Reference in new issue
Block a user