Skip to content

Commit 62b760e

Browse files
Fix: [AEA-5721] - Add testid to session logged out and session selection (#1385)
## Summary - Routine Change ### Details Add required testids to session logged out and session selection page, so that the regression tests can assert against elements. --------- Signed-off-by: Connor Avery <[email protected]>
1 parent 848d27d commit 62b760e

File tree

2 files changed

+22
-17
lines changed

2 files changed

+22
-17
lines changed

packages/cpt-ui/src/pages/SessionLoggedOut.tsx

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,35 +9,37 @@ export default function SessionLoggedOutPage() {
99

1010
if (auth.invalidSessionCause === "ConcurrentSession") {
1111
return (
12-
<main id="main-content" className="nhsuk-main-wrapper">
12+
<main id="main-content" className="nhsuk-main-wrapper" data-testid="session-logged-out-concurrent">
1313
<Container>
1414
<Row>
1515
<Col width="full">
16-
<h1>You have been logged out</h1>
17-
<p>We have logged you out because you started another session in a new window or browser.</p>
18-
<p>
16+
<h1 data-testid="concurrent-title">You have been logged out</h1>
17+
<p data-testid="concurrent-description">
18+
We have logged you out because you started another session in a new window or browser.</p>
19+
<p data-testid="concurrent-contact">
1920
Contact the NHS national service desk at{" "}
20-
<a href="mailto:[email protected]">
21+
<a href="mailto:[email protected]" data-testid="nhs-service-desk-email">
2122
2223
</a>{" "}
2324
if you did not start another session in another window or browser.
2425
</p>
25-
<Link to="/login">{EpsLogoutStrings.login_link}</Link>
26+
<Link to="/login" data-testid="login-link">{EpsLogoutStrings.login_link}</Link>
2627
</Col>
2728
</Row>
2829
</Container>
2930
</main>
3031
)
3132
}
3233
return (
33-
<main id="main-content" className="nhsuk-main-wrapper">
34+
<main id="main-content" className="nhsuk-main-wrapper" data-testid="session-logged-out-timeout">
3435
<Container>
3536
<Row>
3637
<Col width="full">
37-
<h1>For your security, we have logged you out</h1>
38-
<p>We have logged you out because you did not do anything for 15 minutes.</p>
39-
<p>This is to protect patient information.</p>
40-
<Link to="/login">{EpsLogoutStrings.login_link}</Link>
38+
<h1 data-testid="timeout-title">For your security, we have logged you out</h1>
39+
<p data-testid="timeout-description">
40+
We have logged you out because you did not do anything for 15 minutes.</p>
41+
<p data-testid="timeout-description2">This is to protect patient information.</p>
42+
<Link to="/login" data-testid="login-link">{EpsLogoutStrings.login_link}</Link>
4143
</Col>
4244
</Row>
4345
</Container>

packages/cpt-ui/src/pages/SessionSelection.tsx

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,22 +40,25 @@ export default function SessionSelectionPage() {
4040
// TODO: In the future, if error state from session management API,
4141
// draw banner item or full page content to describe to user.
4242
return (
43-
<main id="main-content" className="nhsuk-main-wrapper">
43+
<main id="main-content" className="nhsuk-main-wrapper" data-testid="session-selection-page">
4444
<Container>
4545
<Row>
4646
<Col width="full">
47-
<h1>You are already logged in to the Prescription Tracker</h1>
48-
<p>There is a session using these login details in another browser, window or device.</p>
49-
<p>You can continue to start a new session in this window, but this will end the other session.</p>
47+
<h1 data-testid="title">You are already logged in to the Prescription Tracker</h1>
48+
<p data-testid="description">
49+
There is a session using these login details in another browser, window or device.</p>
50+
<p data-testid="instructions">
51+
You can continue to start a new session in this window, but this will end the other session.</p>
5052
</Col>
5153
</Row>
5254

5355
<Row>
5456
<Col width="full">
5557
<Button id="create-a-new-session" style={{margin: "8px"}} className="nhsuk-button"
56-
onClick={setSession} disabled={startNewSessionClicked}>Start a new session</Button>
58+
onClick={setSession} disabled={startNewSessionClicked} data-testid="new-session-button">
59+
Start a new session</Button>
5760
<Button id="close-this-window" style={{margin: "8px"}} className="nhsuk-button nhsuk-button--secondary"
58-
onClick={logout}>Close this window</Button>
61+
onClick={logout} data-testid="close-window-button">Close this window</Button>
5962
</Col>
6063
</Row>
6164
</Container>

0 commit comments

Comments
 (0)