Skip to content

Commit

Permalink
update cypress test to match columns and check valued is purified
Browse files Browse the repository at this point in the history
  • Loading branch information
nworr committed May 6, 2024
1 parent 9b40baa commit 8dd4f1f
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions tests/end2end/cypress/integration/attribute_table-ghaction.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ describe('Attribute table', () => {
it('should have correct column order', () => {

const correct_column_order = ['', 'quartier', 'quartmno', 'libquart', 'photo', 'url'];

const shp_correct_column_order = ['', 'quartier', 'quartmno', 'libquart', 'photo', 'url', 'thumbnail'];
// postgreSQL layer
cy.get('button[value="Les_quartiers_a_Montpellier"].btn-open-attribute-layer').click({ force: true })

Expand Down Expand Up @@ -82,7 +82,7 @@ describe('Attribute table', () => {
const headers = [...theaders].map(t => t.innerText)

// Test arrays are deeply equal (eql) to test column order
expect(headers).to.eql(correct_column_order)
expect(headers).to.eql(shp_correct_column_order)
})
})

Expand Down Expand Up @@ -194,6 +194,12 @@ describe('Attribute table', () => {
expect(interception.response.body)
.to.have.property('features')
expect(interception.response.body.features).to.have.length(7)
// the virtual field exits
expect(interception.response.body.features[1].properties).to.have.property('thumbnail')
// the content of the field is ok
expect(interception.response.body.features[1].properties.thumbnail).to.contain('img class="data-attr-thumbnail"');
// the 'onload' value is here
expect(interception.response.body.features[1].properties.thumbnail).to.contain("BAD_CODE");
})
// Check that GetMap is requested without the filter token
cy.wait('@getMap').then((interception) => {
Expand All @@ -207,6 +213,10 @@ describe('Attribute table', () => {

// Check table lines
cy.get('#attribute-layer-table-Les_quartiers_a_Montpellier tbody tr').should('have.length', 7)
// the virtual field is here whith good attributes
cy.get('#attribute-layer-table-Les_quartiers_a_Montpellier tbody tr:nth-child(1) td:nth-child(7) img[data-src]').should ('exist')
// the onload attributes have disappeared
cy.get('#attribute-layer-table-Les_quartiers_a_Montpellier tbody tr:nth-child(1) td:nth-child(7) img[onload]').should('not.exist')

// select feature 2,4,6
// click to select 2
Expand Down

0 comments on commit 8dd4f1f

Please sign in to comment.