|
| 1 | +// @ts-check |
| 2 | +const { test, expect } = require('@playwright/test'); |
| 3 | +const { gotoMap } = require('./globals'); |
| 4 | + |
| 5 | +test.describe('Print in project projection', () => { |
| 6 | + |
| 7 | + test.beforeEach(async ({ page }) => { |
| 8 | + const url = '/index.php/view/map/?repository=testsrepository&project=print_in_project_projection'; |
| 9 | + await gotoMap(url, page); |
| 10 | + |
| 11 | + await page.locator('#button-print').click(); |
| 12 | + }); |
| 13 | + |
| 14 | + test('Print empty', async ({ page }) => { |
| 15 | + await page.locator('#switcher-baselayer').getByRole('combobox').selectOption('empty'); |
| 16 | + await page.locator('#print-scale').selectOption('1000'); |
| 17 | + page.once('request', request => { |
| 18 | + const postData = request.postData(); |
| 19 | + expect(postData).toContain('SERVICE=WMS') |
| 20 | + expect(postData).toContain('REQUEST=GetPrint') |
| 21 | + expect(postData).toContain('VERSION=1.3.0') |
| 22 | + expect(postData).toContain('FORMAT=pdf') |
| 23 | + expect(postData).toContain('TRANSPARENT=true') |
| 24 | + expect(postData).toContain('CRS=EPSG%3A3943') |
| 25 | + expect(postData).toContain('DPI=100') |
| 26 | + expect(postData).toContain('TEMPLATE=Paysage%20A4') |
| 27 | + expect(postData).toMatch(/map1%3AEXTENT=1697873.\d+%2C2216859.\d+%2C1698164.\d+%2C2217051.\d+/) |
| 28 | + expect(postData).toContain('map1%3ASCALE=1000') |
| 29 | + expect(postData).toContain('map1%3ALAYERS=reseau') |
| 30 | + expect(postData).toContain('map1%3ASTYLES=default') |
| 31 | + expect(postData).toContain('map1%3AOPACITIES=255') |
| 32 | + // Disabled because of the migration when project is saved with QGIS >= 3.32 |
| 33 | + // expect(postData).toContain('multiline_label=Multiline%20label'); |
| 34 | + }); |
| 35 | + await page.locator('#print-launch').click(); |
| 36 | + }) |
| 37 | + |
| 38 | + test('Print external baselayer', async ({ page }) => { |
| 39 | + await page.locator('#print-scale').selectOption('1000'); |
| 40 | + page.once('request', request => { |
| 41 | + const postData = request.postData(); |
| 42 | + expect(postData).toContain('SERVICE=WMS') |
| 43 | + expect(postData).toContain('REQUEST=GetPrint') |
| 44 | + expect(postData).toContain('VERSION=1.3.0') |
| 45 | + expect(postData).toContain('FORMAT=pdf') |
| 46 | + expect(postData).toContain('TRANSPARENT=true') |
| 47 | + expect(postData).toContain('CRS=EPSG%3A3943') |
| 48 | + expect(postData).toContain('DPI=100') |
| 49 | + expect(postData).toContain('TEMPLATE=Paysage%20A4') |
| 50 | + expect(postData).toMatch(/map1%3AEXTENT=1697873.\d+%2C2216859.\d+%2C1698164.\d+%2C2217051.\d+/) |
| 51 | + expect(postData).toContain('map1%3ASCALE=1000') |
| 52 | + expect(postData).toContain('map1%3ALAYERS=Photographies_aeriennes%2Creseau') |
| 53 | + expect(postData).toContain('map1%3ASTYLES=default%2Cdefault') |
| 54 | + expect(postData).toContain('map1%3AOPACITIES=255%2C255') |
| 55 | + // Disabled because of the migration when project is saved with QGIS >= 3.32 |
| 56 | + // expect(postData).toContain('multiline_label=Multiline%20label'); |
| 57 | + }); |
| 58 | + await page.locator('#print-launch').click(); |
| 59 | + }) |
| 60 | +}) |
0 commit comments