Skip to content

Commit eb97038

Browse files
committed
rebase
1 parent 2dbaf0f commit eb97038

File tree

8 files changed

+631
-2797
lines changed

8 files changed

+631
-2797
lines changed

dist/autofill-debug.js

Lines changed: 132 additions & 1249 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/autofill.js

Lines changed: 95 additions & 1208 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

integration-test/helpers/mocks.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ export const constants = {
2020
loginWithPoorForm: `${localPagesPrefix}/login-poor-form.html`,
2121
loginWithText: `${localPagesPrefix}/login-with-text.html`,
2222
loginWithFormInModal: `${privacyTestPagesPrefix}/autoprompt/2-form-in-modal.html`,
23+
loginWithIdentity: `${privacyTestPagesPrefix}/login-with-identity.html`,
2324
signupWithFormInModal: `${localPagesPrefix}/signup-in-modal.html`,
2425
loginCovered: `${localPagesPrefix}/login-covered.html`,
2526
loginMultistep: `${privacyTestPagesPrefix}/autoprompt/3-multistep-form.html`,
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
import { constants } from '../mocks.js';
2+
import { expect } from '@playwright/test';
3+
4+
/**
5+
* A wrapper around interactions for the login-with-identity.html page
6+
* This page contains first name, last name, email, and password fields
7+
*
8+
* @param {import("@playwright/test").Page} page
9+
*/
10+
export function loginWithIdentityPage(page) {
11+
class LoginWithIdentityPage {
12+
/**
13+
* Navigate to the loginWithIdentity page
14+
* @return {Promise<void>}
15+
*/
16+
async navigate(to = 'loginWithIdentity') {
17+
await page.goto(constants.pages[to]);
18+
}
19+
20+
async clickIntoFirstNameInput() {
21+
const firstNameField = page.locator('#first-name').first();
22+
await firstNameField.click();
23+
}
24+
25+
async clickIntoUsernameInput() {
26+
const emailField = page.locator('#login-email').first();
27+
await emailField.click();
28+
}
29+
30+
async credentialsImportPromptIsNotShown() {
31+
await page
32+
.locator(`button:has-text("Import passwords to DuckDuckGo")`)
33+
.isVisible()
34+
.then((isVisible) => {
35+
expect(isVisible).toBe(false);
36+
});
37+
}
38+
39+
async credentialsImportPromptIsShown() {
40+
await page
41+
.locator(`button:has-text("Import passwords to DuckDuckGo")`)
42+
.isVisible()
43+
.then((isVisible) => {
44+
expect(isVisible).toBe(true);
45+
});
46+
}
47+
}
48+
49+
return new LoginWithIdentityPage();
50+
}

integration-test/tests/credentials-import.macos.spec.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,37 @@ import { expect, test as base } from '@playwright/test';
55
import { loginPage } from '../helpers/pages/loginPage.js';
66
import { overlayPage } from '../helpers/pages/overlayPage.js';
77
import { signupPage } from '../helpers/pages/signupPage.js';
8+
import { loginWithIdentityPage } from '../helpers/pages/loginWithIdentityPage.js';
89

910
/**
1011
* Tests for credentials import promotion prompt on macos
1112
*/
1213
const test = base.extend({});
1314

1415
test.describe('Import credentials prompt', () => {
16+
test('when credentialsImport is true, input is identities.firstName, credentials import prompt is not shown', async ({ page }) => {
17+
// enable in-terminal exceptions
18+
await forwardConsoleMessages(page);
19+
20+
await createWebkitMocks()
21+
.withAvailableInputTypes(
22+
createAvailableInputTypes({
23+
credentialsImport: true,
24+
}),
25+
)
26+
.applyTo(page);
27+
28+
// Load the autofill.js script with replacements
29+
await createAutofillScript().replaceAll(macosContentScopeReplacements()).platform('macos').applyTo(page);
30+
31+
const login = loginWithIdentityPage(page);
32+
await login.navigate();
33+
await login.clickIntoFirstNameInput();
34+
await login.credentialsImportPromptIsNotShown();
35+
await login.clickIntoUsernameInput();
36+
await login.credentialsImportPromptIsShown();
37+
});
38+
1539
test('when availableInputTypes is set for credentials import, credentials import prompt is shown', async ({ page }) => {
1640
// enable in-terminal exceptions
1741
await forwardConsoleMessages(page);

0 commit comments

Comments
 (0)