Skip to content

Commit 3778ab0

Browse files
hi-ogawaclaude
andcommitted
test: add e2e for fetch error recovery via drop
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent ff47db0 commit 3778ab0

2 files changed

Lines changed: 12 additions & 1 deletion

File tree

e2e/basic.spec.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,14 @@ test("file input", async ({ page }) => {
1414
await testHtmlReport(page);
1515
});
1616

17+
test("fetch error clears on drop recovery", async ({ page }) => {
18+
await page.goto("/?url=http://localhost:1/test.zip");
19+
await expect(page.getByTestId("fetch-error")).toContainText("likely blocked by CORS");
20+
await page.locator('input[type="file"]').setInputFiles("docs/assets/vitest-html-reporter.zip");
21+
await expect(page.getByTestId("fetch-error")).not.toBeVisible();
22+
await testHtmlReport(page);
23+
});
24+
1725
async function testHtmlReport(page: Page) {
1826
await expect(page.getByTestId("status")).toContainText("Cached 7 files");
1927
const frame = page.frameLocator("iframe");

src/index.html

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,10 @@
209209
function FetchError({ error }) {
210210
return h(
211211
"div",
212-
{ style: { textAlign: "center", fontSize: "0.85rem", color: "#c00", marginTop: "1rem" } },
212+
{
213+
"data-testid": "fetch-error",
214+
style: { textAlign: "center", fontSize: "0.85rem", color: "#c00", marginTop: "1rem" },
215+
},
213216
h("div", null, error.message),
214217
h(
215218
"div",

0 commit comments

Comments
 (0)