error logging

This commit is contained in:
Rene Haas
2022-08-19 10:22:38 +02:00
parent 4b8346da90
commit 23b44f9da5
2 changed files with 33 additions and 21 deletions
@@ -2,9 +2,24 @@ const { expect } = require('@playwright/test');
const startSelector = '#start';
const resultSelector = '#testResult';
const logError = (page, msg) => {
const title = await page.title();
// eslint-disable-next-line no-console
console.error(title, msg);
}
// default timeout = // 10mins
module.exports = async (page, timeout = 10 * 60 * 2000) => {
page.on('pageerror', (err) => {
logError(page, err.message);
});
page.on('console', (msg) => {
if (msg.type() === 'error') {
logError(page, msg.text());
}
});
await page.waitForLoadState('domcontentloaded', { timeout: 5000 });
await page.click(startSelector, { timeout: 1000 });
@@ -816,32 +816,29 @@ const start = async () => {
setTestResult(null);
target?.removeAttribute('style');
try {
await overflowTest();
osInstance.options({ paddingAbsolute: !initialPaddingAbsolute });
await overflowTest();
await overflowTest();
osInstance.options({ paddingAbsolute: !initialPaddingAbsolute });
osInstance.options({ paddingAbsolute: initialPaddingAbsolute });
await overflowTest();
await overflowTest({ overflow: { x: 'visible', y: 'visible' } });
await overflowTest({ overflow: { x: 'hidden', y: 'scroll' } });
await overflowTest({ overflow: { x: 'visible-hidden', y: 'scroll' } });
await overflowTest({ overflow: { x: 'visible-scroll', y: 'visible-hidden' } });
osInstance.options({ paddingAbsolute: initialPaddingAbsolute });
if (!isFastTestRun) {
await overflowTest({ overflow: { x: 'hidden', y: 'visible' } });
await overflowTest({ overflow: { x: 'visible', y: 'scroll' } });
await overflowTest({ overflow: { x: 'visible-hidden', y: 'hidden' } });
await overflowTest({ overflow: { x: 'visible', y: 'visible-scroll' } });
await overflowTest({ overflow: { x: 'scroll', y: 'visible-scroll' } });
await overflowTest({ overflow: { x: 'scroll', y: 'hidden' } });
await overflowTest({ overflow: { x: 'scroll', y: 'visible' } });
await overflowTest({ overflow: { x: 'visible', y: 'hidden' } });
}
} catch (e) {
console.log(e);
await overflowTest({ overflow: { x: 'visible', y: 'visible' } });
await overflowTest({ overflow: { x: 'hidden', y: 'scroll' } });
await overflowTest({ overflow: { x: 'visible-hidden', y: 'scroll' } });
await overflowTest({ overflow: { x: 'visible-scroll', y: 'visible-hidden' } });
if (!isFastTestRun) {
await overflowTest({ overflow: { x: 'hidden', y: 'visible' } });
await overflowTest({ overflow: { x: 'visible', y: 'scroll' } });
await overflowTest({ overflow: { x: 'visible-hidden', y: 'hidden' } });
await overflowTest({ overflow: { x: 'visible', y: 'visible-scroll' } });
await overflowTest({ overflow: { x: 'scroll', y: 'visible-scroll' } });
await overflowTest({ overflow: { x: 'scroll', y: 'hidden' } });
await overflowTest({ overflow: { x: 'scroll', y: 'visible' } });
await overflowTest({ overflow: { x: 'visible', y: 'hidden' } });
}
setTestResult(true);