Unable to perform drag-and-drop into PDF Builder iframe #32194
Unanswered
eser-form-io
asked this question in
Questions and Help
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I am trying to automate a drag-and-drop action into the PDF builder, which uses an <iframe> to render the PDF editing area.
In my test, I:
Navigate to the PDF builder.
Get the iframe body using .contents().find('body').
Trigger dragstart on the "Text Field" component in the component panel.
Trigger dragover and drop on the drop zone inside the iframe (the PDF page container).
The problem:
The drop event inside the iframe does not actually add the component to the PDF page, even though the Cypress commands find the drop zone and successfully trigger events.
I have tried using a DataTransfer object and triggering dragstart, dragover, drop, and dragend in sequence, but Form.io does not register the drop.
The same manual drag-and-drop works fine when done by hand.
Here’s a simplified, reproducible snippet:
///
describe('drag and drop to the PDF form which has iframe structure', () => {
it('drag and drop the Text Field component', () => {
cy.navigateToProject('test')
})
What I’ve tried:
Using different plugins for drag and drop
Using { force: true } in all triggers.
Increasing waits to ensure iframe content is loaded.
Targeting different potential drop zone selectors inside the iframe.
Verifying that the element exists and is visible before triggering drop.
Attempting mousedown / mousemove / mouseup instead of drag events.
Using cross-origin-safe approaches with cy.origin() when running in remote environments.
What I’m struggling with:
Even though Cypress can see the element inside the iframe and trigger the events, the PDF Form builder does not respond to them as it would to a real browser drag-and-drop.
I suspect either Cypress’s synthetic drag events are not fully compatible with HTML5 drag handling, or events inside iframes require a special approach I’m missing.
Questions:
Is there an officially supported way in Cypress to perform HTML5 drag-and-drop inside an iframe?
Are there known limitations with trigger() events for drag/drop when dealing with nested iframe content?
Is there a recommended workaround for this case?
Beta Was this translation helpful? Give feedback.
All reactions