video.spec.ts:21 is flaky
>>> [!note] Migrated issue <!-- Drupal.org comment --> <!-- Migrated from issue #3591401. --> Reported by: [longwave](https://www.drupal.org/user/246492) Related to !1145 >>> ### Overview The Playwright test `Video Component › Can use a generic file widget to populate a video prop` (`tests/src/Playwright/tests/isolatedPerTest/video.spec.ts:21`) fails intermittently, more often on CI than locally. All retries fail on the same assertion — a 10s timeout waiting for the file widget's "Remove" button: ``` Error: expect(locator).toBeVisible() failed Locator: getByRole('button', { name: 'remove' }) Timeout: 10000ms — element(s) not found at Canvas.editComponentProp (objects/canvas/CanvasComponents.ts:283) at tests/src/Playwright/tests/isolatedPerTest/video.spec.ts:100 ``` Example pipeline: https://git.drupalcode.org/project/canvas/-/pipelines/825811/ The root cause is a race in the test helper, not the application. `Canvas.editComponentProp()` waits only for the managed-file `<input type="file">` to exist and be visible before calling `setInputFiles()`. The auto-upload AJAX is driven by Drupal core's `fileAutoUpload` behavior, which attaches the `change` → upload listener to the input and marks it `data-once="auto-file-upload"`. When the file is set before that behavior has attached, no upload request fires, so the "Remove" button never renders and the assertion times out. Because it depends on behavior-attach timing, it can fail on every retry on a slow runner. ### Proposed resolution In the `file` branch of `editComponentProp()`, wait for the file input to carry `data-once="auto-file-upload"` before calling `setInputFiles()`, so the upload only fires once Drupal has bound its change listener. This mirrors the existing `data-once="drupal-ajax"` guard already used in `CanvasMedia.addMediaImage()`. The fix is a deterministic synchronization on the behavior that makes the upload work, rather than a longer timeout. ### User interface changes None.
issue