import { afterEach, describe, expect, it } from "vitest"; import { mockAccount } from "../src/auth.ts"; import { createSessionToken } from "../src/session.ts"; import { cookieFrom, startApp, type TestApp } from "./helpers.ts"; const INVALID = "Неверный логин или пароль. Проверьте их и попробуйте ещё раз."; const EMPTY = "Вы не заполнили логин или пароль. Заполните оба поля и нажмите «Войти»."; let app: TestApp; afterEach(() => app?.close()); /** Значение поля «Логин» на странице. */ const loginFieldValue = (html: string) => /]* value="([^"]*)"/.exec(html)?.[1]; describe("Requirement: Страница входа", () => { it("Scenario: Страница входа открывается", async () => { app = await startApp(); const response = await app.get("/login"); const html = await response.text(); expect(response.status).toBe(200); expect(html).toContain("