* wip: redirect * redirect example * fix file upload not in a form * wip * deny missing cfgs * wip: add router fallback but it's not working * fix suspense bug after rebuilds that queued work * more cleanup * add test for error codes * add helpful comment * bring back middleware annotation * fix cfg * add server feature * fix doctest * just disable liveview test for now * fix liveview * dont send init * cache more playwright! * add more pkgs to cache
41 lines
1.3 KiB
JavaScript
41 lines
1.3 KiB
JavaScript
// @ts-check
|
|
const { test, expect } = require("@playwright/test");
|
|
|
|
test("errors", async ({ page }) => {
|
|
// Make sure going to home returns a 200
|
|
const res = await page.goto("http://localhost:8124");
|
|
if (!res) {
|
|
throw new Error("Failed to navigate to http://localhost:8124");
|
|
}
|
|
|
|
expect(res.status()).toBe(200);
|
|
|
|
// Go to /blog/1 which should also be okay
|
|
const blogRes = await page.goto("http://localhost:8124/blog/1");
|
|
if (!blogRes) {
|
|
throw new Error("Failed to navigate to http://localhost:8124/blog/1");
|
|
}
|
|
expect(blogRes.status()).toBe(200);
|
|
|
|
// Go to /blog/2 which should be a 201
|
|
const blogErrorRes = await page.goto("http://localhost:8124/blog/2");
|
|
if (!blogErrorRes) {
|
|
throw new Error("Failed to navigate to http://localhost:8124/blog/2");
|
|
}
|
|
expect(blogErrorRes.status()).toBe(201);
|
|
|
|
// Go to /blog/3 which should be a 500
|
|
const blogPanicRes = await page.goto("http://localhost:8124/blog/3");
|
|
if (!blogPanicRes) {
|
|
throw new Error("Failed to navigate to http://localhost:8124/blog/3");
|
|
}
|
|
expect(blogPanicRes.status()).toBe(500);
|
|
|
|
// Go to /blog/4 which should be a 404
|
|
const blogNotFoundRes = await page.goto("http://localhost:8124/blog/4");
|
|
if (!blogNotFoundRes) {
|
|
throw new Error("Failed to navigate to http://localhost:8124/blog/4");
|
|
}
|
|
expect(blogNotFoundRes.status()).toBe(404);
|
|
});
|