Skip to content

Commit

Permalink
Trying w/ bash
Browse files Browse the repository at this point in the history
  • Loading branch information
nboisteault committed Mar 25, 2022
1 parent ac5f09c commit 665a499
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/e2e_tests_cypress.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ jobs:
- name: Cypress run
uses: cypress-io/github-action@v2
with:
command: find cypress/integration/ -name '*.js' | parallel -j2 --group npx cypress run --spec {}
command: /bin/bash -c '/usr/bin/find cypress/integration/ -name '*.js' | parallel -j2 --group npx cypress run --spec {}'
working-directory: tests/end2end
spec: cypress/integration/*-ghaction.js
wait-on: http://localhost:8130
Expand Down
62 changes: 62 additions & 0 deletions tests/end2end/cypress/integration/external_wms_layer-ghaction.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
// # Test the respect of WMS external layer image format

// The QGIS project contains 3 layers:

// * **bakeries**: a SHP point layer in EPSG:4326
// * **IGN plan**
// * **Plan IGN v2 2154 jpeg**: a WMS layer from the French IGN organization, requested in `image/jpeg`
// * **Plan IGN v2 2154 png**: the same layer but requested in `image/png`.


// ## Procedure

// Load the map `external_wms_layer`,

// * [ ] open your browser developer panel with `CTRL+MAJ+i`,
// * [ ] activate the `Network` tab with the `Images` filter (to see the requested images in the log),
// * [ ] empty the log (search for a `bin` icon in the `Network` panel),
// * [ ] move the map to trigger a map refresh,
// * [ ] check the image requested for the active layer `bakeries` is in **PNG** format
// * [ ] check the image requested for the active layer `Plan IGN v2 2154 jpeg` is in **JPEG** format
// * [ ] activate the layer `Plan IGN v2 2154 png` in the legend
// * [ ] check the image requested for the active layer `Plan IGN v2 2154 png` is in **PNG** format

describe('External WMS layers', function () {

it('should get correct mime type in response', function () {
cy.visit('/index.php/view/map/?repository=testsrepository&project=external_wms_layer')

cy.intercept('*REQUEST=GetMap*',
{ middleware: true },
(req) => {
req.on('before:response', (res) => {
// force all API responses to not be cached
// It is needed when launching tests multiple time in headed mode
res.headers['cache-control'] = 'no-store'
})
}).as('getMap')

// Test bakeries layer
cy.wait(4000)
cy.get('#layer-bakeries button').click()

cy.wait('@getMap').then((interception) => {
expect(interception.response.headers['content-type'], 'expect mime type to be image/png').to.equal('image/png')
})

// Test Plan IGN v2 2154 jpeg
cy.get('#layer-Plan_IGN_v2_2154_jpeg button').click()

cy.wait('@getMap').then((interception) => {
expect(interception.response.headers['content-type'], 'expect mime type to be image/jpeg').to.equal('image/jpeg')
})

// Test Plan IGN v2 2154 png
cy.get('#layer-Plan_IGN_v2_2154_png button').click()

cy.wait('@getMap').then((interception) => {
expect(interception.response.headers['content-type'], 'expect mime type to be image/png').to.equal('image/png')
})

})
})

0 comments on commit 665a499

Please sign in to comment.