diff --git a/apps/browser/src/vault/popup/services/vault-popup-autofill.service.spec.ts b/apps/browser/src/vault/popup/services/vault-popup-autofill.service.spec.ts index 5c9cf57f47..2dad1e3034 100644 --- a/apps/browser/src/vault/popup/services/vault-popup-autofill.service.spec.ts +++ b/apps/browser/src/vault/popup/services/vault-popup-autofill.service.spec.ts @@ -280,10 +280,10 @@ describe("VaultPopupAutofillService", () => { it("should close popup after a timeout for chromium browsers", async () => { mockPlatformUtilsService.isFirefox.mockReturnValue(false); - jest.spyOn(global, "requestAnimationFrame"); + jest.spyOn(global, "setTimeout"); await service.doAutofill(mockCipher); jest.advanceTimersByTime(50); - expect(requestAnimationFrame).toHaveBeenCalled(); + expect(setTimeout).toHaveBeenCalledTimes(1); expect(BrowserApi.closePopup).toHaveBeenCalled(); }); diff --git a/apps/browser/src/vault/popup/services/vault-popup-autofill.service.ts b/apps/browser/src/vault/popup/services/vault-popup-autofill.service.ts index c0221af75b..ff282d7a6d 100644 --- a/apps/browser/src/vault/popup/services/vault-popup-autofill.service.ts +++ b/apps/browser/src/vault/popup/services/vault-popup-autofill.service.ts @@ -280,7 +280,7 @@ export class VaultPopupAutofillService { } // Slight delay to fix bug in Chromium browsers where popup closes without copying totp to clipboard - requestAnimationFrame(() => BrowserApi.closePopup(window)); + setTimeout(() => BrowserApi.closePopup(window), 50); } /**