Cypress test for Calender

I’m just playing with Cypress and I’m trying to select dates in the calender but it does’t work. Maybe there are some Cypress specialists?

Here is my code:
describe(‘Select dates in calender’, () => {
function loginAsAdmin () {
cy.get(’[data-testid=username]’).type(‘admin’)
cy.get(’[data-testid=password]’).type(‘password’)
cy.get(’[data-testid=submit]’).click()

}

it('visit admin report page', () => {
    cy.visit('http://localhost:8080/#/admin/report')
    loginAsAdmin ()
   cy.get(':nth-child(4) > .rbc-row-bg > :nth-child(2)')
       .trigger('mousedown')
       .trigger('mousemove', {pageX:300,pageY:500})
       .trigger('mouseup')

})

})

So I start thinking, that it doesnt work as the component may be not draggable… but maybe somebody has an idea, how to solve this?
I’ve tried different examples from the internet, including Cypress Drag and Drop plugin, but it didn’t help.

Thank you for any ideas :slight_smile:
Maria

1 Like

I’m interested to know too Maria! I am stuck at the dates.

are you not performing a mouse drag action instead of clicking twice?

Double click doesnt’t help in this calender :slight_smile: to choose a date a have to move the mouse with the button pressed from one date to another.

Did not know that :). Thought it was something like a datepicker :slight_smile:

Would something like Cypress’s trigger help?
Might be fiddly with knowing how many pixels to drag it, though.

Hi Beth, thank you for your reply!
I tried out almost all examples from the documentation incl. Drag and drop cypress plugin - no success.
Maybe I just missing something…