Page MenuHomeSealhub

form.test.ts
No OneTemporary

Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None

form.test.ts

import { Locator, Page } from "playwright";
import { expect } from "@playwright/test";
import { RealAppTest } from "../test_utils/test-on-real-app.js";
import { getBrowser } from "../utils/browser-creator.js";
describe("route form 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 minimal sealious app, adds route with form and fills it", async function () {
const test_app = await RealAppTest.init();
const path = "/form-test/";
await test_app.runSealgenCommand(`add-route --url=${path} --action=Sample --mode=form`);
await test_app.start();
const res = await test_app.httpGET(path);
if (res.status != 200) {
throw new Error("url generated by add-route exists but doesn't return 200");
}
await page.goto(test_app.fullURL(path));
const input: Locator = page.locator("#password");
await input.focus();
await input.fill("abc123");
await page.locator("[type=submit]").click();
await expect(page.locator("text=Formularz wypełniony poprawnie")).toBeVisible();
await test_app.close();
}).timeout(100 * 1000);
});

File Metadata

Mime Type
application/javascript
Expires
Fri, Nov 27, 17:57 (1 d, 12 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1199289
Default Alt Text
form.test.ts (1 KB)

Event Timeline