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

[PM-8833] Implement on page autofill menu for password generation #11114

Draft
wants to merge 28 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
b127897
[PM-8833] Implement on page autofill menu for password generation
cagonzalezcs Sep 16, 2024
d9ad92d
[PM-8833] Working through a rough sketch of the implementation
cagonzalezcs Sep 16, 2024
da4aef4
[PM-8833] Refining visual representation of the password generator
cagonzalezcs Sep 17, 2024
d06b7fe
Merge branch 'main' into autofill/pm-8833-implement-on-page-autofill-โ€ฆ
cagonzalezcs Sep 17, 2024
623cdd2
[PM-8833] Implementing refresh password trigger
cagonzalezcs Sep 17, 2024
f9eb56d
[PM-8833] Working through placement of the password generator
cagonzalezcs Sep 17, 2024
552b6f8
[PM-8833] Working through placement of the password generator
cagonzalezcs Sep 17, 2024
e028801
[PM-8833] Working through placement of the password generator
cagonzalezcs Sep 17, 2024
01a9999
[PM-8833] Implementing fill behvaior for the new password elements
cagonzalezcs Sep 17, 2024
74354cc
Merge branch 'main' into autofill/pm-8833-implement-on-page-autofill-โ€ฆ
cagonzalezcs Sep 17, 2024
79b20a2
Merge branch 'main' into autofill/pm-8833-implement-on-page-autofill-โ€ฆ
cagonzalezcs Sep 18, 2024
b94165b
Merge branch 'main' into autofill/pm-8833-implement-on-page-autofill-โ€ฆ
cagonzalezcs Sep 19, 2024
bfe9927
[PM-8833] Refactoring elements of the OverlayContentService to faciliโ€ฆ
cagonzalezcs Sep 19, 2024
4378048
[PM-8833] Fixing an issue where the inline menu can potentially appeaโ€ฆ
cagonzalezcs Sep 19, 2024
3d4c220
[PM-8833] Implementing a throttle to the update of overlay ciphers toโ€ฆ
cagonzalezcs Sep 19, 2024
3f4e3ac
Merge branch 'main' into autofill/pm-8833-implement-on-page-autofill-โ€ฆ
cagonzalezcs Sep 19, 2024
64a454a
[PM-8833] Working through refinements for how the inline menu is placed
cagonzalezcs Sep 19, 2024
c035ef8
Merge branch 'main' into autofill/pm-8833-implement-on-page-autofill-โ€ฆ
cagonzalezcs Sep 19, 2024
43ed792
[PM-8833] Adding aria labels to the password generator elements
cagonzalezcs Sep 19, 2024
55da615
[PM-8833] Setting up password generator to refresh only when a form iโ€ฆ
cagonzalezcs Sep 20, 2024
0836e43
[PM-8833] Fixing an issue with how hover state can affect positioningโ€ฆ
cagonzalezcs Sep 20, 2024
7ea2d50
Merge branch 'main' into autofill/pm-8833-implement-on-page-autofill-โ€ฆ
cagonzalezcs Sep 20, 2024
602694d
[PM-8833] Fixing an issue where the inline menu aria alert can be reaโ€ฆ
cagonzalezcs Sep 20, 2024
0acc876
[PM-8833] Fixing a couple of smaller issues before diving deeper intoโ€ฆ
cagonzalezcs Sep 20, 2024
f7ad4e5
Merge branch 'main' into autofill/pm-8833-implement-on-page-autofill-โ€ฆ
cagonzalezcs Sep 20, 2024
f3f9a44
[PM-8833] Refactoring implementation
cagonzalezcs Sep 20, 2024
55b0934
[PM-8833] Refactoring implementation
cagonzalezcs Sep 20, 2024
eb4ccf3
[PM-8833] Fixing an issue with attempting to generate a password withโ€ฆ
cagonzalezcs Sep 20, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions apps/browser/src/_locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -4474,5 +4474,12 @@
},
"noEditPermissions": {
"message": "You don't have permission to edit this item"
},
"fillGeneratedPassword": {
"message": "Fill generated password",
"description": "Heading for the password generator within the inline menu"
},
"passwordRegenerated": {
"message": "Password regenerated"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { CipherType } from "@bitwarden/common/vault/enums";
import { CipherRepromptType } from "@bitwarden/common/vault/enums/cipher-reprompt-type";
import { CipherView } from "@bitwarden/common/vault/models/view/cipher.view";

import { InlineMenuFillTypes } from "../../enums/autofill-overlay.enum";
import AutofillPageDetails from "../../models/autofill-page-details";
import { PageDetail } from "../../services/abstractions/autofill.service";

Expand Down Expand Up @@ -32,14 +33,18 @@ export type WebsiteIconData = {
icon: string;
};

export type UpdateOverlayCiphersParams = {
updateAllCipherTypes: boolean;
openInlineMenu: boolean;
};

export type FocusedFieldData = {
focusedFieldStyles: Partial<CSSStyleDeclaration>;
focusedFieldRects: Partial<DOMRect>;
filledByCipherType?: CipherType;
inlineMenuFillType?: InlineMenuFillTypes;
tabId?: number;
frameId?: number;
accountCreationFieldType?: string;
showInlineMenuAccountCreation?: boolean;
showPasskeys?: boolean;
};

Expand Down Expand Up @@ -247,6 +252,8 @@ export type InlineMenuListPortMessageHandlers = {
viewSelectedCipher: ({ message, port }: PortOnMessageHandlerParams) => void;
redirectAutofillInlineMenuFocusOut: ({ message, port }: PortOnMessageHandlerParams) => void;
updateAutofillInlineMenuListHeight: ({ message, port }: PortOnMessageHandlerParams) => void;
refreshGeneratedPassword: () => Promise<void>;
fillGeneratedPassword: ({ port }: PortConnectionParam) => Promise<void>;
};

export interface OverlayBackground {
Expand Down
25 changes: 14 additions & 11 deletions apps/browser/src/autofill/background/overlay.background.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { BehaviorSubject } from "rxjs";

import { AuthService } from "@bitwarden/common/auth/abstractions/auth.service";
import { AuthenticationStatus } from "@bitwarden/common/auth/enums/authentication-status";

Check failure on line 5 in apps/browser/src/autofill/background/overlay.background.spec.ts

View workflow job for this annotation

GitHub Actions / Test Results

OverlayBackground โ–บ OverlayBackground re-positioning the inline menu within sub frames triggerAutofillOverlayReposition repositionInlineMenu updating the inline menu position sets the inline menu invisible and updates its position โ–บ OverlayBackground r...

Failed test found in: junit.xml Error: TypeError: Cannot read properties of undefined (reading 'postMessage')
Raw output
TypeError: Cannot read properties of undefined (reading 'postMessage')
    at /home/runner/work/clients/clients/apps/browser/src/autofill/background/overlay.background.spec.ts:594:34
    at Generator.next (<anonymous>)
    at fulfilled (/home/runner/work/clients/clients/apps/browser/src/autofill/background/overlay.background.spec.ts:5:58)
    at _ZoneDelegate.Object.<anonymous>._ZoneDelegate.invoke (/home/runner/work/clients/clients/node_modules/zone.js/bundles/zone.umd.js:411:30)
    at ProxyZoneSpec.Object.<anonymous>.ProxyZoneSpec.onInvoke (/home/runner/work/clients/clients/node_modules/zone.js/bundles/zone-testing.umd.js:300:43)
    at _ZoneDelegate.Object.<anonymous>._ZoneDelegate.invoke (/home/runner/work/clients/clients/node_modules/zone.js/bundles/zone.umd.js:410:56)
    at Zone.Object.<anonymous>.Zone.run (/home/runner/work/clients/clients/node_modules/zone.js/bundles/zone.umd.js:165:47)
    at /home/runner/work/clients/clients/node_modules/zone.js/bundles/zone.umd.js:1314:38
    at _ZoneDelegate.Object.<anonymous>._ZoneDelegate.invokeTask (/home/runner/work/clients/clients/node_modules/zone.js/bundles/zone.umd.js:445:35)
    at ProxyZoneSpec.Object.<anonymous>.ProxyZoneSpec.onInvokeTask (/home/runner/work/clients/clients/node_modules/zone.js/bundles/zone-testing.umd.js:331:43)
    at _ZoneDelegate.Object.<anonymous>._ZoneDelegate.invokeTask (/home/runner/work/clients/clients/node_modules/zone.js/bundles/zone.umd.js:444:64)
    at Zone.Object.<anonymous>.Zone.runTask (/home/runner/work/clients/clients/node_modules/zone.js/bundles/zone.umd.js:210:51)
    at drainMicroTaskQueue (/home/runner/work/clients/clients/node_modules/zone.js/bundles/zone.umd.js:634:39)
    at Object.<anonymous>.ZoneTask.invokeTask (/home/runner/work/clients/clients/node_modules/zone.js/bundles/zone.umd.js:531:25)
    at ZoneTask.invoke (/home/runner/work/clients/clients/node_modules/zone.js/bundles/zone.umd.js:516:52)
    at data.args.<computed> (/home/runner/work/clients/clients/node_modules/zone.js/bundles/zone.umd.js:2421:36)
    at Timeout.task [as _onTimeout] (/home/runner/work/clients/clients/node_modules/jest-environment-jsdom/node_modules/jsdom/lib/jsdom/browser/Window.js:520:19)
    at listOnTimeout (node:internal/timers:581:17)
    at processTimers (node:internal/timers:519:7)

Check failure on line 5 in apps/browser/src/autofill/background/overlay.background.spec.ts

View workflow job for this annotation

GitHub Actions / Test Results

OverlayBackground โ–บ OverlayBackground re-positioning the inline menu within sub frames triggerAutofillOverlayReposition toggleInlineMenuHidden skips adjusting the hidden status of the inline menu if the sender tab does not contain the focused field โ–บ O...

Failed test found in: junit.xml Error: TypeError: Cannot read properties of undefined (reading 'postMessage')
Raw output
TypeError: Cannot read properties of undefined (reading 'postMessage')
    at /home/runner/work/clients/clients/apps/browser/src/autofill/background/overlay.background.spec.ts:714:32
    at Generator.next (<anonymous>)
    at fulfilled (/home/runner/work/clients/clients/apps/browser/src/autofill/background/overlay.background.spec.ts:5:58)
    at _ZoneDelegate.Object.<anonymous>._ZoneDelegate.invoke (/home/runner/work/clients/clients/node_modules/zone.js/bundles/zone.umd.js:411:30)
    at ProxyZoneSpec.Object.<anonymous>.ProxyZoneSpec.onInvoke (/home/runner/work/clients/clients/node_modules/zone.js/bundles/zone-testing.umd.js:300:43)
    at _ZoneDelegate.Object.<anonymous>._ZoneDelegate.invoke (/home/runner/work/clients/clients/node_modules/zone.js/bundles/zone.umd.js:410:56)
    at Zone.Object.<anonymous>.Zone.run (/home/runner/work/clients/clients/node_modules/zone.js/bundles/zone.umd.js:165:47)
    at /home/runner/work/clients/clients/node_modules/zone.js/bundles/zone.umd.js:1314:38
    at _ZoneDelegate.Object.<anonymous>._ZoneDelegate.invokeTask (/home/runner/work/clients/clients/node_modules/zone.js/bundles/zone.umd.js:445:35)
    at ProxyZoneSpec.Object.<anonymous>.ProxyZoneSpec.onInvokeTask (/home/runner/work/clients/clients/node_modules/zone.js/bundles/zone-testing.umd.js:331:43)
    at _ZoneDelegate.Object.<anonymous>._ZoneDelegate.invokeTask (/home/runner/work/clients/clients/node_modules/zone.js/bundles/zone.umd.js:444:64)
    at Zone.Object.<anonymous>.Zone.runTask (/home/runner/work/clients/clients/node_modules/zone.js/bundles/zone.umd.js:210:51)
    at drainMicroTaskQueue (/home/runner/work/clients/clients/node_modules/zone.js/bundles/zone.umd.js:634:39)

Check failure on line 5 in apps/browser/src/autofill/background/overlay.background.spec.ts

View workflow job for this annotation

GitHub Actions / Test Results

OverlayBackground โ–บ OverlayBackground updating the overlay ciphers closes the inline menu on the focused field's tab if the user's auth status is not unlocked โ–บ OverlayBackground updating the overlay ciphers closes the inline menu on the focused field'...

Failed test found in: junit.xml Error: Error: expect(jest.fn()).toHaveBeenCalledWith(...expected)
Raw output
Error: expect(jest.fn()).toHaveBeenCalledWith(...expected)

Expected: undefined, {"command": "closeAutofillInlineMenu", "overlayElement": undefined}, {"frameId": 0}

Number of calls: 0
    at /home/runner/work/clients/clients/apps/browser/src/autofill/background/overlay.background.spec.ts:810:34
    at Generator.next (<anonymous>)
    at fulfilled (/home/runner/work/clients/clients/apps/browser/src/autofill/background/overlay.background.spec.ts:5:58)
    at _ZoneDelegate.Object.<anonymous>._ZoneDelegate.invoke (/home/runner/work/clients/clients/node_modules/zone.js/bundles/zone.umd.js:411:30)
    at ProxyZoneSpec.Object.<anonymous>.ProxyZoneSpec.onInvoke (/home/runner/work/clients/clients/node_modules/zone.js/bundles/zone-testing.umd.js:300:43)
    at _ZoneDelegate.Object.<anonymous>._ZoneDelegate.invoke (/home/runner/work/clients/clients/node_modules/zone.js/bundles/zone.umd.js:410:56)
    at Zone.Object.<anonymous>.Zone.run (/home/runner/work/clients/clients/node_modules/zone.js/bundles/zone.umd.js:165:47)
    at /home/runner/work/clients/clients/node_modules/zone.js/bundles/zone.umd.js:1314:38
    at _ZoneDelegate.Object.<anonymous>._ZoneDelegate.invokeTask (/home/runner/work/clients/clients/node_modules/zone.js/bundles/zone.umd.js:445:35)
    at ProxyZoneSpec.Object.<anonymous>.ProxyZoneSpec.onInvokeTask (/home/runner/work/clients/clients/node_modules/zone.js/bundles/zone-testing.umd.js:331:43)
    at _ZoneDelegate.Object.<anonymous>._ZoneDelegate.invokeTask (/home/runner/work/clients/clients/node_modules/zone.js/bundles/zone.umd.js:444:64)
    at Zone.Object.<anonymous>.Zone.runTask (/home/runner/work/clients/clients/node_modules/zone.js/bundles/zone.umd.js:210:51)
    at drainMicroTaskQueue (/home/runner/work/clients/clients/node_modules/zone.js/bundles/zone.umd.js:634:39)

Check failure on line 5 in apps/browser/src/autofill/background/overlay.background.spec.ts

View workflow job for this annotation

GitHub Actions / Test Results

OverlayBackground โ–บ OverlayBackground updating the overlay ciphers closes the inline menu on the focused field's tab if current tab is different โ–บ OverlayBackground updating the overlay ciphers closes the inline menu on the focused field's tab if curre...

Failed test found in: junit.xml Error: Error: expect(jest.fn()).toHaveBeenCalledWith(...expected)
Raw output
Error: expect(jest.fn()).toHaveBeenCalledWith(...expected)

Expected: undefined, {"command": "closeAutofillInlineMenu", "overlayElement": undefined}, {"frameId": 0}

Number of calls: 0
    at /home/runner/work/clients/clients/apps/browser/src/autofill/background/overlay.background.spec.ts:827:34
    at Generator.next (<anonymous>)
    at fulfilled (/home/runner/work/clients/clients/apps/browser/src/autofill/background/overlay.background.spec.ts:5:58)
    at _ZoneDelegate.Object.<anonymous>._ZoneDelegate.invoke (/home/runner/work/clients/clients/node_modules/zone.js/bundles/zone.umd.js:411:30)
    at ProxyZoneSpec.Object.<anonymous>.ProxyZoneSpec.onInvoke (/home/runner/work/clients/clients/node_modules/zone.js/bundles/zone-testing.umd.js:300:43)
    at _ZoneDelegate.Object.<anonymous>._ZoneDelegate.invoke (/home/runner/work/clients/clients/node_modules/zone.js/bundles/zone.umd.js:410:56)
    at Zone.Object.<anonymous>.Zone.run (/home/runner/work/clients/clients/node_modules/zone.js/bundles/zone.umd.js:165:47)
    at /home/runner/work/clients/clients/node_modules/zone.js/bundles/zone.umd.js:1314:38
    at _ZoneDelegate.Object.<anonymous>._ZoneDelegate.invokeTask (/home/runner/work/clients/clients/node_modules/zone.js/bundles/zone.umd.js:445:35)
    at ProxyZoneSpec.Object.<anonymous>.ProxyZoneSpec.onInvokeTask (/home/runner/work/clients/clients/node_modules/zone.js/bundles/zone-testing.umd.js:331:43)
    at _ZoneDelegate.Object.<anonymous>._ZoneDelegate.invokeTask (/home/runner/work/clients/clients/node_modules/zone.js/bundles/zone.umd.js:444:64)
    at Zone.Object.<anonymous>.Zone.runTask (/home/runner/work/clients/clients/node_modules/zone.js/bundles/zone.umd.js:210:51)
    at drainMicroTaskQueue (/home/runner/work/clients/clients/node_modules/zone.js/bundles/zone.umd.js:634:39)

Check failure on line 5 in apps/browser/src/autofill/background/overlay.background.spec.ts

View workflow job for this annotation

GitHub Actions / Test Results

OverlayBackground โ–บ OverlayBackground updating the overlay ciphers queries all cipher types, sorts them by last used, and formats them for usage in the overlay โ–บ OverlayBackground updating the overlay ciphers queries all cipher types, sorts them by las...

Failed test found in: junit.xml Error: Error: expect(jest.fn()).toHaveBeenCalledWith(...expected)
Raw output
Error: expect(jest.fn()).toHaveBeenCalledWith(...expected)

Expected: "https://jest-testing-website.com", [3, 4]

Number of calls: 0
    at /home/runner/work/clients/clients/apps/browser/src/autofill/background/overlay.background.spec.ts:842:51
    at Generator.next (<anonymous>)
    at fulfilled (/home/runner/work/clients/clients/apps/browser/src/autofill/background/overlay.background.spec.ts:5:58)
    at _ZoneDelegate.Object.<anonymous>._ZoneDelegate.invoke (/home/runner/work/clients/clients/node_modules/zone.js/bundles/zone.umd.js:411:30)
    at ProxyZoneSpec.Object.<anonymous>.ProxyZoneSpec.onInvoke (/home/runner/work/clients/clients/node_modules/zone.js/bundles/zone-testing.umd.js:300:43)
    at _ZoneDelegate.Object.<anonymous>._ZoneDelegate.invoke (/home/runner/work/clients/clients/node_modules/zone.js/bundles/zone.umd.js:410:56)
    at Zone.Object.<anonymous>.Zone.run (/home/runner/work/clients/clients/node_modules/zone.js/bundles/zone.umd.js:165:47)
    at /home/runner/work/clients/clients/node_modules/zone.js/bundles/zone.umd.js:1314:38
    at _ZoneDelegate.Object.<anonymous>._ZoneDelegate.invokeTask (/home/runner/work/clients/clients/node_modules/zone.js/bundles/zone.umd.js:445:35)
    at ProxyZoneSpec.Object.<anonymous>.ProxyZoneSpec.onInvokeTask (/home/runner/work/clients/clients/node_modules/zone.js/bundles/zone-testing.umd.js:331:43)
    at _ZoneDelegate.Object.<anonymous>._ZoneDelegate.invokeTask (/home/runner/work/clients/clients/node_modules/zone.js/bundles/zone.umd.js:444:64)
    at Zone.Object.<anonymous>.Zone.runTask (/home/runner/work/clients/clients/node_modules/zone.js/bundles/zone.umd.js:210:51)
    at drainMicroTaskQueue (/home/runner/work/clients/clients/node_modules/zone.js/bundles/zone.umd.js:634:39)

Check failure on line 5 in apps/browser/src/autofill/background/overlay.background.spec.ts

View workflow job for this annotation

GitHub Actions / Test Results

OverlayBackground โ–บ OverlayBackground updating the overlay ciphers queries only login ciphers when not updating all cipher types โ–บ OverlayBackground updating the overlay ciphers queries only login ciphers when not updating all cipher types

Failed test found in: junit.xml Error: Error: expect(jest.fn()).toHaveBeenCalledWith(...expected)
Raw output
Error: expect(jest.fn()).toHaveBeenCalledWith(...expected)

Expected: "https://jest-testing-website.com"

Number of calls: 0
    at /home/runner/work/clients/clients/apps/browser/src/autofill/background/overlay.background.spec.ts:864:51
    at Generator.next (<anonymous>)
    at fulfilled (/home/runner/work/clients/clients/apps/browser/src/autofill/background/overlay.background.spec.ts:5:58)
    at _ZoneDelegate.Object.<anonymous>._ZoneDelegate.invoke (/home/runner/work/clients/clients/node_modules/zone.js/bundles/zone.umd.js:411:30)
    at ProxyZoneSpec.Object.<anonymous>.ProxyZoneSpec.onInvoke (/home/runner/work/clients/clients/node_modules/zone.js/bundles/zone-testing.umd.js:300:43)
    at _ZoneDelegate.Object.<anonymous>._ZoneDelegate.invoke (/home/runner/work/clients/clients/node_modules/zone.js/bundles/zone.umd.js:410:56)
    at Zone.Object.<anonymous>.Zone.run (/home/runner/work/clients/clients/node_modules/zone.js/bundles/zone.umd.js:165:47)
    at /home/runner/work/clients/clients/node_modules/zone.js/bundles/zone.umd.js:1314:38
    at _ZoneDelegate.Object.<anonymous>._ZoneDelegate.invokeTask (/home/runner/work/clients/clients/node_modules/zone.js/bundles/zone.umd.js:445:35)
    at ProxyZoneSpec.Object.<anonymous>.ProxyZoneSpec.onInvokeTask (/home/runner/work/clients/clients/node_modules/zone.js/bundles/zone-testing.umd.js:331:43)
    at _ZoneDelegate.Object.<anonymous>._ZoneDelegate.invokeTask (/home/runner/work/clients/clients/node_modules/zone.js/bundles/zone.umd.js:444:64)
    at Zone.Object.<anonymous>.Zone.runTask (/home/runner/work/clients/clients/node_modules/zone.js/bundles/zone.umd.js:210:51)
    at drainMicroTaskQueue (/home/runner/work/clients/clients/node_modules/zone.js/bundles/zone.umd.js:634:39)
import {
AutofillOverlayVisibility,
SHOW_AUTOFILL_BUTTON,
Expand Down Expand Up @@ -36,6 +36,7 @@
import { CipherRepromptType, CipherType } from "@bitwarden/common/vault/enums";
import { CipherView } from "@bitwarden/common/vault/models/view/cipher.view";
import { Fido2CredentialView } from "@bitwarden/common/vault/models/view/fido2-credential.view";
import { PasswordGenerationServiceAbstraction } from "@bitwarden/generator-legacy";

import { BrowserApi } from "../../platform/browser/browser-api";
import { BrowserPlatformUtilsService } from "../../platform/services/platform-utils/browser-platform-utils.service";
Expand All @@ -46,6 +47,7 @@
RedirectFocusDirection,
} from "../enums/autofill-overlay.enum";
import { AutofillService } from "../services/abstractions/autofill.service";
import { InlineMenuFieldQualificationService } from "../services/abstractions/inline-menu-field-qualifications.service";
import {
createAutofillPageDetailsMock,
createChromeTabMock,
Expand Down Expand Up @@ -94,6 +96,8 @@
let vaultSettingsServiceMock: MockProxy<VaultSettingsService>;
let fido2ActiveRequestManager: Fido2ActiveRequestManager;
let selectedThemeMock$: BehaviorSubject<ThemeType>;
let passwordGenerationService: MockProxy<PasswordGenerationServiceAbstraction>;
let inlineMenuFieldQualificationService: MockProxy<InlineMenuFieldQualificationService>;
let themeStateService: MockProxy<ThemeStateService>;
let overlayBackground: OverlayBackground;
let portKeyForTabSpy: Record<number, string>;
Expand Down Expand Up @@ -166,7 +170,9 @@
vaultSettingsServiceMock.enablePasskeys$ = enablePasskeysMock$;
fido2ActiveRequestManager = new Fido2ActiveRequestManager();
selectedThemeMock$ = new BehaviorSubject(ThemeType.Light);
inlineMenuFieldQualificationService = mock<InlineMenuFieldQualificationService>();
themeStateService = mock<ThemeStateService>();
passwordGenerationService = mock<PasswordGenerationServiceAbstraction>();
themeStateService.selectedTheme$ = selectedThemeMock$;
overlayBackground = new OverlayBackground(
logService,
Expand All @@ -180,6 +186,8 @@
platformUtilsService,
vaultSettingsServiceMock,
fido2ActiveRequestManager,
passwordGenerationService,
inlineMenuFieldQualificationService,
themeStateService,
);
portKeyForTabSpy = overlayBackground["portKeyForTab"];
Expand Down Expand Up @@ -922,7 +930,7 @@
it("updates the inline menu list with card ciphers", async () => {
overlayBackground["focusedFieldData"] = createFocusedFieldDataMock({
tabId: tab.id,
filledByCipherType: CipherType.Card,
inlineMenuFillType: CipherType.Card,
});
cipherService.getAllDecryptedForUrl.mockResolvedValue([loginCipher1, cardCipher]);
cipherService.sortCiphersByLastUsedThenName.mockReturnValue(-1);
Expand Down Expand Up @@ -959,7 +967,6 @@
overlayBackground["focusedFieldData"] = createFocusedFieldDataMock({
tabId: tab.id,
accountCreationFieldType: "text",
showInlineMenuAccountCreation: true,
});
cipherService.getAllDecryptedForUrl.mockResolvedValue([identityCipher, cardCipher]);
cipherService.sortCiphersByLastUsedThenName.mockReturnValue(-1);
Expand Down Expand Up @@ -998,7 +1005,6 @@
overlayBackground["focusedFieldData"] = createFocusedFieldDataMock({
tabId: tab.id,
accountCreationFieldType: "text",
showInlineMenuAccountCreation: true,
});
cipherService.getAllDecryptedForUrl.mockResolvedValue([loginCipher1, identityCipher]);
cipherService.sortCiphersByLastUsedThenName.mockReturnValue(-1);
Expand Down Expand Up @@ -1055,7 +1061,6 @@
overlayBackground["focusedFieldData"] = createFocusedFieldDataMock({
tabId: tab.id,
accountCreationFieldType: "email",
showInlineMenuAccountCreation: true,
});
const identityCipherWithoutUsername = mock<CipherView>({
id: "id-5",
Expand Down Expand Up @@ -1107,7 +1112,6 @@
overlayBackground["focusedFieldData"] = createFocusedFieldDataMock({
tabId: tab.id,
accountCreationFieldType: "password",
showInlineMenuAccountCreation: true,
});
cipherService.getAllDecryptedForUrl.mockResolvedValue([identityCipher]);
cipherService.sortCiphersByLastUsedThenName.mockReturnValue(-1);
Expand All @@ -1132,7 +1136,7 @@
);
overlayBackground["focusedFieldData"] = createFocusedFieldDataMock({
tabId: tab.id,
filledByCipherType: CipherType.Login,
inlineMenuFillType: CipherType.Login,
showPasskeys: true,
});
cipherService.getAllDecryptedForUrl.mockResolvedValue([loginCipher1, passkeyCipher]);
Expand Down Expand Up @@ -1215,7 +1219,7 @@
);
overlayBackground["focusedFieldData"] = createFocusedFieldDataMock({
tabId: tab.id,
filledByCipherType: CipherType.Login,
inlineMenuFillType: CipherType.Login,
showPasskeys: true,
});
cipherService.getAllDecryptedForUrl.mockResolvedValue([loginCipher1, passkeyCipher]);
Expand Down Expand Up @@ -1279,7 +1283,7 @@
);
overlayBackground["focusedFieldData"] = createFocusedFieldDataMock({
tabId: tab.id,
filledByCipherType: CipherType.Login,
inlineMenuFillType: CipherType.Login,
showPasskeys: true,
});
cipherService.getAllDecryptedForUrl.mockResolvedValue([loginCipher1, passkeyCipher]);
Expand Down Expand Up @@ -1873,7 +1877,6 @@
const focusedFieldData = createFocusedFieldDataMock({
tabId: tab.id,
frameId: sender.frameId,
showInlineMenuAccountCreation: true,
});

sendMockExtensionMessage({ command: "updateFocusedFieldData", focusedFieldData }, sender);
Expand All @@ -1894,15 +1897,15 @@
const focusedFieldData = createFocusedFieldDataMock({
tabId: tab.id,
frameId: sender.frameId,
filledByCipherType: CipherType.Login,
inlineMenuFillType: CipherType.Login,
});
sendMockExtensionMessage({ command: "updateFocusedFieldData", focusedFieldData }, sender);
await flushPromises();

const newFocusedFieldData = createFocusedFieldDataMock({
tabId: tab.id,
frameId: sender.frameId,
filledByCipherType: CipherType.Card,
inlineMenuFillType: CipherType.Card,
});
sendMockExtensionMessage(
{ command: "updateFocusedFieldData", focusedFieldData: newFocusedFieldData },
Expand Down
Loading
Loading