Update retries in playwright config and refactor account settings

This update changes the number of retries in the Playwright configuration. Additionally, solid improvements have been made in the account settings, including better data semantics for testing, changes to email confirmation, and adding a new E2E test suite for accounts. The sign-up flow was updated and problems with multi-language support logic were fixed.
This commit is contained in:
giancarlo
2024-04-11 18:15:16 +08:00
parent a6780a80ed
commit 311086d0e7
11 changed files with 130 additions and 14 deletions

View File

@@ -88,9 +88,17 @@ export function PersonalAccountDropdown({
'fade-in animate-in flex w-full flex-col truncate text-left'
}
>
<span className={'truncate text-sm'}>{displayName}</span>
<span
data-test={'account-dropdown-display-name'}
className={'truncate text-sm'}
>
{displayName}
</span>
<span className={'text-muted-foreground truncate text-xs'}>
<span
data-test={'account-dropdown-email'}
className={'text-muted-foreground truncate text-xs'}
>
{signedInAsLabel}
</span>
</div>

View File

@@ -156,5 +156,9 @@ export function PersonalAccountSettingsContainer(
function useSupportMultiLanguage() {
const { i18n } = useTranslation();
return i18n.options.supportedLngs && i18n.options.supportedLngs.length > 1;
const langs = (i18n.options.supportedLngs as string[]) ?? [];
const supportedLangs = langs.filter((lang) => lang !== 'cimode');
return supportedLangs.length > 1;
}

View File

@@ -3,6 +3,7 @@
import type { User } from '@supabase/supabase-js';
import { zodResolver } from '@hookform/resolvers/zod';
import { CheckIcon } from '@radix-ui/react-icons';
import { useForm } from 'react-hook-form';
import { useTranslation } from 'react-i18next';
import { toast } from 'sonner';
@@ -74,11 +75,13 @@ export function UpdateEmailForm({
<Form {...form}>
<form
className={'flex flex-col space-y-4'}
data-test={'update-email-form'}
data-test={'account-email-form'}
onSubmit={form.handleSubmit(updateEmail)}
>
<If condition={updateUserMutation.data}>
<Alert variant={'success'}>
<CheckIcon className={'h-4'} />
<AlertTitle>
<Trans i18nKey={'account:updateEmailSuccess'} />
</AlertTitle>
@@ -99,7 +102,7 @@ export function UpdateEmailForm({
<FormControl>
<Input
data-test={'profile-new-email-input'}
data-test={'account-email-form-email-input'}
required
type={'email'}
placeholder={''}
@@ -123,7 +126,7 @@ export function UpdateEmailForm({
<FormControl>
<Input
{...field}
data-test={'profile-repeat-email-input'}
data-test={'account-email-form-repeat-email-input'}
required
type={'email'}
/>

View File

@@ -50,7 +50,7 @@ export function UpdateAccountDetailsForm({
return toast.promise(() => promise, {
success: t(`updateProfileSuccess`),
error: t(`updateProfileError`),
loading: t(`:pdateProfileLoading`),
loading: t(`updateProfileLoading`),
});
};
@@ -58,7 +58,7 @@ export function UpdateAccountDetailsForm({
<div className={'flex flex-col space-y-8'}>
<Form {...form}>
<form
data-test={'update-profile-form'}
data-test={'update-account-name-form'}
className={'flex flex-col space-y-4'}
onSubmit={form.handleSubmit(onSubmit)}
>
@@ -72,7 +72,7 @@ export function UpdateAccountDetailsForm({
<FormControl>
<Input
data-test={'profile-display-name'}
data-test={'account-display-name'}
minLength={2}
placeholder={''}
maxLength={100}