Skip to content
Open
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
34 changes: 33 additions & 1 deletion tests/end2end/playwright/pages/project.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { BasePage } from './base';
*/

/**
* Playwright Page
* Playwright Locator
* @typedef {import('@playwright/test').Locator} Locator
*/

Expand All @@ -23,6 +23,17 @@ import { BasePage } from './base';
* @typedef {number} int
*/

/**
* Console log message
* @typedef {object} logMessage
* @property {string} type - the log type :One of the following values:
* 'log', 'debug', 'info', 'error', 'warning', 'dir', 'dirxml', 'table',
* 'trace', 'clear', 'startGroup', 'startGroupCollapsed', 'endGroup',
* 'assert', 'profile', 'profileEnd', 'count', 'timeEnd'.
* @property {string} message - the log message text
* @property {string} location - the log message location in one line
* @see https://playwright.dev/docs/api/class-consolemessage
*/
export class ProjectPage extends BasePage {
// Metadata
/**
Expand Down Expand Up @@ -111,6 +122,12 @@ export class ProjectPage extends BasePage {
*/
warningMessage;

/**
* Logs collected
* @type {logMessage[]}
*/
logs = [];

/**
* Path to the QGS file
* @type {string}
Expand Down Expand Up @@ -200,6 +217,21 @@ export class ProjectPage extends BasePage {
this.buttonEditing = page.locator('#button-edition');
this.buttonMetadata = page.locator('#button-metadata');
this.editionForm = page.locator('#jforms_view_edition');

const logs = this.logs;
page.on('console', message => {
// Default message from jQuery: JQMIGRATE: Migrate is installed, version 3.3.1
// Do not stored it - will be removed when we are sure that this log will not appear
if (message.type() == 'log' && message.text().startsWith('JQMIGRATE: Migrate is installed')) {
return;
}
const location = message.location()
logs.push({
type: message.type(),
message: message.text(),
location: `${location.url}:${location.lineNumber}:${location.columnNumber}`
})
})
}

/**
Expand Down
Loading