1
1
// @ts -check
2
2
import { test , expect } from '@playwright/test' ;
3
- import { gotoMap } from './globals' ;
3
+ import { gotoMap , getEchoRequestParams } from './globals' ;
4
4
5
5
test . describe ( 'Form filter' , ( ) => {
6
6
test . beforeEach ( async ( { page } ) => {
@@ -30,10 +30,8 @@ test.describe('Form filter', () => {
30
30
await expect ( page . locator ( countFeature ) ) . toHaveText ( '1' ) ;
31
31
32
32
let getMapRequest = await getMapPromise ;
33
- // Re-send the request with additionnal echo param to retrieve the WMS Request
34
- let echoGetMap = await page . request . get ( getMapRequest . url ( ) + '&__echo__' ) ;
35
- let originalUrl = decodeURIComponent ( await echoGetMap . text ( ) ) ;
36
- let urlObj = new URLSearchParams ( ( new URL ( originalUrl ) . search ) ) ;
33
+ // Re-send the request with additional echo param to retrieve the WMS Request search params
34
+ let urlObj = await getEchoRequestParams ( page , getMapRequest . url ( ) )
37
35
38
36
expect ( urlObj . get ( 'filter' ) ) . toBe ( 'form_filter_layer:"id" IN ( 2 ) ' ) ;
39
37
@@ -52,10 +50,8 @@ test.describe('Form filter', () => {
52
50
53
51
getMapRequest = await getMapPromise ;
54
52
55
- // Re-send the request with additionnal echo param to retrieve the WMS Request
56
- echoGetMap = await page . request . get ( getMapRequest . url ( ) + '&__echo__' ) ;
57
- originalUrl = decodeURIComponent ( await echoGetMap . text ( ) ) ;
58
- urlObj = new URLSearchParams ( ( new URL ( originalUrl ) . search ) ) ;
53
+ // Re-send the request with additional echo param to retrieve the WMS Request search params
54
+ urlObj = await getEchoRequestParams ( page , getMapRequest . url ( ) )
59
55
60
56
expect ( urlObj . get ( 'filter' ) ) . toBeNull ( ) ;
61
57
@@ -101,6 +97,5 @@ test.describe('Form filter', () => {
101
97
await page . locator ( '#liz-filter-field-textautocomplete' ) . fill ( 'mon' ) ;
102
98
await expect ( page . locator ( '#ui-id-2 .ui-menu-item' ) ) . toHaveCount ( 1 ) ;
103
99
await expect ( page . locator ( '#ui-id-2 .ui-menu-item div' ) ) . toHaveText ( 'monuments' ) ;
104
- } ) ;
100
+ } ) ;
105
101
} ) ;
106
-
0 commit comments