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

Fix regression #549

Merged
merged 1 commit into from
Apr 9, 2024
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions dist/autofill-debug.js

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

14 changes: 14 additions & 0 deletions dist/autofill.js

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

5 changes: 5 additions & 0 deletions integration-test/helpers/pages/overlayPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
22 changes: 17 additions & 5 deletions integration-test/tests/login-form.macos.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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()
Expand All @@ -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)
Copy link
Member Author

Choose a reason for hiding this comment

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

Asserting the call will prevent regressions in the future.

} else {
await overlay.assertTextNotPresent('Manage')
}
Expand Down
14 changes: 14 additions & 0 deletions src/DeviceInterface/AppleDeviceInterface.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'))
}

Copy link
Member Author

Choose a reason for hiding this comment

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

We'd removed these in #252 but never added them back 🙃.

/**
* Gets a single identity obj once the user requests it
* @param {IdentityObject['id']} id
Expand Down
14 changes: 14 additions & 0 deletions swift-package/Resources/assets/autofill-debug.js

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

14 changes: 14 additions & 0 deletions swift-package/Resources/assets/autofill.js

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

Loading