From c3feed2ac9b0292be672cb67210a691bc2e75f18 Mon Sep 17 00:00:00 2001 From: Danny Gleckler Date: Sun, 16 Jul 2023 20:29:02 -0400 Subject: [PATCH] Fix firefox flaky vdiff tests --- components/button/test/floating-buttons.vdiff.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/components/button/test/floating-buttons.vdiff.js b/components/button/test/floating-buttons.vdiff.js index 5bfe9c23b67..97d06def83e 100644 --- a/components/button/test/floating-buttons.vdiff.js +++ b/components/button/test/floating-buttons.vdiff.js @@ -1,6 +1,6 @@ import '../button.js'; import '../floating-buttons.js'; -import { expect, fixture, html } from '@brightspace-ui/testing'; +import { expect, fixture, html, nextFrame, oneEvent } from '@brightspace-ui/testing'; const lotsaCoffee = Array.from(Array(22).keys()).map(() => html`

I love Coffee!

`); @@ -43,19 +43,22 @@ describe('d2l-floating-buttons', () => { it('does not float at bottom of container', async() => { const elem = await fixture(floatingButtonsFixture); window.scrollTo(0, document.body.scrollHeight); - await expect(elem).to.be.golden({ wait: true }); + await oneEvent(window, 'scroll'); + await expect(elem).to.be.golden(); }); it('does not float when small amount of content', async() => { const elem = await fixture(floatingButtonsShortFixture); - await expect(elem).to.be.golden({ wait: true }); + await nextFrame(); + await expect(elem).to.be.golden(); }); it('floats when content added to dom', async() => { const elem = await fixture(floatingButtonsShortFixture); const contentElem = document.querySelector('#floating-buttons-short-content').querySelector('p'); contentElem.innerHTML += '

I love Coffe

I love Coffe

I love Coffe

I love Coffe

I love Coffe

I love Coffe

I love Coffe

I love Coffe

I love Coffe

I love Coffe

I love Coffe

I love Coffe

I love Coffe

I love Coffe

I love Coffe

I love Coffe

I love Coffe

I love Coffe

I love Coffe

I love Coffe

I love Coffe

'; - await expect(elem).to.be.golden({ wait: true }); + await nextFrame(); + await expect(elem).to.be.golden(); }); it('floats at bottom of page when always-float', async() => {