test: verify clean production bootstrap

This commit is contained in:
ik
2026-09-06 14:34:05 +07:00
parent 66fb1625da
commit 0f075469c8
9 changed files with 90 additions and 16 deletions
+2
View File
@@ -1,5 +1,7 @@
FROM node:22-alpine AS build
WORKDIR /app
ARG PUBLIC_API_URL=http://localhost:8000
ENV PUBLIC_API_URL=$PUBLIC_API_URL
COPY package*.json ./
RUN npm install
COPY . .
+2 -1
View File
@@ -9,7 +9,8 @@
"start": "node ./dist/server/entry.mjs",
"check": "astro check",
"test:unit": "node --test tests/unit/*.test.ts",
"test:e2e": "playwright test"
"test:e2e": "playwright test",
"test:bootstrap": "playwright test tests/production-bootstrap.spec.ts"
},
"dependencies": {
"@astrojs/check": "^0.9.10",
@@ -0,0 +1,23 @@
import { expect, test } from "@playwright/test";
test("production bootstrap supports submission and moderation", async ({ page, request }) => {
const player = `Bootstrap Player ${Date.now()}`;
const x = 7000 + Date.now() % 1000;
const y = x + 1;
await page.goto("/");
await expect(page.getByRole("heading", { name: "Выбирай место, пока клюёт." })).toBeVisible();
await page.goto("/report");
await page.getByLabel("Координата X *").fill(String(x));
await page.getByLabel("Координата Y *").fill(String(y));
await page.getByLabel("Вес, граммы *").fill("4321");
await page.getByLabel("Ник игрока").fill(player);
await page.getByRole("button", { name: "Отправить на проверку" }).click();
await expect(page.getByText("Улов отправлен на модерацию. Спасибо!")).toBeVisible();
const response = await request.get(`${process.env.BOOTSTRAP_API_URL}/api/v1/admin/catch-reports?status=pending`, {
headers: { Authorization: `Bearer ${process.env.BOOTSTRAP_ADMIN_TOKEN}` },
});
expect(response.ok()).toBeTruthy();
expect(await response.text()).toContain(player);
});