Export queue with three concurrent jobs and pause/resume
A video editor renders finished clips in the background. The render server can only handle 3 exports at a time, and editors often want to pause a long export so a short one can finish first. Build the export queue: one progress bar per clip, at most three filling at once, and a Pause/Resume button on each running or paused job.
The starter code includes the limit and the jobs:
const MAX_CONCURRENT_EXPORTS = 3;
const EXPORTS = [
{ id: 'intro', name: 'Intro.mp4', durationMs: 2000 },
{ id: 'interview', name: 'Interview.mp4', durationMs: 4000 },
{ id: 'broll', name: 'B-roll.mp4', durationMs: 3000 },
{ id: 'outro', name: 'Outro.mp4', durationMs: 1000 },
{ id: 'credits', name: 'Credits.mp4', durationMs: 2000 },
];
EXPORTS order, and the first MAX_CONCURRENT_EXPORTS start right away.EXPORTS order, with its name, a progress bar (0% to 100%), and its status.durationMs (Interview.mp4 is 25% done after 1 second). It must not jump straight to 100%.MAX_CONCURRENT_EXPORTS jobs are Exporting. Whenever a slot is free and the line is not empty, the job at the front of the line starts immediately.Exporting: 3 · Queued: 2 · Paused: 0 · Done: 0. Any separator works between the four parts.No clicks:
0 s Intro, Interview, B-roll exporting; Outro, Credits queued
1 s Intro 50%, Interview 25%, B-roll 33%
2 s Intro done, Outro starts Exporting: 3 · Queued: 1 · Paused: 0 · Done: 1
3 s B-roll and Outro done, Credits starts Exporting: 2 · Queued: 0 · Paused: 0 · Done: 3
5 s everything done Done: 5
Pause Interview at 1 s (25%):
1 s Interview paused at 25%, Outro starts Exporting: 3 · Queued: 1 · Paused: 1 · Done: 0
2 s Intro and Outro done, Credits starts (Interview still 25%)
2.1 s Resume Interview: a slot is free, it continues from 25%
3.1 s Interview at 50%
Pause Intro at 0.5 s (25%), then Resume it right away:
0.5 s Outro took the free slot, so Intro waits Exporting: 3 · Queued: 2 · Paused: 0
line: Intro (resumed), Credits (never started)
1.5 s Outro done: Intro takes the slot, not Credits
Date.now() or performance.now()) on each tick keeps bars accurate.The tests click your buttons and read the screen like a user would. You don’t need test ids, specific class names, or an exact HTML structure. The tests replace the browser clock (setTimeout, setInterval, requestAnimationFrame, Date and performance.now) with a fake clock that they move forward by hand, so you can use any of those APIs. They check that:
EXPORTS order.<progress max="100"> element whose value is the percentage, or an element with role="progressbar" and an aria-valuenow from 0 to 100. Don’t render any other progress bars.aria-label of Pause {name} or Resume {name} (for example Pause Interview.mp4), and shows the text Pause or Resume. Buttons that don’t apply are removed or hidden.Exporting: N, Queued: N, Paused: N and Done: N with the right counts. The colon is optional.Capitalization and extra spacing don’t matter.