Skip to content

Commit a73fc9b

Browse files
committed
test(e2e): add signup flow tests and cypress configuration
1 parent a30aa25 commit a73fc9b

15 files changed

Lines changed: 1581 additions & 46 deletions

File tree

app/components/auth/register/OtpForm.vue

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,11 @@ const [_otp, otpAttrs] = defineField('otp');
2828
</script>
2929

3030
<template>
31-
<form class="flex h-full flex-col justify-between" @submit.prevent="onSubmit">
31+
<form
32+
class="flex h-full flex-col justify-between"
33+
data-cy="signup-otp-form"
34+
@submit.prevent="onSubmit"
35+
>
3236
<UiDialogHeader class="py-6">
3337
<UiDialogTitle class="text-4xl font-bold">{{ $t('register.otp.title') }}</UiDialogTitle>
3438
<UiDialogDescription>
@@ -44,12 +48,14 @@ const [_otp, otpAttrs] = defineField('otp');
4448
:placeholder="$t('register.otp.label')"
4549
inputmode="numeric"
4650
type="text"
51+
data-cy="signup-otp"
4752
pattern="[0-9]*"
4853
name="otp"
4954
v-bind="otpAttrs"
5055
/>
5156
<Button
5257
type="button"
58+
data-cy="signup-resend-otp-button"
5359
variant="link"
5460
size="link"
5561
class="w-fit"
@@ -64,6 +70,7 @@ const [_otp, otpAttrs] = defineField('otp');
6470
:disabled="Object.entries(errors).length > 0 || isSubmitting"
6571
size="xl"
6672
class="w-full"
73+
data-cy="signup-next-button"
6774
>{{ $t('ui.next') }}</Button
6875
>
6976
</UiDialogFooter>

app/components/auth/register/PasswordForm.vue

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,11 @@ const [_password, passwordAttrs] = defineField('password');
2828
</script>
2929

3030
<template>
31-
<form class="flex h-full flex-col justify-between" @submit.prevent="onSubmit">
31+
<form
32+
class="flex h-full flex-col justify-between"
33+
data-cy="signup-password-form"
34+
@submit.prevent="onSubmit"
35+
>
3236
<UiDialogHeader class="py-6">
3337
<UiDialogTitle class="text-4xl font-bold">{{ $t('register.password.title') }}</UiDialogTitle>
3438
<UiDialogDescription>
@@ -39,6 +43,7 @@ const [_password, passwordAttrs] = defineField('password');
3943
<FieldInput
4044
:placeholder="$t('register.password.label')"
4145
type="password"
46+
data-cy="signup-password"
4247
name="password"
4348
v-bind="passwordAttrs"
4449
/>
@@ -52,6 +57,7 @@ const [_password, passwordAttrs] = defineField('password');
5257
:disabled="Object.entries(errors).length > 0 || isSubmitting"
5358
size="xl"
5459
class="w-full"
60+
data-cy="signup-next-button"
5561
>{{ $t('ui.next') }}</Button
5662
>
5763
</UiDialogFooter>

app/components/auth/register/RegisterationInfoForm.vue

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,15 +91,31 @@ watch(
9191
</script>
9292

9393
<template>
94-
<form class="flex h-full flex-col justify-between" @submit.prevent="onSubmit">
94+
<form
95+
class="flex h-full flex-col justify-between"
96+
data-cy="signup-info-form"
97+
@submit.prevent="onSubmit"
98+
>
9599
<UiDialogHeader class="py-6">
96100
<UiDialogTitle class="text-4xl font-bold">{{
97101
$t('register.register-info.title')
98102
}}</UiDialogTitle>
99103
</UiDialogHeader>
100104
<div class="flex flex-col gap-4">
101-
<FieldInput placeholder="Name" type="text" name="name" v-bind="nameAttrs" />
102-
<FieldInput placeholder="Email" type="text" name="email" v-bind="emailAttrs" />
105+
<FieldInput
106+
placeholder="Name"
107+
type="text"
108+
data-cy="signup-name"
109+
name="name"
110+
v-bind="nameAttrs"
111+
/>
112+
<FieldInput
113+
placeholder="Email"
114+
type="text"
115+
data-cy="signup-email"
116+
name="email"
117+
v-bind="emailAttrs"
118+
/>
103119
<div>
104120
<h2 class="font-semibold">{{ $t('register.register-info.date-of-birth.title') }}</h2>
105121
<p class="text-muted-foreground mb-4 text-sm">
@@ -112,26 +128,30 @@ watch(
112128
:options="dateSelect.months.value"
113129
placeholder="Month"
114130
name="birth-month"
131+
data-cy="signup-dob-month"
115132
/>
116133
<Select
117134
v-model="dateSelect.selectedDay.value"
118135
class="flex-1/4"
119136
:options="dateSelect.days.value"
120137
placeholder="Day"
121138
name="birth-day"
139+
data-cy="signup-dob-day"
122140
/>
123141
<Select
124142
v-model="dateSelect.selectedYear.value"
125143
class="flex-1/4"
126144
:options="dateSelect.years.value"
127145
placeholder="Year"
128146
name="birth-year"
147+
data-cy="signup-dob-year"
129148
/>
130149
</div>
131150
<p
132151
v-if="errors.birthDate"
133152
data-test-id="birth-date-error"
134153
class="text-destructive ps-1 text-xs"
154+
data-cy="signup-dob-error"
135155
>
136156
{{ errors.birthDate }}
137157
</p>
@@ -143,6 +163,7 @@ watch(
143163
:disabled="Object.entries(errors).length > 0 || isSubmitting"
144164
size="xl"
145165
class="w-full"
166+
data-cy="signup-next-button"
146167
>{{ $t('ui.next') }}</Button
147168
>
148169
</UiDialogFooter>

app/pages/index.vue

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,14 @@ definePageMeta({
3838
<span class="uppercase">{{ $t('root.auth.separator') }}</span>
3939
<div class="w-full border-b-1" />
4040
</div>
41-
<Button id="signup" variant="default" class="w-75" @click="registerStore.openDialog">{{
42-
$t('root.auth.signup')
43-
}}</Button>
41+
<Button
42+
id="signup"
43+
data-cy="signup-start-button"
44+
variant="default"
45+
class="w-75"
46+
@click="registerStore.openDialog"
47+
>{{ $t('root.auth.signup') }}</Button
48+
>
4449
<p class="text-muted-foreground mt-4 max-w-75 text-xs">
4550
{{ $t('root.auth.signup-info') }}
4651
</p>

cypress.config.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { defineConfig } from 'cypress';
2+
3+
export default defineConfig({
4+
e2e: {
5+
baseUrl: 'http://localhost:3000',
6+
},
7+
});

0 commit comments

Comments
 (0)