Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

Designing reliable uploads for large datasets using Playwright

Описание и применение

Реализация теста chunked‑загрузки больших файлов в Playwright без загрузки всего файла в память, с контролем заголовков и использованием сессии браузера.

Задача

Enterprise UIs upload massive CSVs (5 GB+) by splitting them into 10 MB chunks, sending each chunk with X‑Chunk‑Index and X‑Total‑Chunks headers. Playwright’s page.setInputFiles streams the whole file and hides the HTTP traffic, making it impossible to test the chunked upload flow.

Результат

The approach allows testing of 5 GB uploads without loading the full file into RAM, gives full control over headers, and reuses the browser session for authentication.

Рабочий процесс

  • Navigate to upload page and capture auth cookies
  • Create an async generator that yields 10 MB buffers without persisting a file
  • Configure page.request with the captured cookies as extra HTTP headers
  • Iterate over the generator, sending each chunk with X‑Chunk‑Index and X‑Total‑Chunks headers
  • Assert each chunk response is OK
  • After all chunks, POST to the completion endpoint with fileName and totalChunks
  • Assert the completion response indicates SUCCESS

Доказательства

Can you test a 5 GB CSV upload without loading the whole file into memory?

Источник

Use page.request for low‑level HTTP when UI helpers fall short.

Источник

No full file in RAM – each chunk is generated on demand.

Источник

  • Дата записи: 2026-09-16T08:45:19.564Z