search envelope-o feed check
Home Unanswered Active Tags New Question
user comment-o

Drag n drop using cypress for e2e tests

Asked by Yiannis
21 days ago.

I want to write e2e tests in cypress but I can't simulate the drag n drop function in daypilot. This is because the entire calendar is covered in a div that does not let the rest of the elements to be used.

I tried with {force:true} in cypress but nothing happens.

Answer posted by Dan Letecky [DayPilot]
21 days ago.

Cypress isn't particularly good at detecting the layers correctly and this error message ("trigger failed because this element is covered by another element") is often misleading. Adding {force: true} helps to overcome this.

Try this test - I guess you might be missing the "{button: 0}" param when trigerring the "mousedown" event.

/// <reference types="cypress" />

describe('event drag and drop test', () => {
  beforeEach(() => {

  it('moves event', () => {
    cy.window().then((win) => {
      var dp = win.dp;
        id: 123,
        text: "My Event",
        start: "2021-01-01",
        end: "2021-01-10",
        resource: "A",
        cssClass: "myevent"
      cy.get('.myevent').first().should('have.text', 'My Event');
      const ev = cy.get(".myevent").first();
      ev.trigger('mousemove', 15, 15);
      ev.trigger('mousedown', 15, 15, {button: 0});
      ev.trigger('mousemove', 440, 80, {force: true});


New Reply
This reply is
Your name (optional):