@@ -9,7 +9,7 @@ import { BasePage } from './base';
99 */
1010
1111/**
12- * Playwright Page
12+ * Playwright Locator
1313 * @typedef {import('@playwright/test').Locator } Locator
1414 */
1515
@@ -18,6 +18,17 @@ import { BasePage } from './base';
1818 * @typedef {import('@playwright/test').Request } Request
1919 */
2020
21+ /**
22+ * @typedef {Object } logMessage
23+ * @property {string } type - the log type :One of the following values:
24+ * 'log', 'debug', 'info', 'error', 'warning', 'dir', 'dirxml', 'table',
25+ * 'trace', 'clear', 'startGroup', 'startGroupCollapsed', 'endGroup',
26+ * 'assert', 'profile', 'profileEnd', 'count', 'timeEnd'.
27+ * @property {string } message - the log message text
28+ * @property {string } location - the log message location in one line
29+ * @see https://playwright.dev/docs/api/class-consolemessage
30+ */
31+
2132export class ProjectPage extends BasePage {
2233 // Metadata
2334 /**
@@ -106,6 +117,12 @@ export class ProjectPage extends BasePage {
106117 */
107118 warningMessage ;
108119
120+ /**
121+ * Logs collected
122+ * @type {logMessage[] }
123+ */
124+ logs = [ ] ;
125+
109126 /**
110127 * Path to the QGS file
111128 * @type {string }
@@ -176,6 +193,21 @@ export class ProjectPage extends BasePage {
176193 this . buttonEditing = page . locator ( '#button-edition' ) ;
177194 this . buttonMetadata = page . locator ( '#button-metadata' ) ;
178195 this . editionForm = page . locator ( '#jforms_view_edition' ) ;
196+
197+ const logs = this . logs ;
198+ page . on ( 'console' , message => {
199+ // Default message from jQuery: JQMIGRATE: Migrate is installed, version 3.3.1
200+ // Do not stored it - will be removed when we are sure that this log will not appear
201+ if ( message . type ( ) == 'log' && message . text ( ) . startsWith ( 'JQMIGRATE: Migrate is installed' ) ) {
202+ return ;
203+ }
204+ const location = message . location ( )
205+ logs . push ( {
206+ type : message . type ( ) ,
207+ message : message . text ( ) ,
208+ location : `${ location . url } :${ location . lineNumber } :${ location . columnNumber } `
209+ } )
210+ } )
179211 }
180212
181213 /**
0 commit comments