Humorloos / bouldern-app

1 stars 1 forks source link

Write e2e test for moving boulders #327

Closed Humorloos closed 2 years ago

Humorloos commented 2 years ago

Until now, I haven't been able to trigger the modify interaction from cypress. Closest I could get with https://github.com/cypress-io/cypress/issues/1624 was:

    cy.get('div.ol-viewport > div.ol-unselectable.ol-layers > .vector-layer > canvas')
        .trigger('pointerdown', {
          eventConstructor: 'PointerEvent',
          clientX: 50,
          clientY: 370,
          pointerId: 1,
          pointerType: 'touch',
          isPrimary: true,
          pressure: 1,
          composed: true,
          buttons: 1,
          isTrusted: true,
          width: 23,
        });

which also does not trigger the modify event though :(

jaure96 commented 1 year ago

Hi @Humorloos Did you manage to pan the map??

I'm trying with this code... but nothing. I'm usin OpenLayers 6.10.0

cy.fixture('maritimeObjects').then((maritimeObjects) => {
    cy.wait(1000)

    cy.get(maritimeObjects.mapCanvas)
      .trigger('pointerdown', {
        x: 50,
        y: 370,
        pointerType: 'touch',
        pointerId: 1,
      })
      .trigger('pointermove', {
        x: 300,
        y: 200,
        pointerType: 'touch',
        pointerId: 1,
      })
      .trigger('pointerup', {
        x: 300,
        y: 200,
        pointerType: 'touch',
        pointerId: 1,
      })
  }) 

The fixture mapCanvas is this selector: "mapCanvas": "div.ol-map-container div.ol-viewport div.ol-unselectable.ol-layers div.ol-layer canvas"