-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathlogout.spec.ts
More file actions
84 lines (66 loc) · 2.5 KB
/
logout.spec.ts
File metadata and controls
84 lines (66 loc) · 2.5 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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
/*
*
* Copyright © 2025 Ping Identity Corporation. All right reserved.
*
* This software may be modified and distributed under the terms
* of the MIT license. See the LICENSE file for details.
*
*/
import { test, expect } from '@forgerock/e2e-shared/coverage-fixture';
import {
pingAmUsername,
pingAmPassword,
pingOneUsername,
pingOnePassword,
} from './utils/demo-users.js';
import { asyncEvents } from './utils/async-events.js';
test.describe('Logout tests', () => {
test('PingAM login then logout', async ({ page }) => {
const { clickButton, clickWithRedirect, navigate } = asyncEvents(page);
await navigate('/ping-am/');
let endSessionStatus, revokeStatus;
page.on('response', (response) => {
const responseUrl = response.url();
const status = response.ok();
if (responseUrl.includes('/endSession?id_token_hint')) {
endSessionStatus = status;
}
if (responseUrl.includes('/revoke')) {
revokeStatus = status;
}
});
await clickWithRedirect('Login (Background)', '**/am/XUI/**');
await page.getByLabel('User Name').fill(pingAmUsername);
await page.getByRole('textbox', { name: 'Password' }).fill(pingAmPassword);
await clickWithRedirect('Next', 'http://localhost:8443/ping-am/**');
expect(page.url()).toContain('code');
expect(page.url()).toContain('state');
await clickButton('Logout', '/revoke');
expect(endSessionStatus).toBeTruthy();
expect(revokeStatus).toBeTruthy();
});
test('PingOne login then logout', async ({ page }) => {
const { clickButton, clickWithRedirect, navigate } = asyncEvents(page);
await navigate('/ping-one/');
let endSessionStatus, revokeStatus;
page.on('response', (response) => {
const responseUrl = response.url();
const status = response.ok();
if (responseUrl.includes('/as/idpSignoff?id_token_hint')) {
endSessionStatus = status;
}
if (responseUrl.includes('/revoke')) {
revokeStatus = status;
}
});
await clickWithRedirect('Login (Background)', '**/signon/**');
await page.getByLabel('Username').fill(pingOneUsername);
await page.getByRole('textbox', { name: 'Password' }).fill(pingOnePassword);
await clickWithRedirect('Sign On', 'http://localhost:8443/ping-one/**');
expect(page.url()).toContain('code');
expect(page.url()).toContain('state');
await clickButton('Logout', '/revoke');
expect(endSessionStatus).toBeTruthy();
expect(revokeStatus).toBeTruthy();
});
});