[e2e-tests] Add drag and drop tests for the upload feature - #4939
Open
jonathonherbert wants to merge 3 commits into
Open
jonathonherbert wants to merge 3 commits into
jonathonherbert wants to merge 3 commits into
Conversation
Adds the dropzone show/hide, drop-to-upload and ignore-a-Grid-image scenarios. dnd-uploader binds to window and decides what to do from dataTransfer.types, so Playwright's element-oriented drag helpers are no use: drag-and-drop.ts builds a DataTransfer in page context and dispatches the events by hand. The overlay is position: fixed, so the <dnd-uploader> wrapper has no box of its own and always reads as hidden; visibility is asserted against the overlay. Two scenarios stay @todo with the reason recorded against each. Dropping a URL needs somewhere container-reachable to host a fixture, because image-loader fetches the URL server-side. Dropping invalid content is unreachable: the drop handler only acts when dataTransfer carries a Files or uri-list type, so genuinely invalid content is ignored without an alert.
image-loader fetches the dropped URL itself, so it needs one reachable from inside the stack. Kahuna serves /assets unauthenticated and with a content-length, and the e2e image runs every service in one container, so localhost reaches it: /assets/images/blocked-cookies.png works as an import source without adding anything to the stack. The scenario only covers the drop being accepted and queued. The image really is ingested, but the job never reports completion, so there is nothing further to assert on yet; the reason is recorded against the scenario.
An error occurred while trying to automatically change base from
jsh/add-upload-tests
to
main
September 16, 2026 09:49
jonathonherbert
force-pushed
the
jsh/add-drag-and-drop-tests
branch
from
September 18, 2026 13:54
a286b8b to
873e663
Compare
jonathonherbert
force-pushed
the
jsh/add-drag-and-drop-tests
branch
from
September 18, 2026 13:55
873e663 to
b86a1a5
Compare
jonathonherbert
marked this pull request as ready for review
September 21, 2026 09:33
dominickendrick
approved these changes
Sep 21, 2026
| @@ -1,4 +1,4 @@ | |||
| import { When, Then, expect } from './fixtures.ts'; | |||
| import { When, Then, expect } from '../setup.ts'; | |||
There was a problem hiding this comment.
I think this new folder structure is great, it helps group similar features etc
| await dragOver(page, { files: filesToUpload }); | ||
| }); | ||
|
|
||
| Then('the dropzone overlay should appear with an explanation', async ({ page }) => { |
There was a problem hiding this comment.
I was going to say these might be a bit imperative, but I can't think of a better alternative ;) https://github.com/guardian/newsletters-nx/blob/main/docs/gherkin-style-guide.md#2-declarative-over-imperative
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this change?
Adds e2e tests for the drag-and-drop functionality.
How should a reviewer test this change?
How can success be measured?
More test coverage for uploads.