From 1d5ca7ea33faa162a50f6c052a1a2fabffc14913 Mon Sep 17 00:00:00 2001 From: Emanuele Feliziani Date: Tue, 9 Apr 2024 16:51:46 +0200 Subject: [PATCH] Fix regression Signed-off-by: Emanuele Feliziani --- dist/autofill-debug.js | 14 ++++++++++++ dist/autofill.js | 14 ++++++++++++ integration-test/helpers/pages/overlayPage.js | 5 +++++ .../tests/login-form.macos.spec.js | 22 ++++++++++++++----- src/DeviceInterface/AppleDeviceInterface.js | 14 ++++++++++++ .../Resources/assets/autofill-debug.js | 14 ++++++++++++ swift-package/Resources/assets/autofill.js | 14 ++++++++++++ 7 files changed, 92 insertions(+), 5 deletions(-) diff --git a/dist/autofill-debug.js b/dist/autofill-debug.js index 6b70fcfde..be56d3928 100644 --- a/dist/autofill-debug.js +++ b/dist/autofill-debug.js @@ -7984,6 +7984,20 @@ class AppleDeviceInterface extends _InterfacePrototype.default { return this.deviceApi.notify((0, _index.createNotification)('pmHandlerOpenManagePasswords')); } + /** + * Opens the native UI for managing identities + */ + openManageIdentities() { + return this.deviceApi.notify((0, _index.createNotification)('pmHandlerOpenManageIdentities')); + } + + /** + * Opens the native UI for managing credit cards + */ + openManageCreditCards() { + return this.deviceApi.notify((0, _index.createNotification)('pmHandlerOpenManageCreditCards')); + } + /** * Gets a single identity obj once the user requests it * @param {IdentityObject['id']} id diff --git a/dist/autofill.js b/dist/autofill.js index f60ff49df..c3eb2099f 100644 --- a/dist/autofill.js +++ b/dist/autofill.js @@ -3818,6 +3818,20 @@ class AppleDeviceInterface extends _InterfacePrototype.default { return this.deviceApi.notify((0, _index.createNotification)('pmHandlerOpenManagePasswords')); } + /** + * Opens the native UI for managing identities + */ + openManageIdentities() { + return this.deviceApi.notify((0, _index.createNotification)('pmHandlerOpenManageIdentities')); + } + + /** + * Opens the native UI for managing credit cards + */ + openManageCreditCards() { + return this.deviceApi.notify((0, _index.createNotification)('pmHandlerOpenManageCreditCards')); + } + /** * Gets a single identity obj once the user requests it * @param {IdentityObject['id']} id diff --git a/integration-test/helpers/pages/overlayPage.js b/integration-test/helpers/pages/overlayPage.js index 6d0ef5dce..9c4454ab3 100644 --- a/integration-test/helpers/pages/overlayPage.js +++ b/integration-test/helpers/pages/overlayPage.js @@ -52,6 +52,11 @@ export function overlayPage (page) { const button = await page.locator(`button:has-text("${text}")`) await expect(button).toHaveCount(0) } + + async assertCallHappenedTimes (callName, times) { + const calls = await mockedCalls(page, {names: [callName]}) + expect(calls.length).toBe(times) + } } return new OverlayPage() diff --git a/integration-test/tests/login-form.macos.spec.js b/integration-test/tests/login-form.macos.spec.js index 94917b109..5764294f5 100644 --- a/integration-test/tests/login-form.macos.spec.js +++ b/integration-test/tests/login-form.macos.spec.js @@ -355,18 +355,21 @@ test.describe('Auto-fill a login form on macOS', () => { username: personalAddress, password }, - expectedLabel: 'Manage passwords…' + expectedLabel: 'Manage passwords…', + expectedCall: 'pmHandlerOpenManagePasswords' }, { description: 'with identities', identity: constants.fields.identity, - expectedLabel: 'Manage identities…' + expectedLabel: 'Manage identities…', + expectedCall: 'pmHandlerOpenManageIdentities' }, { description: 'with identities and Email Protection', identity: constants.fields.identity, emailProtection: {personalAddress, privateAddress}, - expectedLabel: 'Manage identities…' + expectedLabel: 'Manage identities…', + expectedCall: 'pmHandlerOpenManageIdentities' }, { description: 'with Email Protection and no identities should not show', @@ -376,12 +379,20 @@ test.describe('Auto-fill a login form on macOS', () => { { description: 'with credit card', creditCard: constants.fields.creditCard, - expectedLabel: 'Manage credit cards…' + expectedLabel: 'Manage credit cards…', + expectedCall: 'pmHandlerOpenManageCreditCards' } ] for (const testCase of testCases) { - const {description, credentials, identity, creditCard, expectedLabel} = testCase + const { + description, + credentials, + identity, + creditCard, + expectedLabel, + expectedCall + } = testCase test(description, async ({page}) => { await forwardConsoleMessages(page) await createWebkitMocks() @@ -401,6 +412,7 @@ test.describe('Auto-fill a login form on macOS', () => { if (expectedLabel) { await overlay.clickButtonWithText(expectedLabel) await overlay.assertCloseAutofillParent() + await overlay.assertCallHappenedTimes(expectedCall, 1) } else { await overlay.assertTextNotPresent('Manage') } diff --git a/src/DeviceInterface/AppleDeviceInterface.js b/src/DeviceInterface/AppleDeviceInterface.js index d1befe6fc..da5cee9ae 100644 --- a/src/DeviceInterface/AppleDeviceInterface.js +++ b/src/DeviceInterface/AppleDeviceInterface.js @@ -217,6 +217,20 @@ class AppleDeviceInterface extends InterfacePrototype { return this.deviceApi.notify(createNotification('pmHandlerOpenManagePasswords')) } + /** + * Opens the native UI for managing identities + */ + openManageIdentities () { + return this.deviceApi.notify(createNotification('pmHandlerOpenManageIdentities')) + } + + /** + * Opens the native UI for managing credit cards + */ + openManageCreditCards () { + return this.deviceApi.notify(createNotification('pmHandlerOpenManageCreditCards')) + } + /** * Gets a single identity obj once the user requests it * @param {IdentityObject['id']} id diff --git a/swift-package/Resources/assets/autofill-debug.js b/swift-package/Resources/assets/autofill-debug.js index 6b70fcfde..be56d3928 100644 --- a/swift-package/Resources/assets/autofill-debug.js +++ b/swift-package/Resources/assets/autofill-debug.js @@ -7984,6 +7984,20 @@ class AppleDeviceInterface extends _InterfacePrototype.default { return this.deviceApi.notify((0, _index.createNotification)('pmHandlerOpenManagePasswords')); } + /** + * Opens the native UI for managing identities + */ + openManageIdentities() { + return this.deviceApi.notify((0, _index.createNotification)('pmHandlerOpenManageIdentities')); + } + + /** + * Opens the native UI for managing credit cards + */ + openManageCreditCards() { + return this.deviceApi.notify((0, _index.createNotification)('pmHandlerOpenManageCreditCards')); + } + /** * Gets a single identity obj once the user requests it * @param {IdentityObject['id']} id diff --git a/swift-package/Resources/assets/autofill.js b/swift-package/Resources/assets/autofill.js index f60ff49df..c3eb2099f 100644 --- a/swift-package/Resources/assets/autofill.js +++ b/swift-package/Resources/assets/autofill.js @@ -3818,6 +3818,20 @@ class AppleDeviceInterface extends _InterfacePrototype.default { return this.deviceApi.notify((0, _index.createNotification)('pmHandlerOpenManagePasswords')); } + /** + * Opens the native UI for managing identities + */ + openManageIdentities() { + return this.deviceApi.notify((0, _index.createNotification)('pmHandlerOpenManageIdentities')); + } + + /** + * Opens the native UI for managing credit cards + */ + openManageCreditCards() { + return this.deviceApi.notify((0, _index.createNotification)('pmHandlerOpenManageCreditCards')); + } + /** * Gets a single identity obj once the user requests it * @param {IdentityObject['id']} id