Page MenuHomeSealhub

add-list-route.test.ts
No OneTemporary

add-list-route.test.ts

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.test", () => {
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);
});

File Metadata

Mime Type
text/x-java
Expires
Fri, Jan 24, 15:15 (1 d, 15 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
596629
Default Alt Text
add-list-route.test.ts (1 KB)

Event Timeline