From db1f536cec6278119727bafe7b8d5f7834df58f7 Mon Sep 17 00:00:00 2001 From: Stacey Van Herk <13419300+svanherk@users.noreply.github.com> Date: Fri, 4 Aug 2023 10:02:12 -0400 Subject: [PATCH 1/5] Add some debug logs --- src/browser/reset.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/browser/reset.js b/src/browser/reset.js index 491088ab..1bffaf2c 100644 --- a/src/browser/reset.js +++ b/src/browser/reset.js @@ -14,6 +14,7 @@ let currentLang = undefined, shouldResetMouse = false; export function requestMouseReset() { + console.log('requestMouseReset'); shouldResetMouse = true; } @@ -34,7 +35,10 @@ export async function reset(opts) { if (shouldResetMouse) { shouldResetMouse = false; + console.log('resetting mouse'); + console.time('mouse'); await sendMouse({ type: 'move', position: [0, 0] }).catch(() => {}); + console.timeEnd('mouse'); } if (document.activeElement !== document.body) { From 412c48254f499d489d78aae43fbe977f06b7553e Mon Sep 17 00:00:00 2001 From: Stacey Van Herk <13419300+svanherk@users.noreply.github.com> Date: Fri, 4 Aug 2023 10:07:16 -0400 Subject: [PATCH 2/5] Turn off linting --- src/browser/reset.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/browser/reset.js b/src/browser/reset.js index 1bffaf2c..73fd64d3 100644 --- a/src/browser/reset.js +++ b/src/browser/reset.js @@ -1,3 +1,5 @@ +/* eslint no-console: 0 */ + import { sendMouse, setViewport } from '@web/test-runner-commands'; import { nextFrame } from '@open-wc/testing'; From d1fe36b7a6425a05e8af7b085447ef3fca5d2d72 Mon Sep 17 00:00:00 2001 From: Stacey Van Herk <13419300+svanherk@users.noreply.github.com> Date: Fri, 4 Aug 2023 10:21:14 -0400 Subject: [PATCH 3/5] console.time not being logged --- src/browser/reset.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/browser/reset.js b/src/browser/reset.js index 73fd64d3..558f712c 100644 --- a/src/browser/reset.js +++ b/src/browser/reset.js @@ -38,9 +38,9 @@ export async function reset(opts) { if (shouldResetMouse) { shouldResetMouse = false; console.log('resetting mouse'); - console.time('mouse'); + const start = new Date().getTime(); await sendMouse({ type: 'move', position: [0, 0] }).catch(() => {}); - console.timeEnd('mouse'); + console.log('took', new Date().getTime() - start); } if (document.activeElement !== document.body) { From 27187376e84d1fadaa9afc649573325e880b096b Mon Sep 17 00:00:00 2001 From: Stacey Van Herk <13419300+svanherk@users.noreply.github.com> Date: Fri, 4 Aug 2023 12:08:55 -0400 Subject: [PATCH 4/5] Switch logs --- src/browser/fixture.js | 4 ++++ src/browser/reset.js | 5 ----- test/browser/commands.test.js | 4 ++++ 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/browser/fixture.js b/src/browser/fixture.js index b57f55c5..b82e39ee 100644 --- a/src/browser/fixture.js +++ b/src/browser/fixture.js @@ -1,3 +1,5 @@ +/* eslint no-console: 0 */ + import { nextFrame, fixture as wcFixture } from '@open-wc/testing'; import { reset } from './reset.js'; @@ -48,7 +50,9 @@ async function waitForElem(elem, awaitLoadingComplete = true) { } export async function fixture(element, opts = {}) { + console.log('before reset'); await Promise.all([reset(opts), document.fonts.ready]); + console.log('after reset'); const elem = await wcFixture(element); await waitForElem(elem, opts.awaitLoadingComplete); diff --git a/src/browser/reset.js b/src/browser/reset.js index 558f712c..991d1e7e 100644 --- a/src/browser/reset.js +++ b/src/browser/reset.js @@ -16,12 +16,10 @@ let currentLang = undefined, shouldResetMouse = false; export function requestMouseReset() { - console.log('requestMouseReset'); shouldResetMouse = true; } export async function reset(opts) { - opts = opts || {}; opts.lang = opts.lang || DEFAULT_LANG; opts.mathjax = opts.mathjax || {}; @@ -37,10 +35,7 @@ export async function reset(opts) { if (shouldResetMouse) { shouldResetMouse = false; - console.log('resetting mouse'); - const start = new Date().getTime(); await sendMouse({ type: 'move', position: [0, 0] }).catch(() => {}); - console.log('took', new Date().getTime() - start); } if (document.activeElement !== document.body) { diff --git a/test/browser/commands.test.js b/test/browser/commands.test.js index c5ce639a..4b3bbe9d 100644 --- a/test/browser/commands.test.js +++ b/test/browser/commands.test.js @@ -1,3 +1,5 @@ +/* eslint no-console: 0 */ + import { clickAt, clickElem, expect, fixture, focusElem, hoverAt, hoverElem, sendKeys, sendKeysElem } from '../../src/browser/index.js'; import { html } from 'lit'; import { spy } from 'sinon'; @@ -7,7 +9,9 @@ describe('commands', () => { let elem; const input = html``; beforeEach(async() => { + console.log('before fixture'); elem = await fixture(input); + console.log('after fixture'); }); it('should click on element', async() => { From 677361ad6545ab7e53ced1ff627e7780c75fa5b2 Mon Sep 17 00:00:00 2001 From: Stacey Van Herk <13419300+svanherk@users.noreply.github.com> Date: Fri, 4 Aug 2023 17:05:39 -0400 Subject: [PATCH 5/5] More logs --- src/browser/fixture.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/browser/fixture.js b/src/browser/fixture.js index b82e39ee..3fe9f2e8 100644 --- a/src/browser/fixture.js +++ b/src/browser/fixture.js @@ -53,10 +53,16 @@ export async function fixture(element, opts = {}) { console.log('before reset'); await Promise.all([reset(opts), document.fonts.ready]); console.log('after reset'); + console.log('before wcFixture'); const elem = await wcFixture(element); + console.log('after wcFixture'); + console.log('before waitForElem'); await waitForElem(elem, opts.awaitLoadingComplete); + console.log('after waitForElem'); + console.log('before pause'); await pause(); + console.log('after pause'); return elem; }