Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions e2e/basic.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,14 @@ test("file input", async ({ page }) => {
await testHtmlReport(page);
});

test("fetch error clears on drop recovery", async ({ page }) => {
await page.goto("/?url=http://localhost:1/test.zip");
await expect(page.getByTestId("fetch-error")).toContainText("likely blocked by CORS");
await page.locator('input[type="file"]').setInputFiles("docs/assets/vitest-html-reporter.zip");
await expect(page.getByTestId("fetch-error")).not.toBeVisible();
await testHtmlReport(page);
});

async function testHtmlReport(page: Page) {
await expect(page.getByTestId("status")).toContainText("Cached 7 files");
const frame = page.frameLocator("iframe");
Expand Down
6 changes: 5 additions & 1 deletion src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,10 @@
function FetchError({ error }) {
return h(
"div",
{ style: { textAlign: "center", fontSize: "0.85rem", color: "#c00", marginTop: "1rem" } },
{
"data-testid": "fetch-error",
style: { textAlign: "center", fontSize: "0.85rem", color: "#c00", marginTop: "1rem" },
},
h("div", null, error.message),
h(
"div",
Expand Down Expand Up @@ -238,6 +241,7 @@
}
setFileCount(count);
setStatusMsg(`Cached ${count} files. Loading...`);
setFetchError(null);
setLoaded(true);
}

Expand Down
Loading