Skip to content

[e2e-tests] Add drag and drop tests for the upload feature - #4939

Open
jonathonherbert wants to merge 3 commits into
mainfrom
jsh/add-drag-and-drop-tests
Open

jonathonherbert wants to merge 3 commits into
mainfrom
jsh/add-drag-and-drop-tests

Conversation

@jonathonherbert

@jonathonherbert jonathonherbert commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

What does this change?

Adds e2e tests for the drag-and-drop functionality.

How should a reviewer test this change?

  • Read the specs. They should look fairly straightforward.
  • Do the folder changes make sense? I feel like aligning on a folder structure for steps across projects would be useful.

How can success be measured?

More test coverage for uploads.

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.
@jonathonherbert
jonathonherbert changed the base branch from main to jsh/add-upload-tests September 15, 2026 15:24
@jonathonherbert jonathonherbert added the feature Departmental tracking: work on a new feature label Sep 15, 2026
Base automatically changed from jsh/add-upload-tests to main September 16, 2026 09:49
An error occurred while trying to automatically change base from jsh/add-upload-tests to main September 16, 2026 09:49
@jonathonherbert jonathonherbert self-assigned this Sep 16, 2026
@github-actions

github-actions Bot commented Sep 17, 2026

Copy link
Copy Markdown

@jonathonherbert
jonathonherbert force-pushed the jsh/add-drag-and-drop-tests branch from a286b8b to 873e663 Compare September 18, 2026 13:54
@jonathonherbert
jonathonherbert force-pushed the jsh/add-drag-and-drop-tests branch from 873e663 to b86a1a5 Compare September 18, 2026 13:55
@jonathonherbert
jonathonherbert marked this pull request as ready for review September 21, 2026 09:33
@jonathonherbert
jonathonherbert requested a review from a team as a code owner September 21, 2026 09:33

@dominickendrick dominickendrick left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great !

@@ -1,4 +1,4 @@
import { When, Then, expect } from './fixtures.ts';
import { When, Then, expect } from '../setup.ts';

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 }) => {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature Departmental tracking: work on a new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants