Skip to content

Commit 364ee35

Browse files
e2e update (#188)
1 parent be5d0cd commit 364ee35

File tree

20 files changed

+165
-33
lines changed

20 files changed

+165
-33
lines changed

webnext/messages/en.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"cmp_enrol_final": "Final step",
2222
"cmp_openid_button": "Sign in with {provider}",
2323
"cmp_copy_field_tooltip": "Copied",
24-
"footer_contact": "If you need assistance, please contact your defguard administrator at",
24+
"footer_contact": "If you need assistance, please contact your defguard administrator at.",
2525
"start_footer_copyright": "Copyright ©2023-{currentYear} Defguard Sp. z o.o.",
2626
"start_multi_title": "Get Started with Defguard",
2727
"start_multi_subtitle": "Please select the option that suits your needs.",

webnext/src/pages/ClientDownload/ClientDownloadPage.tsx

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import './style.scss';
22
import { useQuery } from '@tanstack/react-query';
3-
import { useNavigate } from '@tanstack/react-router';
3+
import { type RouterState, useNavigate, useRouterState } from '@tanstack/react-router';
44
import { useMemo, useState } from 'react';
55
import { m } from '../../paraglide/messages';
66
import { AppleHelpModal } from '../../shared/components/AppleHelpModal/AppleHelpModal';
@@ -27,6 +27,7 @@ import desktopIcon from './assets/pc-tower.png';
2727

2828
export const ClientDownloadPage = () => {
2929
const { data: pageData } = useQuery(getClientArtifactsQueryOptions);
30+
const routerLoading = useRouterState({ select: (s: RouterState) => s.isLoading });
3031

3132
const navigate = useNavigate();
3233

@@ -172,18 +173,25 @@ export const ClientDownloadPage = () => {
172173
title={m.client_download_modal_title()}
173174
size="small"
174175
isOpen={confirmModalOpen}
175-
onClose={() => {
176-
setConfirmModalOpen(false);
177-
}}
176+
onClose={
177+
!routerLoading
178+
? () => {
179+
setConfirmModalOpen(false);
180+
}
181+
: undefined
182+
}
178183
>
179184
<p>{m.client_download_modal_content()}</p>
180185
<ModalControls
181186
cancelProps={{
182187
text: m.client_download_modal_cancel(),
183188
onClick: () => setConfirmModalOpen(false),
189+
disabled: routerLoading,
184190
}}
185191
submitProps={{
186192
text: m.controls_continue(),
193+
testId: 'modal-confirm-download-submit',
194+
loading: routerLoading,
187195
onClick: () => {
188196
navigate({
189197
to: '/enrollment-start',

webnext/src/pages/Home/components/HomeChoice.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ export const HomeChoice = () => {
1717
<div id="home-choice">
1818
<Card
1919
img="enroll"
20+
testId="start-enrollment"
2021
title={m.start_multi_enrollment_title()}
2122
subtitle={m.start_multi_enrollment_subtitle()}
2223
buttonText={m.start_multi_enrollment_button()}
@@ -26,6 +27,7 @@ export const HomeChoice = () => {
2627
/>
2728
<Card
2829
img="password"
30+
testId="start-password-reset"
2931
title={m.start_multi_password_title()}
3032
subtitle={m.start_multi_password_subtitle()}
3133
buttonText={m.start_multi_password_button()}
@@ -45,6 +47,7 @@ type CardProps = {
4547
subtitle: string;
4648
title: string;
4749
card?: boolean;
50+
testId?: string;
4851
onClick: () => void;
4952
};
5053

@@ -53,9 +56,10 @@ const Card = ({
5356
buttonText,
5457
subtitle,
5558
title,
56-
onClick,
5759
link,
5860
img,
61+
testId,
62+
onClick,
5963
}: CardProps) => {
6064
return (
6165
<div className={clsx('choice')}>
@@ -78,7 +82,7 @@ const Card = ({
7882
<SizedBox height={ThemeSpacing.Md} />
7983
<p className="subtitle">{subtitle}</p>
8084
<SizedBox height={ThemeSpacing.Xl2} />
81-
<Link to={link}>
85+
<Link to={link} data-testId={testId}>
8286
<Button
8387
size="primary"
8488
variant="primary"

webnext/src/pages/PasswordForm/PasswordFormPage.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ export const PasswordFormPage = () => {
153153
<h1>{m.password_form_title()}</h1>
154154
<p>{m.password_form_subtitle()}</p>
155155
</header>
156-
<SizedBox height={ThemeSpacing.Xl5} />
156+
<SizedBox height={ThemeSpacing.Xl3} />
157157
<Container>
158158
<form
159159
onSubmit={(e) => {
@@ -188,6 +188,7 @@ export const PasswordFormPage = () => {
188188
</form.AppField>
189189
<CheckList form={form} />
190190
<Button
191+
testId="form-submit"
191192
size="big"
192193
type="submit"
193194
text={m.password_form_submit()}

webnext/src/pages/PasswordStart/PasswordStartPage.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { z } from 'zod';
22
import { m } from '../../paraglide/messages';
33
import { Container } from '../../shared/components/Container/Container';
44
import { Page } from '../../shared/components/Page/Page';
5-
import { EnrollmentStep } from '../../shared/components/Step/Step';
65
import { SizedBox } from '../../shared/defguard-ui/components/SizedBox/SizedBox';
76
import { ThemeSpacing } from '../../shared/defguard-ui/types';
87

@@ -58,12 +57,11 @@ export const PasswordStartPage = () => {
5857

5958
return (
6059
<Page id="password-start-page" variant="default" nav>
61-
<EnrollmentStep current={0} max={1} />
6260
<header>
6361
<h1>{m.password_start_title()}</h1>
6462
<p>{m.password_start_subtitle()}</p>
6563
</header>
66-
<SizedBox height={ThemeSpacing.Xl5} />
64+
<SizedBox height={ThemeSpacing.Xl3} />
6765
<Container>
6866
<p>{m.password_start_form_explain()}</p>
6967
<form.AppForm>

webnext/src/pages/enrollment/ConfigureClient/ConfigureClientPage.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ export const ConfigureClientPage = () => {
119119
<h1>{m.client_setup_title()}</h1>
120120
<p>{m.client_setup_subtitle()}</p>
121121
</header>
122-
<SizedBox height={ThemeSpacing.Xl5} />
122+
<SizedBox height={ThemeSpacing.Xl3} />
123123
<ContainerWithIcon icon="desktop" id="setup-desktop">
124124
<header>
125125
<h5>{m.client_setup_desktop_title()}</h5>
@@ -129,6 +129,7 @@ export const ConfigureClientPage = () => {
129129
<span>{m.client_setup_desktop_auto_explain_2()}</span>
130130
</p>
131131
</header>
132+
<SizedBox height={ThemeSpacing.Xl} />
132133
<div className="buttons">
133134
<a href={deepLink()} target="_blank">
134135
<Button
@@ -173,7 +174,7 @@ export const ConfigureClientPage = () => {
173174
<Icon icon="config" />
174175
<span>
175176
{m.client_setup_desktop_manual_fold({
176-
intent: m.controls_show(),
177+
intent: manualOpen ? m.controls_hide() : m.controls_show(),
177178
})}
178179
</span>
179180
</button>

webnext/src/pages/enrollment/ConfigureClient/style.scss

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@
99
}
1010

1111
footer {
12+
margin-top: auto;
13+
1214
p {
1315
text-align: center;
14-
font: var(--t-body-xs-500);
15-
color: var(--fg-muted);
16+
}
1617

17-
&.finish {
18-
color: var(--fg-success);
19-
padding-bottom: var(--spacing-sm);
20-
}
18+
.finish {
19+
color: var(--fg-success);
20+
padding-bottom: var(--spacing-sm);
2121
}
2222
}
2323
}

webnext/src/pages/enrollment/EnrollmentStart/EnrollmentStartPage.tsx

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ import { revalidateLogic } from '@tanstack/react-form';
1010
import type { AxiosError } from 'axios';
1111
import z from 'zod';
1212
import { api } from '../../../shared/api/api';
13-
import { Button } from '../../../shared/defguard-ui/components/Button/Button';
1413
import { SizedBox } from '../../../shared/defguard-ui/components/SizedBox/SizedBox';
14+
import { OIDCButton } from '../../../shared/defguard-ui/components/SSOButton/OIDCButton';
1515
import { useAppForm } from '../../../shared/defguard-ui/form';
1616
import { ThemeSpacing } from '../../../shared/defguard-ui/types';
1717
import { isPresent } from '../../../shared/defguard-ui/utils/isPresent';
@@ -86,7 +86,7 @@ export const EnrollmentStartPage = () => {
8686
<h1>{m.enrollment_start_title()}</h1>
8787
<p>{m.enrollment_start_subtitle()}</p>
8888
</header>
89-
<SizedBox height={ThemeSpacing.Xl5} />
89+
<SizedBox height={ThemeSpacing.Xl3} />
9090
{isPresent(loaderData?.url) && isPresent(loaderData.button_display_name) && (
9191
<>
9292
<ContainerWithIcon icon="globe">
@@ -96,15 +96,12 @@ export const EnrollmentStartPage = () => {
9696
<p>{m.enrollment_start_external_subtitle()}</p>
9797
</header>
9898
<div className="openid-link">
99-
<a href={loaderData.url} target="_blank">
100-
<Button
101-
size="big"
102-
iconRight="open-in-new-window"
103-
text={m.cmp_openid_button({
104-
provider: loaderData.button_display_name,
105-
})}
106-
/>
107-
</a>
99+
<OIDCButton
100+
url={loaderData.url}
101+
text={m.cmp_openid_button({
102+
provider: loaderData.button_display_name,
103+
})}
104+
/>
108105
</div>
109106
</ContainerWithIcon>
110107
<Divider text={m.misc_or()} orientation="horizontal" />

webnext/src/shared/api/types.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ export type UserInfo = {
1717
email: string;
1818
phone_number?: string;
1919
is_admin: boolean;
20+
is_active: boolean;
21+
enrolled: boolean;
2022
};
2123

2224
export type AppInfo = {

webnext/src/shared/components/ContactFooter/style.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
.admin-contact {
2-
font: var(--t-body-sm-400);
2+
font: var(--t-body-xs-500);
33
color: var(--fg-neutral);
44

55
& > a {
6-
font: var(--t-body-sm-400);
6+
font: var(--t-body-xs-500);
77
color: var(--fg-action);
88
text-decoration: none;
99
cursor: pointer;

0 commit comments

Comments
 (0)