import { Page } from "playwright"; import { getBrowser } from "./utils/browser-creator.js"; import { RealAppTest } from "./test_utils/test-on-real-app.js"; import { collectionTemplate } from "./templates/collection.js"; import assert from "node:assert"; describe("single-reference", () => { let page: Page; before(async () => { const browser = await getBrowser(); const context = await browser.newContext(); page = await context.newPage(); }); after(async () => { await page.close(); }); it("creates an item list page with working partial string search for text fields", async function () { const test_app = await RealAppTest.init(); await test_app.addFile( "src/back/collections/articles.ts", collectionTemplate("articles", `title: new FieldTypes.Text(),`) ); await test_app.runSealgenCommand( `add-route --action=ListArticles --mode=list --url=/list-articles --collection=articles` ); await test_app.start(); await test_app.httpPOST(`/api/v1/collections/articles`, { title: "article ABC" }); await test_app.httpPOST(`/api/v1/collections/articles`, { title: "article DEF" }); await page.goto(test_app.fullURL(`list-articles/`)); await page.getByLabel("title").click(); await page.getByLabel("title").fill("ABC"); await page.getByLabel("title").press("Enter"); await page.getByRole("cell", { name: "article ABC" }).click(); const { response } = await test_app.httpGET(`/list-articles/?page=1&filter%5Btitle%5D=ABC`); assert(response.includes("article ABC")); assert(!response.includes("article DEF")); await test_app.close(); }).timeout(100 * 1000); });