Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Backport release_3_8] Playwright - Fix some warnings about docstrings and parameters from the JavaScript IDE #5063

Merged
merged 1 commit into from
Dec 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading