Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#5176: fix await element performance regression #5177

Merged
merged 4 commits into from
Feb 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
230 changes: 230 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@
},
"devDependencies": {
"@fortawesome/fontawesome-common-types": "^0.2.36",
"@shopify/jest-dom-mocks": "^4.1.0",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Includes mocks for requestIdleCallback. I think we could also use for location mock instead of the other we added a couple weeks ago

"@sindresorhus/tsconfig": "^3.0.1",
"@sinonjs/fake-timers": "^10.0.2",
"@storybook/addon-actions": "^6.5.15",
Expand Down
9 changes: 9 additions & 0 deletions src/blocks/effects/wait.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,15 @@ import { uuidSequence } from "@/testUtils/factories";
import { type BlockOptions } from "@/core";
import { WaitElementEffect } from "@/blocks/effects/wait";
import { BusinessError } from "@/errors/businessErrors";
import { ensureMocksReset, requestIdleCallback } from "@shopify/jest-dom-mocks";

beforeAll(() => {
requestIdleCallback.mock();
});

beforeEach(() => {
ensureMocksReset();
});

const brick = new WaitElementEffect();

Expand Down
12 changes: 12 additions & 0 deletions src/blocks/transformers/tourStep/tourStep.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,15 @@ import { tick } from "@/extensionPoints/extensionPointTestUtils";
import { MultipleElementsFoundError } from "@/errors/businessErrors";
import { showModal } from "@/blocks/transformers/ephemeralForm/modalUtils";
import { showPopover } from "@/blocks/transformers/temporaryInfo/popoverUtils";
import { ensureMocksReset, requestIdleCallback } from "@shopify/jest-dom-mocks";

beforeAll(() => {
requestIdleCallback.mock();
});

beforeEach(() => {
ensureMocksReset();
});

Element.prototype.scrollIntoView = jest.fn();
browser.runtime.getURL = jest
Expand Down Expand Up @@ -279,6 +288,9 @@ describe("tourStep", () => {
// :initialize:
document.body.innerHTML = '<div id="foo">Foo</div>';

requestIdleCallback.runIdleCallbacks();
// Ticks to allow the setInterval to run
await tick();
await tick();

cancelAllTours();
Expand Down