@@ -2,6 +2,7 @@ package pro.qyoga.tests.cases.app.therapist.appointments.core
22
33import io.kotest.matchers.collections.shouldBeEmpty
44import io.kotest.matchers.shouldBe
5+ import org.junit.jupiter.api.DisplayName
56import org.junit.jupiter.api.Test
67import org.springframework.http.HttpStatus
78import pro.azhidkov.platform.spring.sdj.ergo.hydration.ref
@@ -31,44 +32,44 @@ import java.time.LocalDate
3132import java.time.LocalTime
3233import java.time.ZoneId
3334
34-
35+ @DisplayName( " Страница редактирования записи на прием " )
3536class EditAppointmentPageTest : QYogaAppIntegrationBaseTest () {
3637
3738 private val timeZones = getBean<TimeZones >()
3839
3940 @Test
40- fun `Edit page for minimal appointment page should be correctly rendered and prefilled ` () {
41- // Given
41+ fun `Страница редактирования только с обязательными полями записи на прием должна корректно отображаться и заполняться ` () {
42+ // Сетап
4243 val appointment = backgrounds.appointments.create()
4344
4445 val therapist = TherapistClient .loginAsTheTherapist()
4546
46- // When
47+ // Действие
4748 val document = therapist.appointments.getEditAppointmentPage(appointment.ref())
4849
49- // Then
50+ // Проверка
5051 document shouldBePage EditAppointmentPage
5152 document shouldHave EditAppointmentForm .formPrefilledWith(appointment.toEditRequest(timeZones::findById))
5253 }
5354
5455 @Test
55- fun `Edit page for full appointment page should be correctly rendered and prefilled ` () {
56- // Given
56+ fun `Страница редактирования со всеми заполененными полями записи на прием должна корректно отображаться и заполняться ` () {
57+ // Сетап
5758 val appointment = backgrounds.appointments.createFull()
5859
5960 val therapist = TherapistClient .loginAsTheTherapist()
6061
61- // When
62+ // Действие
6263 val document = therapist.appointments.getEditAppointmentPage(appointment.ref())
6364
64- // Then
65+ // Проверка
6566 document shouldBePage EditAppointmentPage
6667 document shouldHave EditAppointmentForm .formPrefilledWith(appointment.toEditRequest(timeZones::findById))
6768 }
6869
6970 @Test
70- fun `Edit of minimal appointment to full should be persistent ` () {
71- // Given
71+ fun `Отредактированная запись на прием только с обязательными полями должна сохраняться ` () {
72+ // Сетап
7273 val appointment = backgrounds.appointments.create()
7374 val newAppointmentType = backgrounds.appointmentTypes.createAppointmentType()
7475 val therapeuticTask = backgrounds.therapeuticTasks.createTherapeuticTask()
@@ -86,10 +87,10 @@ class EditAppointmentPageTest : QYogaAppIntegrationBaseTest() {
8687
8788 val therapist = TherapistClient .loginAsTheTherapist()
8889
89- // When
90+ // Действие
9091 val response = therapist.appointments.editAppointment(appointment.ref(), editedAppointment)
9192
92- // Then
93+ // Проверка
9394 response.statusCode() shouldBe HttpStatus .OK .value()
9495 response shouldBePage CalendarPage
9596
@@ -99,8 +100,8 @@ class EditAppointmentPageTest : QYogaAppIntegrationBaseTest() {
99100 }
100101
101102 @Test
102- fun `Edit of full appointment to minimal should be persistent ` () {
103- // Given
103+ fun `Отредактированная запись на прием со всеми полями должна сохраняться ` () {
104+ // Сетап
104105 val appointment = backgrounds.appointments.createFull()
105106 val editedAppointment =
106107 AppointmentsObjectMother .appointmentPatchRequest(
@@ -116,10 +117,10 @@ class EditAppointmentPageTest : QYogaAppIntegrationBaseTest() {
116117
117118 val therapist = TherapistClient .loginAsTheTherapist()
118119
119- // When
120+ // Действие
120121 val response = therapist.appointments.editAppointment(appointment.ref(), editedAppointment)
121122
122- // Then
123+ // Проверка
123124 response.statusCode() shouldBe HttpStatus .OK .value()
124125 response shouldBePage CalendarPage
125126
@@ -128,38 +129,38 @@ class EditAppointmentPageTest : QYogaAppIntegrationBaseTest() {
128129 }
129130
130131 @Test
131- fun `On request of edit page of not existing appointment 404 error page should be returned ` () {
132- // Given
132+ fun `При запросе страницы редактирования несуществующего приема должна возвращаться страница с ошибкой 404 ` () {
133+ // Сетап
133134 val therapist = TherapistClient .loginAsTheTherapist()
134135
135- // When
136+ // Действие
136137 val document =
137138 therapist.appointments.getEditAppointmentPage(aAppointmentId(), expectedStatus = HttpStatus .NOT_FOUND )
138139
139- // Then
140+ // Проверка
140141 document shouldBePage (NotFoundErrorPage as HtmlPage )
141142 }
142143
143144 @Test
144- fun `On request to edit of not existing appointment 404 error page should be returned ` () {
145- // Given
145+ fun `При запросе на редактировании несуществующего приема должна возвращаться страница с ошибкой 404 ` () {
146+ // Сетап
146147 val therapist = TherapistClient .loginAsTheTherapist()
147148
148149 val editAppointmentRequest = randomEditAppointmentRequest()
149150
150- // When
151+ // Действие
151152 val response = therapist.appointments.editAppointment(
152153 aAppointmentId(), editAppointmentRequest
153154 )
154155
155- // Then
156+ // Проверка
156157 response.statusCode() shouldBe HttpStatus .NOT_FOUND .value()
157158 response shouldBePage NotFoundErrorPage
158159 }
159160
160161 @Test
161- fun `Creation of appointment that intersects with existing should fail with validation error ` () {
162- // Given
162+ fun `Создание приема, пересекающегося с существующим, должно завершиться ошибкой проверки ` () {
163+ // Сетап
163164 val appointmentsDate = LocalDate .of(2024 , 2 , 11 )
164165 val appointmentsBaseTime = LocalTime .of(9 , 0 )
165166 val zoneId = ZoneId .of(" Asia/Novosibirsk" )
@@ -180,13 +181,13 @@ class EditAppointmentPageTest : QYogaAppIntegrationBaseTest() {
180181
181182 val therapist = TherapistClient .loginAsTheTherapist()
182183
183- // When
184+ // Действие
184185 val document = therapist.appointments.editAppointmentForError(
185186 nextNotRescheduledAppointment.ref(),
186187 rescheduleAppointmentRequest
187188 )
188189
189- // Then
190+ // Проверка
190191 document shouldBePage EditAppointmentPage
191192 document shouldHave EditAppointmentForm .formPrefilledWith(rescheduleAppointmentRequest)
192193 document shouldHaveElement CreateAppointmentForm .appointmentsIntersectionErrorMessage
@@ -196,15 +197,15 @@ class EditAppointmentPageTest : QYogaAppIntegrationBaseTest() {
196197 }
197198
198199 @Test
199- fun `Deletion of appointment should be persistent and return redirect to specified calendar day ` () {
200- // Given
200+ fun `Удаление записи на прием должно быть постоянным и перенаправлять на указанный календарный день ` () {
201+ // Сетап
201202 val appointment = backgrounds.appointments.create()
202203 val therapist = TherapistClient .loginAsTheTherapist()
203204
204- // When
205+ // Действие
205206 val response = therapist.appointments.delete(appointment.ref(), appointment.wallClockDateTime.toLocalDate())
206207
207- // Then
208+ // Проверка
208209 response.statusCode shouldBe HttpStatus .OK .value()
209210 response.header(" HX-Location" ) shouldBe SchedulePageController .DATE_PATH .replace(
210211 " {date}" ,
@@ -214,5 +215,20 @@ class EditAppointmentPageTest : QYogaAppIntegrationBaseTest() {
214215 backgrounds.appointments.getDaySchedule(appointment.wallClockDateTime.toLocalDate()).shouldBeEmpty()
215216 }
216217
218+ @Test
219+ fun `Запись на прием со статусом 'Клиент пришел' должна отображаться корректно` () {
220+ // Сетап
221+ val appointment = backgrounds.appointments.create(appointmentStatus = AppointmentStatus .CLIENT_CAME )
222+
223+ val therapist = TherapistClient .loginAsTheTherapist()
224+
225+ // Действие
226+ val document = therapist.appointments.getEditAppointmentPage(appointment.ref())
227+
228+ // Проверка
229+ document shouldBePage EditAppointmentPage
230+ document shouldHave EditAppointmentForm .formPrefilledWith(appointment.toEditRequest(timeZones::findById))
231+ }
232+
217233}
218234
0 commit comments