-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathotp-register.test.ts
More file actions
45 lines (37 loc) · 1.54 KB
/
otp-register.test.ts
File metadata and controls
45 lines (37 loc) · 1.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/*
* Copyright (c) 2025 Ping Identity Corporation. All rights reserved.
*
* This software may be modified and distributed under the terms
* of the MIT license. See the LICENSE file for details.
*/
import { expect, test } from '@forgerock/e2e-shared/coverage-fixture';
import { asyncEvents } from './utils/async-events.js';
import { username, password } from './utils/demo-user.js';
test('Test happy paths on test page', async ({ page }) => {
const { clickButton, navigate } = asyncEvents(page);
await navigate('/?journey=TEST_OTPRegistration&clientId=tenant');
const messageArray: string[] = [];
// Listen for events on page
page.on('console', async (msg) => {
messageArray.push(msg.text());
return Promise.resolve(true);
});
// Perform basic login
await page.getByLabel('User Name').fill(username);
await page.getByLabel('Password').fill(password);
await clickButton('Submit', '/authenticate');
await expect(() => expect(page.getByText('Scan the QR code')).toBeVisible()).toPass();
// Test assertions
expect(
messageArray.includes(
'Scan the QR code image below with the ForgeRock Authenticator app to register your device with your login.',
),
).toBe(true);
// TODO: Use when AM Mock API is available
// expect(
// messageArray.includes(
// 'otpauth://totp/ForgeRock:jlowery?secret=QITSTC234FRIU8DD987DW3VPICFY======&issuer=ForgeRock&period=30&digits=6&b=032b75',
// ),
// ).toBe(true);
// expect(messageArray.includes('Basic login with OTP registration step successful')).toBe(true);
});