Migrate project to TypeScript and Playwright scraping
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
// @ts-nocheck
|
||||
import { test, expect } from "playwright/test";
|
||||
|
||||
test.describe("database connection", () => {
|
||||
test("tests the configured Local DB connection", async ({ page }) => {
|
||||
await page.goto("/");
|
||||
await page.locator("#settingsButton").click();
|
||||
|
||||
await expect(page.locator('input[name="databaseMode"][value="local"]')).toBeChecked();
|
||||
await page.locator("#localDbHost").fill("127.0.0.1");
|
||||
await page.locator("#localDbPort").fill("3306");
|
||||
await page.locator("#localDbName").fill("9bplus");
|
||||
await page.locator("#localDbUser").fill("root");
|
||||
await page.locator("#localDbPassword").fill("root");
|
||||
|
||||
await page.locator("#testLocalDbButton").click();
|
||||
await expect(page.locator("#localDbTestResult")).toContainText("Connected:");
|
||||
});
|
||||
|
||||
test("loads manufacturers from Local DB without Live endpoint fallback", async ({ page }) => {
|
||||
const manufacturersResponse = page.waitForResponse("**/api/manufacturers");
|
||||
await page.goto("/");
|
||||
|
||||
const response = await manufacturersResponse;
|
||||
expect(response.ok()).toBeTruthy();
|
||||
const data = await response.json();
|
||||
expect(data.items.length).toBeGreaterThan(0);
|
||||
expect(data.items.some((item) => item.name === "La Sportiva")).toBeTruthy();
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user