Skip to content

Commit

Permalink
PB-878: Address PR review.
Browse files Browse the repository at this point in the history
  • Loading branch information
ismailsunni committed Jan 6, 2025
1 parent 934ba75 commit 3162009
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 12 deletions.
3 changes: 1 addition & 2 deletions src/api/print.api.js
Original file line number Diff line number Diff line change
Expand Up @@ -361,8 +361,7 @@ async function transformOlMapToPrintParams(olMap, config) {
if (!dpi) {
throw new PrintError('Missing DPI for printing')
}
const printExtent = store.state.print.printExtent
const customizer = new GeoAdminCustomizer(printExtent, excludedLayerIDs, dpi)
const customizer = new GeoAdminCustomizer(store.state.print.printExtent, excludedLayerIDs, dpi)

const attributionsOneLine = attributions.length > 0 ? ${attributions.join(', ')}` : ''

Expand Down
28 changes: 18 additions & 10 deletions tests/cypress/tests-e2e/print.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ describe('Testing print', () => {
})
})
context('Send print request with layers', () => {
function startPrintWithKml(kmlFixture, zoom, center) {
function startPrintWithKml(kmlFixture, zoom = 9, center = '2655000,1203250') {
interceptPrintRequest()
interceptPrintStatus()
interceptDownloadReport()
Expand All @@ -191,8 +191,8 @@ describe('Testing print', () => {
cy.goToMapView(
{
layers: `KML|${kmlID}`,
z: zoom || 9,
center: center || '2655000,1203250',
z: zoom,
center: center,
},
true
)
Expand Down Expand Up @@ -303,7 +303,7 @@ describe('Testing print', () => {
expect(layers[0]['matrices'][0]['matrixSize']).to.deep.eq([1, 1])
})
})
it.skip('should send a print request correctly to mapfishprint (with KML layer)', () => {
it('should send a print request correctly to mapfishprint (with KML layer)', () => {
const customZoom = 13
const kmlID = startPrintWithKml('import-tool/external-kml-file.kml', customZoom)
checkZoom(customZoom)
Expand Down Expand Up @@ -360,7 +360,7 @@ describe('Testing print', () => {
cy.get('[data-cy="import-file-online-content"]').should('be.visible')

const localKmlFileName = 'external-kml-file.kml'
const localKmlFile = `tests/cypress/fixtures/import-tool/${localKmlFileName}`
const localKmlFile = `/import-tool/${localKmlFileName}`

// Test local import
cy.log('Switch to local import')
Expand All @@ -369,8 +369,12 @@ describe('Testing print', () => {

// Attach a local KML file
cy.log('Test add a local KML file')
cy.readFile(localKmlFile, null).as('kmlFixture')
cy.get('[data-cy="file-input"]').selectFile('@kmlFixture', {
cy.fixture(localKmlFile).as('kmlFile')
cy.get('[data-cy="file-input"]').selectFile(
{ contents: '@kmlFile', fileName: localKmlFile },
{ force: true }
)
cy.get('[data-cy="file-input"]').selectFile('@kmlFile', {
force: true,
})
cy.get('[data-cy="import-file-load-button"]:visible').click()
Expand Down Expand Up @@ -449,7 +453,7 @@ describe('Testing print', () => {
cy.get('[data-cy="import-file-content"]').should('be.visible')
cy.get('[data-cy="import-file-online-content"]').should('be.visible')

const localGpxlFile = 'tests/cypress/fixtures/print/line-and-marker.gpx'
const localGpxFile = '/print/line-and-marker.gpx'

// Test local import
cy.log('Switch to local import')
Expand All @@ -458,8 +462,12 @@ describe('Testing print', () => {

// Attach a local GPX file
cy.log('Test add a local GPX file')
cy.readFile(localGpxlFile, null).as('gpxFixture')
cy.get('[data-cy="file-input"]').selectFile('@gpxFixture', {
cy.fixture(localGpxFile).as('gpxFile')
cy.get('[data-cy="file-input"]').selectFile(
{ contents: '@gpxFile', fileName: localGpxFile },
{ force: true }
)
cy.get('[data-cy="file-input"]').selectFile('@gpxFile', {
force: true,
})
cy.get('[data-cy="import-file-load-button"]:visible').click()
Expand Down

0 comments on commit 3162009

Please sign in to comment.