Skip to content

Commit

Permalink
Merge pull request #4639 from rldhont/tests-attribute-table-config
Browse files Browse the repository at this point in the history
Tests : Attribute Table config
  • Loading branch information
rldhont authored Jul 21, 2024
2 parents dd964c5 + 50ca969 commit 130aedd
Show file tree
Hide file tree
Showing 3 changed files with 539 additions and 523 deletions.
26 changes: 14 additions & 12 deletions tests/end2end/cypress/integration/attribute_table-ghaction.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,41 +45,42 @@ describe('Attribute table', () => {

it('should have correct column order', () => {

const 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 })
// shapefile layer
cy.get('button[value="quartiers_shp"].btn-open-attribute-layer').click({ force: true })

// Wait for features
cy.wait('@postGetFeature').then((interception) => {
expect(interception.request.body)
.to.contain('SERVICE=WFS')
.to.contain('REQUEST=GetFeature')
.to.contain('TYPENAME=quartiers')
.to.contain('TYPENAME=quartiers_shp')
.to.contain('OUTPUTFORMAT=GeoJSON')
})

cy.get('#attribute-layer-table-Les_quartiers_a_Montpellier_wrapper div.dataTables_scrollHead th').then(theaders => {
cy.get('#attribute-layer-table-quartiers_shp_wrapper div.dataTables_scrollHead th').then(theaders => {
const headers = [...theaders].map(t => t.innerText)
const correct_column_order = ['', 'quartmno', 'libquart', 'photo', 'url', 'thumbnail'];

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

// shapefile layer
cy.get('button[value="quartiers_shp"].btn-open-attribute-layer').click({ force: true })
// attribute table config
// postgreSQL layer
cy.get('button[value="Les_quartiers_a_Montpellier"].btn-open-attribute-layer').click({ force: true })

// Wait for features
cy.wait('@postGetFeature').then((interception) => {
expect(interception.request.body)
.to.contain('SERVICE=WFS')
.to.contain('REQUEST=GetFeature')
.to.contain('TYPENAME=quartiers_shp')
.to.contain('TYPENAME=quartiers')
.to.contain('OUTPUTFORMAT=GeoJSON')
})

cy.get('#attribute-layer-table-quartiers_shp_wrapper div.dataTables_scrollHead th').then(theaders => {
cy.get('#attribute-layer-table-Les_quartiers_a_Montpellier_wrapper div.dataTables_scrollHead th').then(theaders => {
const headers = [...theaders].map(t => t.innerText)
const correct_column_order = ['', 'quartier', 'quartmno', 'libquart', 'thumbnail', 'url', 'photo'];

// Test arrays are deeply equal (eql) to test column order
expect(headers).to.eql(correct_column_order)
Expand Down Expand Up @@ -213,10 +214,11 @@ describe('Attribute table', () => {

// Check table lines
cy.get('#attribute-layer-table-Les_quartiers_a_Montpellier tbody tr').should('have.length', 7)
// Attribute table config changes virtual field position form last one to 5th
// the virtual field is here with good attribute (data-src)
cy.get('#attribute-layer-table-Les_quartiers_a_Montpellier tbody tr:nth-child(1) td:nth-child(7) img[data-src]').should('exist')
cy.get('#attribute-layer-table-Les_quartiers_a_Montpellier tbody tr:nth-child(1) td:nth-child(5) img[data-src]').should('exist')
// the onload attribute 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')
cy.get('#attribute-layer-table-Les_quartiers_a_Montpellier tbody tr:nth-child(1) td:nth-child(5) img[onload]').should('not.exist')

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

1 comment on commit 130aedd

@3liz-bot
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The latest weekly run of end2end "playwright" tests failed with this latest commit on the branch release_3_6 😣

CC @nboisteault and @Gustry, please have a look to the logs. Maybe it's a false positive ?

Visit https://github.com/3liz/lizmap-web-client/actions/runs/10034075081

Please sign in to comment.