Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { SettingsPage } from '../../pages/settings';
import { SettingsPasskeyAddPage } from '../../pages/settings/passkey';
import { SigninPage } from '../../pages/signin';
import { enableTotpOnAccount } from '../../lib/pairing-helpers';
import { EmailType } from '../../lib/email';

test.describe('severity-1 #smoke', () => {
test.describe('passkey sign-in', () => {
Expand All @@ -35,7 +36,7 @@ test.describe('severity-1 #smoke', () => {
pages: { page, settings, settingsPasskeyAdd, signin },
testAccountTracker,
}) => {
await setUpAccountWithPasskey({
const { email } = await setUpAccountWithPasskey({
target,
page,
settings,
Expand All @@ -44,6 +45,8 @@ test.describe('severity-1 #smoke', () => {
testAccountTracker,
});
await clearSession(page);
// Isolate the sign-in email from setup emails.
await target.emailClient.clear(email);
await page.goto(target.contentServerUrl);

await settingsPasskeyAdd.passkeyAuth.assertion(async () => {
Expand All @@ -52,6 +55,14 @@ test.describe('severity-1 #smoke', () => {
});

await expect(settings.settingsHeading).toBeVisible();

const newDeviceLogin = await target.emailClient.waitForEmail(
email,
EmailType.newDeviceLogin
);
expect(newDeviceLogin.subject).toMatch(
/new sign-in to your mozilla account/i
);
});

test('signs in with a registered passkey from /signin after submitting an email', async ({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { FirefoxCommand } from '../../lib/channels';
import { syncDesktopOAuthQueryParams } from '../../lib/query-params';
import { enableTotpOnAccount } from '../../lib/pairing-helpers';
import { OLDSYNC_SCOPE } from '../../lib/scopes';
import { EmailType } from '../../lib/email';

test.describe('severity-1 #smoke', () => {
test.describe('Sync passkey signin with password fallback', () => {
Expand Down Expand Up @@ -55,6 +56,8 @@ test.describe('severity-1 #smoke', () => {

// The polyfill credential survives signOut via page.addInitScript.
await settings.signOut();
// Isolate the sign-in email from setup emails.
await target.emailClient.clear(email);

// Returning user picks passkey; service=sync routes to the fallback.
await signin.goto('/authorization', syncDesktopOAuthQueryParams);
Expand All @@ -76,6 +79,14 @@ test.describe('severity-1 #smoke', () => {
FirefoxCommand.OAuthLogin,
OLDSYNC_SCOPE
);

const newDeviceLogin = await target.emailClient.waitForEmail(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for updating functional test

email,
EmailType.newDeviceLogin
);
expect(newDeviceLogin.subject).toMatch(
/new sign-in to your mozilla account/i
);
});

test('shows an error banner when the password is wrong', async ({
Expand Down
6 changes: 5 additions & 1 deletion packages/fxa-auth-client/lib/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3607,17 +3607,21 @@ export default class AuthClient {
async completePasskeyAuthentication(
response: PublicKeyCredentialJSON,
challenge: string,
options: { service?: string } = {},
options: { service?: string; metricsContext?: MetricsContext } = {},
headers?: Headers
): Promise<PasskeyAuthenticationResult> {
const payload: {
response: PublicKeyCredentialJSON;
challenge: string;
service?: string;
metricsContext?: MetricsContext;
} = {
response,
challenge,
...(options.service ? { service: options.service } : {}),
...(options.metricsContext
? { metricsContext: options.metricsContext }
: {}),
};

return this.request(
Expand Down
10 changes: 9 additions & 1 deletion packages/fxa-auth-server/lib/routes/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,15 @@ module.exports = function (
const mfa = mfaRoutes(customs, db, log, mailer, statsd, config);

const { passkeyRoutes } = require('./passkeys');
const passkeys = passkeyRoutes(customs, db, config, statsd, glean, log);
const passkeys = passkeyRoutes(
customs,
db,
config,
statsd,
glean,
log,
mailer
);

const { passwordlessRoutes } = require('./passwordless');
const passwordless = passwordlessRoutes(
Expand Down
Loading
Loading