Skip to content

Commit

Permalink
PB-878: Also test the zoom level
Browse files Browse the repository at this point in the history
  • Loading branch information
ismailsunni committed Sep 5, 2024
1 parent a6a0c07 commit 48d6f92
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions tests/cypress/tests-e2e/print.cy.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
/// <reference types="cypress" />
import { zoom } from 'chartjs-plugin-zoom'

import { getServiceKmlBaseUrl } from '@/config/baseUrl.config'
import { formatThousand } from '@/utils/numberUtils.js'

const printID = 'print-123456789'

function checkZoom(customZoom) {
cy.readStoreValue('state.position.zoom').should((zoom) => {
expect(zoom).to.equal(customZoom)
})
}

describe('Testing print', () => {
beforeEach(() => {
cy.viewport(1920, 1080)
Expand Down Expand Up @@ -175,7 +183,7 @@ describe('Testing print', () => {
})
})
context('Send print request with layers', () => {
function startPrintWithKml(kmlFixture, center, zoom) {
function startPrintWithKml(kmlFixture, zoom, center) {
interceptPrintRequest()
interceptPrintStatus()
interceptDownloadReport()
Expand Down Expand Up @@ -296,7 +304,9 @@ describe('Testing print', () => {
})
})
it('should send a print request correctly to mapfishprint (with KML layer)', () => {
startPrintWithKml('import-tool/external-kml-file.kml', 13)
const zoom = 13
startPrintWithKml('import-tool/external-kml-file.kml', zoom)
checkZoom(zoom)

cy.wait('@printRequest').then((interception) => {
expect(interception.request.body).to.haveOwnProperty('layout')
Expand Down Expand Up @@ -428,7 +438,9 @@ describe('Testing print', () => {
})
})
it('should send a print request correctly to mapfishprint (icon and label)', () => {
startPrintWithKml('print/label.kml', 13)
const customZoom = 13
startPrintWithKml('print/label.kml', customZoom)
checkZoom(customZoom)

cy.wait('@printRequest').then((interception) => {
expect(interception.request.body).to.haveOwnProperty('layout')
Expand Down Expand Up @@ -502,6 +514,8 @@ describe('Testing print', () => {
const customZoom = 13
startPrintWithKml('print/old-geoadmin-label.kml', customZoom)

checkZoom(customZoom)

cy.readStoreValue('getters.centerEpsg4326').should((center) => {
expect(center[0]).to.eq(8.161492)
expect(center[1]).to.eq(46.978042)
Expand All @@ -512,10 +526,6 @@ describe('Testing print', () => {
expect(center[1]).to.eq(1203250)
})

cy.readStoreValue('state.position.zoom').should((zoom) => {
expect(zoom).to.equal(customZoom)
})

cy.wait('@printRequest').then((interception) => {
expect(interception.request.body).to.haveOwnProperty('layout')
expect(interception.request.body['layout']).to.equal('1. A4 landscape')
Expand Down

0 comments on commit 48d6f92

Please sign in to comment.