Skip to content

Commit

Permalink
improve console logs
Browse files Browse the repository at this point in the history
  • Loading branch information
manolo committed Jan 30, 2025
1 parent f8973df commit 35c28c2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 2 additions & 0 deletions scripts/pit/its/cc-localization.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,9 @@ const { assert } = require('console');
try {
await page.getByRole('button', { name: 'Stop preview' }).click();
await page.getByRole('link', { name: 'Settings' }).click();
await page.waitForTimeout(2000);
await page.locator('vaadin-grid').getByText('bakery-cc', { exact: true }).click();
await page.waitForTimeout(2000);
await page.getByLabel('Localization').uncheck();
await page.getByRole('button', { name: 'Disable' }).click();
await page.getByRole('button', { name: 'Update' }).click();
Expand Down
6 changes: 5 additions & 1 deletion scripts/pit/its/test-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,10 @@ async function createPage(headless, ignoreHTTPSErrors) {
});
const context = await browser.newContext({ignoreHTTPSErrors: ignoreHTTPSErrors, viewport: { width: 1792, height: 970 } });
const page = await context.newPage();
page.on('console', msg => /vaadinPush/.test(msg) || out("> CONSOLE:", (msg.text() + ' - ' + msg.location().url).replace(/\s+/g, ' '), '\n'));
page.on('console', msg => {
const text = `${msg.text()} - ${msg.location().url}`.replace(/\s+/g, ' ');
if (!/vaadinPush/.test(msg)) out("> CONSOLE:", text, '\n');
});
page.on('pageerror', e => warn("> JSERROR:", ('' + e).replace(/\s+/g, ' '), '\n'));
page.browser = browser;
return page;
Expand Down Expand Up @@ -94,6 +97,7 @@ async function waitForServerReady(page, url, options = {}) {
} = options;

log(`Opening ${url}\n`);
page.waitForTimeout(1000);
for (let attempt = 0; attempt < maxRetries; attempt++) {
try {
const response = await page.goto(url, {timeout: 120000});
Expand Down

0 comments on commit 35c28c2

Please sign in to comment.