diff --git a/tests/end2end/cypress/fixtures/images/overview/2154-to-3857.png b/tests/end2end/cypress/fixtures/images/overview/2154-to-3857.png deleted file mode 100644 index 869bac9d76..0000000000 Binary files a/tests/end2end/cypress/fixtures/images/overview/2154-to-3857.png and /dev/null differ diff --git a/tests/end2end/cypress/fixtures/images/overview/2154.png b/tests/end2end/cypress/fixtures/images/overview/2154.png deleted file mode 100644 index 57c859d8a6..0000000000 Binary files a/tests/end2end/cypress/fixtures/images/overview/2154.png and /dev/null differ diff --git a/tests/end2end/cypress/fixtures/images/overview/3857.png b/tests/end2end/cypress/fixtures/images/overview/3857.png deleted file mode 100644 index 503bcf5160..0000000000 Binary files a/tests/end2end/cypress/fixtures/images/overview/3857.png and /dev/null differ diff --git a/tests/end2end/cypress/fixtures/images/overview/4326-to-3857.png b/tests/end2end/cypress/fixtures/images/overview/4326-to-3857.png deleted file mode 100644 index 7c9335a8b3..0000000000 Binary files a/tests/end2end/cypress/fixtures/images/overview/4326-to-3857.png and /dev/null differ diff --git a/tests/end2end/cypress/fixtures/images/overview/4326.png b/tests/end2end/cypress/fixtures/images/overview/4326.png deleted file mode 100644 index 6cc08d994e..0000000000 Binary files a/tests/end2end/cypress/fixtures/images/overview/4326.png and /dev/null differ diff --git a/tests/end2end/cypress/integration/overview-ghaction.js b/tests/end2end/cypress/integration/overview-ghaction.js deleted file mode 100644 index c6159badf8..0000000000 --- a/tests/end2end/cypress/integration/overview-ghaction.js +++ /dev/null @@ -1,226 +0,0 @@ -import {arrayBufferToBase64} from '../support/function.js' - -describe('Overview', () => { - - it('3857', function () { - cy.intercept('*REQUEST=GetMap*LAYERS=Overview*', - { 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('getMapOverview') - - cy.visit('/index.php/view/map/?repository=testsrepository&project=overview-3857') - - cy.wait('@getMapOverview').should(({ request, response }) => { - const responseBodyAsBase64 = arrayBufferToBase64(response.body) - - cy.fixture('images/overview/3857.png').then((image) => { - // image encoded as base64 - expect(image, 'expect overview 3857').to.equal(responseBodyAsBase64) - }) - }) - }) - - it('4326', function () { - cy.intercept('*REQUEST=GetMap*LAYERS=Overview*', - { 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('getMapOverview') - - cy.visit('/index.php/view/map/?repository=testsrepository&project=overview-4326') - - cy.wait('@getMapOverview').should(({ request, response }) => { - const responseBodyAsBase64 = arrayBufferToBase64(response.body) - - cy.fixture('images/overview/4326.png').then((image) => { - // image encoded as base64 - expect(image, 'expect overview 4326').to.equal(responseBodyAsBase64) - }) - }) - }) - - it('2154', function () { - cy.intercept('*REQUEST=GetMap*LAYERS=Overview*', - { 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('getMapOverview') - - cy.visit('/index.php/view/map/?repository=testsrepository&project=overview-2154') - - cy.wait('@getMapOverview').should(({ request, response }) => { - const responseBodyAsBase64 = arrayBufferToBase64(response.body) - - cy.fixture('images/overview/2154.png').then((image) => { - // image encoded as base64 - expect(image, 'expect overview 2154').to.equal(responseBodyAsBase64) - }) - }) - }) - - it('4326 to 3857', function () { - cy.intercept('/index.php/lizmap/service/getProjectConfig*', - { middleware: true }, - (req) => { - delete req.headers['if-none-match'] - 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' - }) - req.continue((res) => { - //expect(res.body).to.include('options') - //res.body.options.ignStreets = 'True' - }) - req.on('response', (res) => { - expect(res).to.have.property('body') - expect(res.body).to.have.property('options') - res.body.options['ignStreets'] = 'True' - }) - }).as('getProjectConfig') - cy.intercept('*REQUEST=GetMap*LAYERS=Overview*', - { 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('getMapOverview') - - cy.visit('/index.php/view/map/?repository=testsrepository&project=overview-4326') - - cy.wait('@getMapOverview').should(({ request, response }) => { - const responseBodyAsBase64 = arrayBufferToBase64(response.body) - - cy.fixture('images/overview/4326-to-3857.png').then((image) => { - // image encoded as base64 - expect(image, 'expect overview 4326 to 3857').to.equal(responseBodyAsBase64) - }) - }) - }) - - it('2154 to 3857', function () { - cy.intercept('/index.php/lizmap/service/getProjectConfig*', - { middleware: true }, - (req) => { - delete req.headers['if-none-match'] - 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' - }) - req.continue((res) => { - //expect(res.body).to.include('options') - //res.body.options.ignStreets = 'True' - }) - req.on('response', (res) => { - expect(res).to.have.property('body') - expect(res.body).to.have.property('options') - res.body.options['ignStreets'] = 'True' - }) - }).as('getProjectConfig') - cy.intercept('*REQUEST=GetMap*LAYERS=Overview*', - { 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('getMapOverview') - - cy.visit('/index.php/view/map/?repository=testsrepository&project=overview-2154') - - cy.wait('@getMapOverview').should(({ request, response }) => { - const responseBodyAsBase64 = arrayBufferToBase64(response.body) - - cy.fixture('images/overview/2154-to-3857.png').then((image) => { - // image encoded as base64 - expect(image, 'expect overview 2154 to 3857').to.equal(responseBodyAsBase64) - }) - }) - }) - - it('3857 overview with no fixed scale', function () { - cy.intercept('/index.php/lizmap/service/getProjectConfig*', - { middleware: true }, - (req) => { - delete req.headers['if-none-match'] - 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' - }) - req.continue((res) => { - //expect(res.body).to.include('options') - //res.body.options.ignStreets = 'True' - }) - req.on('response', (res) => { - expect(res).to.have.property('body') - expect(res.body).to.have.property('options') - res.body.options['fixed_scale_overview_map'] = false - }) - }).as('getProjectConfig') - - cy.intercept('*REQUEST=GetMap*LAYERS=Overview*', - { 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('getMapOverview') - - cy.visit('/index.php/view/map/?repository=testsrepository&project=overview-3857') - - cy.wait('@getMapOverview').should(({ request, response }) => { - const responseBodyAsBase64 = arrayBufferToBase64(response.body) - - cy.fixture('images/overview/3857.png').then((image) => { - // image encoded as base64 - expect(image, 'expect overview 3857').not.to.equal(responseBodyAsBase64) - }) - }) - - // Zoom twice to get new overview map - cy.get('#navbar button.btn.zoom-in').click() - cy.get('#navbar button.btn.zoom-in').click() - - cy.wait('@getMapOverview').should(({ request, response }) => { - const responseBodyAsBase64 = arrayBufferToBase64(response.body) - - cy.fixture('images/overview/3857.png').then((image) => { - // image encoded as base64 - expect(image, 'expect overview 3857').not.to.equal(responseBodyAsBase64) - }) - }) - - // Zoom twice to get new overview map - cy.get('#navbar button.btn.zoom-in').click() - cy.get('#navbar button.btn.zoom-in').click() - - cy.wait('@getMapOverview').should(({ request, response }) => { - const responseBodyAsBase64 = arrayBufferToBase64(response.body) - - cy.fixture('images/overview/3857.png').then((image) => { - // image encoded as base64 - expect(image, 'expect overview 3857').not.to.equal(responseBodyAsBase64) - }) - }) - }) -}) diff --git a/tests/end2end/playwright/overview.spec.js b/tests/end2end/playwright/overview.spec.js new file mode 100644 index 0000000000..b5fded2301 --- /dev/null +++ b/tests/end2end/playwright/overview.spec.js @@ -0,0 +1,66 @@ +import { test, expect } from '@playwright/test'; + +test.describe('Overview', () => { + test('2154', async ({ page }) => { + const requestPromise = page.waitForRequest(/GetMap/); + + const url = '/index.php/view/map/?repository=testsrepository&project=overview-2154'; + await page.goto(url, { waitUntil: 'networkidle' }); + + const request = await requestPromise; + const requestUrl = request.url(); + expect(requestUrl).toContain('SERVICE=WMS'); + expect(requestUrl).toContain('VERSION=1.3.0'); + expect(requestUrl).toContain('REQUEST=GetMap'); + expect(requestUrl).toContain('FORMAT=image%2Fpng'); + expect(requestUrl).toContain('TRANSPARENT=true'); + expect(requestUrl).toContain('LAYERS=Overview'); + expect(requestUrl).toContain('CRS=EPSG%3A2154'); + expect(requestUrl).toContain('STYLES='); + expect(requestUrl).toContain('WIDTH=210'); + expect(requestUrl).toContain('HEIGHT=100'); + expect(requestUrl).toContain('BBOX=759560.3%2C6274207%2C781093.7%2C6284461'); + }); + + test('4326', async ({ page }) => { + const requestPromise = page.waitForRequest(/GetMap/); + + const url = '/index.php/view/map/?repository=testsrepository&project=overview-4326'; + await page.goto(url, { waitUntil: 'networkidle' }); + + const request = await requestPromise; + const requestUrl = request.url(); + expect(requestUrl).toContain('SERVICE=WMS'); + expect(requestUrl).toContain('VERSION=1.3.0'); + expect(requestUrl).toContain('REQUEST=GetMap'); + expect(requestUrl).toContain('FORMAT=image%2Fpng'); + expect(requestUrl).toContain('TRANSPARENT=true'); + expect(requestUrl).toContain('LAYERS=Overview'); + expect(requestUrl).toContain('CRS=EPSG%3A4326'); + expect(requestUrl).toContain('STYLES='); + expect(requestUrl).toContain('WIDTH=210'); + expect(requestUrl).toContain('HEIGHT=100'); + expect(requestUrl).toContain('BBOX=43.564042004675116%2C3.7752695519132518%2C43.655042490169876%2C3.9663705714522477'); + }); + + test('3857', async ({ page }) => { + const requestPromise = page.waitForRequest(/GetMap/); + + const url = '/index.php/view/map/?repository=testsrepository&project=overview-3857'; + await page.goto(url, { waitUntil: 'networkidle' }); + + const request = await requestPromise; + const requestUrl = request.url(); + expect(requestUrl).toContain('SERVICE=WMS'); + expect(requestUrl).toContain('VERSION=1.3.0'); + expect(requestUrl).toContain('REQUEST=GetMap'); + expect(requestUrl).toContain('FORMAT=image%2Fpng'); + expect(requestUrl).toContain('TRANSPARENT=true'); + expect(requestUrl).toContain('LAYERS=Overview'); + expect(requestUrl).toContain('CRS=EPSG%3A3857'); + expect(requestUrl).toContain('STYLES='); + expect(requestUrl).toContain('WIDTH=210'); + expect(requestUrl).toContain('HEIGHT=100'); + expect(requestUrl).toContain('BBOX=413555.54875348334%2C5396856.634710899%2C448992.51032356673%2C5413731.3783157'); + }); +}); diff --git a/tests/qgis-projects/tests/overview-4326.qgs.cfg b/tests/qgis-projects/tests/overview-4326.qgs.cfg index 21d4de2ddf..a06b4781dc 100644 --- a/tests/qgis-projects/tests/overview-4326.qgs.cfg +++ b/tests/qgis-projects/tests/overview-4326.qgs.cfg @@ -68,7 +68,7 @@ "link": "", "minScale": 1, "maxScale": 1000000000000, - "toggled": "True", + "toggled": "False", "popup": "False", "popupFrame": null, "popupSource": "auto",