Skip to content

Commit

Permalink
Tests e2e playwright: replace require par import ... from
Browse files Browse the repository at this point in the history
To homogenize tests e2e playwright `require` is replaced by `import ... from`
  • Loading branch information
rldhont committed Jul 15, 2024
1 parent 741b0e5 commit d0c42ff
Show file tree
Hide file tree
Showing 25 changed files with 36 additions and 37 deletions.
2 changes: 1 addition & 1 deletion tests/end2end/playwright/attribute-table.spec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// @ts-check
import { test, expect } from '@playwright/test';
const { gotoMap } = require('./globals')
import { gotoMap } from './globals';

test.describe('Attribute table', () => {
test.beforeEach(async ({ page }) => {
Expand Down
4 changes: 2 additions & 2 deletions tests/end2end/playwright/attributions.spec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// @ts-check
const { test, expect } = require('@playwright/test');
const { gotoMap } = require('./globals')
import { test, expect } from '@playwright/test';
import { gotoMap } from './globals';

test.describe('Attributions', () => {

Expand Down
4 changes: 2 additions & 2 deletions tests/end2end/playwright/axis_orientation.spec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// @ts-check
const { test, expect } = require('@playwright/test');
const { gotoMap } = require('./globals')
import { test, expect } from '@playwright/test';
import { gotoMap } from './globals';

test.describe('Axis Orientation', () => {

Expand Down
4 changes: 2 additions & 2 deletions tests/end2end/playwright/base-layers.spec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// @ts-check
const { test, expect } = require('@playwright/test');
const { gotoMap } = require('./globals')
import { test, expect } from '@playwright/test';
import { gotoMap } from './globals';

test.describe('Base layers', () => {

Expand Down
2 changes: 1 addition & 1 deletion tests/end2end/playwright/custom-javascript-api.spec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// @ts-check
import { test, expect } from '@playwright/test';
const { gotoMap } = require('./globals')
import { gotoMap } from './globals';

test.describe('Maps management', () => {

Expand Down
4 changes: 2 additions & 2 deletions tests/end2end/playwright/display_in_layer_tree.spec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// @ts-check
const { test, expect } = require('@playwright/test');
const { gotoMap } = require('./globals')
import { test, expect } from '@playwright/test';
import { gotoMap } from './globals';

test.describe('Display in layer tree', () => {

Expand Down
2 changes: 1 addition & 1 deletion tests/end2end/playwright/edition-form.spec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// @ts-check
import { test, expect } from '@playwright/test';
const { gotoMap } = require('./globals')
import { gotoMap } from './globals';

test.describe('Edition Form Validation', () => {

Expand Down
4 changes: 2 additions & 2 deletions tests/end2end/playwright/embed.spec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// @ts-check
const { test, expect } = require('@playwright/test');
const { gotoMap } = require('./globals')
import { test, expect } from '@playwright/test';
import { gotoMap } from './globals';

test.describe('Embed', () => {
test('Dataviz does not generate error', async ({ page }) => {
Expand Down
2 changes: 1 addition & 1 deletion tests/end2end/playwright/error-occurred.spec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// @ts-check
import { test, expect } from '@playwright/test';
const { gotoMap } = require('./globals')
import { gotoMap } from './globals';

export async function goBackHomeAfterError(page) {
await page.getByRole('link', { name: 'Go back to the home page.' }).click();
Expand Down
2 changes: 1 addition & 1 deletion tests/end2end/playwright/exposed_dependencies.spec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// @ts-check
import { test, expect } from '@playwright/test';
const { gotoMap } = require('./globals')
import { gotoMap } from './globals';

test.describe('Exposed dependencies', () => {
test('Dependencies are accessible', async ({ page }) => {
Expand Down
2 changes: 1 addition & 1 deletion tests/end2end/playwright/form_relational_value.spec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// @ts-check
import { test, expect } from '@playwright/test';
const { gotoMap } = require('./globals')
import { gotoMap } from './globals';

test.describe('Form relational values', () => {

Expand Down
6 changes: 3 additions & 3 deletions tests/end2end/playwright/google-basemap.spec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

const { test, expect } = require('@playwright/test');
const { gotoMap } = require('./globals');
import { test, expect } from '@playwright/test';
import { gotoMap } from './globals';;

test.describe('Google Maps Baselayers', () => {
test('Load map with no API Key', async ({ page }) => {
Expand Down Expand Up @@ -36,4 +36,4 @@ test.describe('Google Maps Baselayers', () => {
expect(await options.nth(1).getAttribute('value')).toBe('Google Satellite');
expect(await options.nth(2).getAttribute('value')).toBe('Google Hybrid');
});
});
});
2 changes: 1 addition & 1 deletion tests/end2end/playwright/legend.spec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// @ts-check
import { test, expect } from '@playwright/test';
const { gotoMap } = require('./globals')
import { gotoMap } from './globals';

test.describe('Legend tests', () => {

Expand Down
2 changes: 1 addition & 1 deletion tests/end2end/playwright/permalink.spec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// @ts-check
import { test, expect } from '@playwright/test';
const { gotoMap, reloadMap } = require('./globals')
import { gotoMap, reloadMap } from './globals';

test.describe('Permalink', () => {

Expand Down
5 changes: 2 additions & 3 deletions tests/end2end/playwright/popup.spec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// @ts-check
const { test, expect } = require('@playwright/test');
const { gotoMap } = require('./globals')
import { test, expect } from '@playwright/test';
import { gotoMap } from './globals';

test.describe('Dataviz in popup', () => {
test('Check lizmap feature toolbar', async ({ page }) => {
Expand Down Expand Up @@ -378,4 +378,3 @@ test.describe('Popup max features', () => {
await expect(page.locator('.lizmapPopupSingleFeature')).toHaveCount(15);
});
});

2 changes: 1 addition & 1 deletion tests/end2end/playwright/print.spec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// @ts-check
import { test, expect } from '@playwright/test';
const { gotoMap } = require('./globals')
import { gotoMap } from './globals';

test.describe('Print', () => {

Expand Down
4 changes: 2 additions & 2 deletions tests/end2end/playwright/print_in_project_projection.spec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// @ts-check
const { test, expect } = require('@playwright/test');
const { gotoMap } = require('./globals');
import { test, expect } from '@playwright/test';
import { gotoMap } from './globals';;

test.describe('Print in project projection', () => {

Expand Down
2 changes: 1 addition & 1 deletion tests/end2end/playwright/project_load_warning.spec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// @ts-check
import { test, expect } from '@playwright/test';
const { gotoMap } = require('./globals')
import { gotoMap } from './globals';

test.describe('Project warnings in CFG as admin', () => {
test.use({ storageState: 'playwright/.auth/admin.json' });
Expand Down
4 changes: 2 additions & 2 deletions tests/end2end/playwright/qgis-request.spec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// @ts-check
const { test, expect } = require('@playwright/test');
const { gotoMap } = require('./globals')
import { test, expect } from '@playwright/test';
import { gotoMap } from './globals';

test.describe('QGIS Requests', () => {
test('WMS Get Legend Graphic JSON', async ({ page }) => {
Expand Down
2 changes: 1 addition & 1 deletion tests/end2end/playwright/startup.spec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// @ts-check
import { test, expect } from '@playwright/test';
const { gotoMap } = require('./globals')
import { gotoMap } from './globals';

test.describe('Startup', () => {

Expand Down
2 changes: 1 addition & 1 deletion tests/end2end/playwright/theme.spec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// @ts-check
import { test, expect } from '@playwright/test';
const { gotoMap } = require('./globals')
import { gotoMap } from './globals';

test.describe('Theme', () => {
test.beforeEach(async ({ page }) => {
Expand Down
4 changes: 2 additions & 2 deletions tests/end2end/playwright/timemanage.spec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// @ts-check
const { test, expect } = require('@playwright/test');
const { gotoMap } = require('./globals')
import { test, expect } from '@playwright/test';
import { gotoMap } from './globals';

test.describe('Time Manager', () => {

Expand Down
2 changes: 1 addition & 1 deletion tests/end2end/playwright/viewport.spec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// @ts-check
import { test, expect } from '@playwright/test';
const { gotoMap } = require('./globals')
import { gotoMap } from './globals';

test.describe('Viewport devicePixelRatio 1', () => {
test('Greater than WMS max size', async ({ page }) => {
Expand Down
2 changes: 1 addition & 1 deletion tests/end2end/playwright/wmts.spec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// @ts-check
import { test, expect } from '@playwright/test';
const { gotoMap } = require('./globals')
import { gotoMap } from './globals';

test.describe('WMTS', () => {
test('Check GetCapabilities', async ({ page }) => {
Expand Down
2 changes: 1 addition & 1 deletion tests/end2end/playwright/xss.spec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// @ts-check
import { test, expect } from '@playwright/test';
const { gotoMap } = require('./globals')
import { gotoMap } from './globals';

test.describe('XSS', () => {
// Test that flawed data are sanitized before being displayed
Expand Down

0 comments on commit d0c42ff

Please sign in to comment.