Skip to content
Merged
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
73 changes: 37 additions & 36 deletions packages/functional-tests/tests/misc/vpnIntegration.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,40 +10,41 @@ import {
} from '../../lib/query-params';

test.describe('vpn integration', () => {
test('authorization flow - user already signed into Firefox', async ({
syncOAuthBrowserPages: { page, signin },
testAccountTracker,
}) => {
const { email, password } = await testAccountTracker.signUp();

// First, sign into Sync with Fenix (Android) client ID
await signin.goto('/authorization', syncMobileOAuthFenixQueryParams);
await signin.fillOutEmailFirstForm(email);
await signin.fillOutPasswordForm(password);

// Wait for Sync sign-in to complete, then clear events for the
// VPN scope check later in the test
await signin.checkWebChannelMessage(FirefoxCommand.OAuthLogin);
await signin.clearWebChannelEvents();

// Now navigate to VPN authorization — user is already signed into Firefox
await signin.goto('/authorization', vpnMobileOAuthQueryParams);

// User is already signed in — cached signin view, no password required
await expect(signin.cachedSigninHeading).toBeVisible();
await expect(page.getByText(email)).toBeVisible();

await signin.signInButton.click();

// Verify fxaOAuthLogin was sent with VPN scopes
await signin.checkWebChannelMessageScopes(
FirefoxCommand.OAuthLogin,
'https://identity.mozilla.com/apps/vpn'
);

// Verify services data includes vpn
await signin.checkWebChannelMessageServices(FirefoxCommand.Login, {
vpn: {},
});
});
// Disabled while we investigate the flaky cached-signin -> WebChannel race.
test.fixme(
'authorization flow - user already signed into Firefox',
async ({ syncOAuthBrowserPages: { page, signin }, testAccountTracker }) => {
const { email, password } = await testAccountTracker.signUp();

// First, sign into Sync with Fenix (Android) client ID
await signin.goto('/authorization', syncMobileOAuthFenixQueryParams);
await signin.fillOutEmailFirstForm(email);
await signin.fillOutPasswordForm(password);

// Wait for Sync sign-in to complete, then clear events for the
// VPN scope check later in the test
await signin.checkWebChannelMessage(FirefoxCommand.OAuthLogin);
await signin.clearWebChannelEvents();

// Now navigate to VPN authorization — user is already signed into Firefox
await signin.goto('/authorization', vpnMobileOAuthQueryParams);

// User is already signed in — cached signin view, no password required
await expect(signin.cachedSigninHeading).toBeVisible();
await expect(page.getByText(email)).toBeVisible();

await signin.signInButton.click();

// Verify fxaOAuthLogin was sent with VPN scopes
await signin.checkWebChannelMessageScopes(
FirefoxCommand.OAuthLogin,
'https://identity.mozilla.com/apps/vpn'
);

// Verify services data includes vpn
await signin.checkWebChannelMessageServices(FirefoxCommand.Login, {
vpn: {},
});
}
);
});