1
1
// @ts -check
2
2
const { expect } = require ( '@playwright/test' ) ;
3
+ import { Page } from '@playwright/test' ;
3
4
4
5
async function NoErrors ( page , checkLayerTreeView = true ) {
5
6
// No error
@@ -14,13 +15,13 @@ async function NoErrors(page, checkLayerTreeView = true) {
14
15
/**
15
16
* CatchErrors function
16
17
* Some checks when the map is on error
17
- * @param page The page object
18
+ * @param { Page } page The page object
18
19
* @param {int } layersInTreeView The number of layers to find in the treeview.
19
20
*/
20
21
async function CatchErrors ( page , layersInTreeView = 0 ) {
21
22
// Error
22
23
await expect ( page . locator ( 'p.error-msg' ) ) . toHaveCount ( 1 ) ;
23
- await expect ( page . locator ( '#switcher lizmap-treeview ul li' ) ) . toHaveCount ( layersInTreeView ) ;
24
+ await expect ( page . locator ( '#switcher . lizmap-treeview ul li' ) ) . toHaveCount ( layersInTreeView ) ;
24
25
// Error message displayed
25
26
await expect ( page . getByText ( 'An error occurred while loading this map. Some necessary resources may temporari' ) ) . toBeVisible ( ) ;
26
27
// Go back home link
@@ -31,7 +32,7 @@ async function CatchErrors(page, layersInTreeView = 0) {
31
32
* gotoMap function
32
33
* Helper to load a map and do some basic checks
33
34
* @param {string } url The URL of the map to load
34
- * @param {page } page The page object
35
+ * @param {Page } page The page object
35
36
* @param {boolean } mapMustLoad If the loading of the map must be successful or not. Some error might be triggered when loading the map, on purpose.
36
37
* @param {int } layersInTreeView The number of layers to find in the treeview if the map is on error.
37
38
* @param {boolean } waitForGetLegendGraphics
@@ -65,6 +66,12 @@ export async function gotoMap(url, page, mapMustLoad = true, layersInTreeView =
65
66
}
66
67
}
67
68
69
+ /**
70
+ * reloadMap function
71
+ * Helper to reload a map and do some basic checks
72
+ * @param {Page } page The page object
73
+ * @param {boolean } check If some basic checks must be done.
74
+ */
68
75
export async function reloadMap ( page , check = true ) {
69
76
// TODO keep this function synchronized with the Cypress equivalent
70
77
0 commit comments