Files
spark-store/e2e/basic.spec.ts
vmomenv 6cbcf6fae3 test: fix playwright e2e connection refused error
The e2e test was hardcoded to navigate to `http://127.0.0.1:3344` instead
of using the configured `baseURL` in `playwright.config.ts` which points
to the Vite dev server (`http://localhost:5173`). This caused tests to
fail with `net::ERR_CONNECTION_REFUSED`.

This commit replaces the hardcoded URL with `/` so that Playwright
correctly uses the `baseURL` setting. It also updates the title assertion
to include "星火应用商店".
2026-03-12 07:06:28 +00:00

28 lines
848 B
TypeScript

import { test, expect } from "@playwright/test";
test.describe("应用基本功能", () => {
test.beforeEach(async ({ page }) => {
await page.goto("/");
});
test("页面应该正常加载", async ({ page }) => {
await expect(page).toHaveTitle(/星火应用商店|APM 应用商店|Spark Store/);
});
test("应该显示应用列表", async ({ page }) => {
await page.waitForSelector(".app-card", { timeout: 10000 });
const appCards = page.locator(".app-card");
await expect(appCards.first()).toBeVisible();
});
test("搜索功能应该工作", async ({ page }) => {
const searchInput = page.locator('input[placeholder*="搜索"]').first();
await expect(searchInput).toBeVisible();
await searchInput.fill("test");
await searchInput.press("Enter");
await page.waitForTimeout(1000);
});
});