-
Notifications
You must be signed in to change notification settings - Fork 902
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Properly track preflighted uploads on the server (#3133)
* Properly track preflighted uploads on the server Fixes #3115. Relates to #3004. Partially fixes #2835. * add test for #2965, #3115
- Loading branch information
Showing
9 changed files
with
311 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
const { test, expect } = require("@playwright/test"); | ||
const { syncLV } = require("../../utils"); | ||
const { randomBytes } = require("crypto"); | ||
|
||
test("can upload files with custom chunk hook", async ({ page }) => { | ||
await page.goto("/issues/2965"); | ||
await syncLV(page); | ||
|
||
const files = []; | ||
for (let i = 1; i <= 20; i++) { | ||
files.push({ | ||
name: `file${i}.txt`, | ||
mimeType: "text/plain", | ||
// random 100 kb | ||
buffer: randomBytes(100 * 1024), | ||
}); | ||
} | ||
|
||
await page.locator("#fileinput").setInputFiles(files); | ||
await syncLV(page); | ||
|
||
// wait for uploads to finish | ||
for (let i = 0; i < 20; i++) { | ||
const row = page.locator(`tbody tr`).nth(i); | ||
await expect(row).toContainText(`file${i + 1}.txt`); | ||
await expect(row.locator("progress")).toHaveAttribute("value", "100"); | ||
} | ||
|
||
// all uploads are finished! | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.