Skip to content

Commit

Permalink
Merge pull request #5064 from 3liz/backport-5060-to-release_3_9
Browse files Browse the repository at this point in the history
[Backport release_3_9] Playwright - Fix some warnings about docstrings and parameters from the JavaScript IDE
  • Loading branch information
rldhont authored Dec 2, 2024
2 parents 75fc741 + 74b0542 commit 0766319
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions tests/end2end/playwright/globals.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// @ts-check
const { expect } = require('@playwright/test');
import { Page } from '@playwright/test';

async function NoErrors(page, checkLayerTreeView = true) {
// No error
Expand All @@ -14,13 +15,13 @@ async function NoErrors(page, checkLayerTreeView = true) {
/**
* CatchErrors function
* Some checks when the map is on error
* @param page The page object
* @param {Page} page The page object
* @param {int} layersInTreeView The number of layers to find in the treeview.
*/
async function CatchErrors(page, layersInTreeView = 0) {
// Error
await expect(page.locator('p.error-msg')).toHaveCount(1);
await expect(page.locator('#switcher lizmap-treeview ul li')).toHaveCount(layersInTreeView);
await expect(page.locator('#switcher .lizmap-treeview ul li')).toHaveCount(layersInTreeView);
// Error message displayed
await expect(page.getByText('An error occurred while loading this map. Some necessary resources may temporari')).toBeVisible();
// Go back home link
Expand All @@ -31,7 +32,7 @@ async function CatchErrors(page, layersInTreeView = 0) {
* gotoMap function
* Helper to load a map and do some basic checks
* @param {string} url The URL of the map to load
* @param {page} page The page object
* @param {Page} page The page object
* @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.
* @param {int} layersInTreeView The number of layers to find in the treeview if the map is on error.
* @param {boolean} waitForGetLegendGraphics
Expand Down Expand Up @@ -65,6 +66,12 @@ export async function gotoMap(url, page, mapMustLoad = true, layersInTreeView =
}
}

/**
* reloadMap function
* Helper to reload a map and do some basic checks
* @param {Page} page The page object
* @param {boolean} check If some basic checks must be done.
*/
export async function reloadMap(page, check = true) {
// TODO keep this function synchronized with the Cypress equivalent

Expand Down

0 comments on commit 0766319

Please sign in to comment.