Compare commits

...

3 Commits

Author SHA1 Message Date
d5a03e0dd0 only run this one test please... 2022-06-08 11:49:14 -07:00
ff975656d4 Simulate a e2e test failure due to console error 2022-06-08 11:41:55 -07:00
58aeab3d31 [e2e] Add clarity to console.error failures
- Create a separate assert for each message

- Format the `ConsoleMessage` to provide location, line, and col numbers
2022-06-08 11:06:08 -07:00
4 changed files with 22 additions and 5 deletions

View File

@ -4,15 +4,29 @@
const base = require('@playwright/test'); const base = require('@playwright/test');
const { expect } = require('@playwright/test'); const { expect } = require('@playwright/test');
/**
* Takes a `ConsoleMessage` and returns a formatted string
* @param {import('@playwright/test').ConsoleMessage} msg
* @returns {String} formatted string with message type, text, url, and line and column numbers
*/
function consoleMessageToString(msg) {
const { url, lineNumber, columnNumber } = msg.location();
return `[${msg.type()}] ${msg.text()}
at (${url} ${lineNumber}:${columnNumber})`;
}
exports.test = base.test.extend({ exports.test = base.test.extend({
page: async ({ baseURL, page }, use) => { page: async ({ baseURL, page }, use) => {
const messages = []; const messages = [];
page.on('console', msg => messages.push(`[${msg.type()}] ${msg.text()}`)); page.on('console', (msg) => messages.push(msg));
await use(page); await use(page);
await expect.soft(messages.toString()).not.toContain('[error]'); messages.forEach(
msg => expect.soft(msg.type(), `Console error detected: ${consoleMessageToString(msg)}`).not.toEqual('error')
);
}, },
browser: async ({ playwright, browser }, use, workerInfo) => { browser: async ({ playwright, browser }, use, workerInfo) => {
// Use browserless if configured // Use browserless if configured
if (workerInfo.project.name.match(/browserless/)) { if (workerInfo.project.name.match(/browserless/)) {
const vBrowser = await playwright.chromium.connectOverCDP({ const vBrowser = await playwright.chromium.connectOverCDP({
endpointURL: 'ws://localhost:3003' endpointURL: 'ws://localhost:3003'

View File

@ -23,7 +23,8 @@
const { test } = require('../../../fixtures'); const { test } = require('../../../fixtures');
const { expect } = require('@playwright/test'); const { expect } = require('@playwright/test');
test.describe('Telemetry Table', () => { // eslint-disable-next-line playwright/no-focused-test
test.describe.only('Telemetry Table', () => {
test('unpauses when paused by button and user changes bounds', async ({ page }) => { test('unpauses when paused by button and user changes bounds', async ({ page }) => {
test.info().annotations.push({ test.info().annotations.push({
type: 'issue', type: 'issue',

View File

@ -89,7 +89,7 @@
"test": "cross-env NODE_OPTIONS=\"--max_old_space_size=4096\" karma start --single-run", "test": "cross-env NODE_OPTIONS=\"--max_old_space_size=4096\" karma start --single-run",
"test:firefox": "cross-env NODE_OPTIONS=\"--max_old_space_size=4096\" karma start --single-run --browsers=FirefoxHeadless", "test:firefox": "cross-env NODE_OPTIONS=\"--max_old_space_size=4096\" karma start --single-run --browsers=FirefoxHeadless",
"test:debug": "cross-env NODE_ENV=debug karma start --no-single-run", "test:debug": "cross-env NODE_ENV=debug karma start --no-single-run",
"test:e2e:ci": "npx playwright test --config=e2e/playwright-ci.config.js --project=chrome smoke branding default condition timeConductor clock exampleImagery notebook persistence performance", "test:e2e:ci": "npx playwright test --config=e2e/playwright-ci.config.js --project=chrome telemetryTable",
"test:e2e:local": "npx playwright test --config=e2e/playwright-local.config.js --project=chrome", "test:e2e:local": "npx playwright test --config=e2e/playwright-local.config.js --project=chrome",
"test:e2e:updatesnapshots": "npx playwright test --config=e2e/playwright-local.config.js --project=chrome --grep @snapshot --update-snapshots", "test:e2e:updatesnapshots": "npx playwright test --config=e2e/playwright-local.config.js --project=chrome --grep @snapshot --update-snapshots",
"test:e2e:visual": "percy exec --config ./e2e/.percy.yml -- npx playwright test --config=e2e/playwright-visual.config.js", "test:e2e:visual": "percy exec --config ./e2e/.percy.yml -- npx playwright test --config=e2e/playwright-visual.config.js",

View File

@ -476,6 +476,7 @@ export default {
this.filterChanged = _.debounce(this.filterChanged, 500); this.filterChanged = _.debounce(this.filterChanged, 500);
}, },
mounted() { mounted() {
console.error('oh noes an error!');
this.csvExporter = new CSVExporter(); this.csvExporter = new CSVExporter();
this.rowsAdded = _.throttle(this.rowsAdded, 200); this.rowsAdded = _.throttle(this.rowsAdded, 200);
this.rowsRemoved = _.throttle(this.rowsRemoved, 200); this.rowsRemoved = _.throttle(this.rowsRemoved, 200);
@ -536,6 +537,7 @@ export default {
this.table.configuration.destroy(); this.table.configuration.destroy();
this.table.destroy(); this.table.destroy();
this.isNotARealFunction();
}, },
methods: { methods: {
updateVisibleRows() { updateVisibleRows() {