Skip to content

Commit

Permalink
[Tests] e2e: Add line and point intersects selection
Browse files Browse the repository at this point in the history
  • Loading branch information
rldhont committed Jul 24, 2023
1 parent 7d13ffc commit c64b771
Showing 1 changed file with 68 additions and 0 deletions.
68 changes: 68 additions & 0 deletions tests/end2end/cypress/integration/selectionTool-ghaction.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,74 @@ describe('Selection tool', function () {
})
})

it('selects features intersecting a line', function () {
cy.get('#button-selectiontool').click()

// Activate polygon tool
cy.get('#selectiontool .digitizing-buttons .dropdown-toggle').first().click()
cy.get('#selectiontool .digitizing-line').click()

// Select single layer and intersects geom operator
cy.get('lizmap-selection-tool .selectiontool-layer-list').select('selection_polygon')
cy.get('lizmap-selection-tool .selection-geom-operator').select('intersects')


// It should select two features
cy.get('#map')
.click(200, 350)
.dblclick(850, 350)

cy.get('.selectiontool-results').should(($div) => {
const text = $div.text()

expect(text).to.match(/^2/)
})

// It should not select any features
cy.get('#map')
.click(750, 350)
.dblclick(700, 400)

cy.get('.selectiontool-results').should(($div) => {
const text = $div.text()

expect(text).not.to.match(/^[0-9]/)
})
})

it('selects features intersecting a point', function () {
cy.get('#button-selectiontool').click()

// Activate polygon tool
cy.get('#selectiontool .digitizing-buttons .dropdown-toggle').first().click()
cy.get('#selectiontool .digitizing-point').click()

// Select single layer and intersects geom operator
cy.get('lizmap-selection-tool .selectiontool-layer-list').select('selection_polygon')
cy.get('lizmap-selection-tool .selection-geom-operator').select('intersects')


// It should select one feature
cy.get('#map')
.click(850, 350)

cy.get('.selectiontool-results').should(($div) => {
const text = $div.text()

expect(text).to.match(/^1/)
})

// It should not select any features
cy.get('#map')
.click(750, 350)

cy.get('.selectiontool-results').should(($div) => {
const text = $div.text()

expect(text).not.to.match(/^[0-9]/)
})
})

// TODO : tests other geom operators, unselection...
})

Expand Down

0 comments on commit c64b771

Please sign in to comment.