0

I am trying to automate form builder drag and drop feature but getting no success in it.

const dataTransfer = new DataTransfer();

cy.get(`div [ref="sidebar-container"] span[data-type="textfield"]`).trigger('formio.dragstart', {
    dataTransfer
  })

cy.get(`div[ref="form"]`).trigger('formio.drop', 
{ clientX: 200, clientY: 500 },
{ force: true }
); 

1 Answers1

0

Could you try this?

cy.get('.builder-components').then(($target) => {
  const coords = $target[0].getBoundingClientRect();
  cy.get('[data-type="textfield"]')
    .trigger('mousedown', { which: 1 })
    .trigger('mousemove', { clientX: coords.x, clientY: coords.y })
    .trigger('mouseup', { force: true });
});
Super Kai - Kazuya Ito
  • 22,221
  • 10
  • 124
  • 129
Kiruban
  • 1
  • 3
  • Your answer could be improved by adding more information on what the code does and how it helps the OP. – Tyler2P Jun 13 '23 at 10:40