Skip to content

Commit

Permalink
added multiday notification validations
Browse files Browse the repository at this point in the history
  • Loading branch information
will-craig committed Jan 10, 2025
1 parent 9e4187b commit d160893
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 5 deletions.
3 changes: 0 additions & 3 deletions UI.AutomationTests/Admin/Booking/BookHearingTests.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
using System.Text.RegularExpressions;
using UI.AutomationTests.EmailNotifications;
using UI.Common.Utilities;

Expand Down Expand Up @@ -141,9 +140,7 @@ private async Task ValidateEmailNotifications(BookingParticipantDto newUser)
if (participant.Role == GenericTestRole.Representative)
await EmailNotificationService.ValidateEmailReceived(participant.ContactEmail, EmailTemplates.ExistingProfessionalConfirmation);
else
{
await EmailNotificationService.ValidateEmailReceived(participant.ContactEmail, EmailTemplates.ExistingParticipantConfirmation);
}
}
}
}
30 changes: 29 additions & 1 deletion UI.AutomationTests/Admin/Booking/EditMultiDayHearingTests.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
using System.ComponentModel.DataAnnotations;
using UI.AutomationTests.EmailNotifications;
using UI.Common.Utilities;
using UI.PageModels.Pages.Admin.Booking;

Expand Down Expand Up @@ -77,10 +79,36 @@ public async Task EditThisAndUpcomingDaysOfMultiDayHearing()
bookingDetailsPage = SearchAndViewHearing(bookingDetailPage, hearingDto);
bookingDetailsPage.ValidateDetailsPage(hearingDto);
}

await ValidatorEmailNotifications(hearingDto);
Assert.Pass();
}

private async Task ValidatorEmailNotifications(BookingDto hearingDto)
{
//Validate Judge email notification
await EmailNotificationService.ValidateEmailReceived(hearingDto.Judge.Username, EmailTemplates.JudgeHearingConfirmation);
await EmailNotificationService.ValidateEmailReceived(hearingDto.Judge.Username, EmailTemplates.JudgeHearingConfirmationMultiDay);
await EmailNotificationService.ValidateEmailReceived(hearingDto.Judge.Username, EmailTemplates.HearingAmendmentJudge);
//Validate New User Participant email notification
await EmailNotificationService.ValidateEmailReceived(hearingDto.NewParticipants[0].ContactEmail, EmailTemplates.FirstEmailAllNewUsers);
await EmailNotificationService.ValidateEmailReceived(hearingDto.NewParticipants[0].ContactEmail, EmailTemplates.SecondEmailNewUserConfirmation);
//Validate Other Participants email notification
foreach (var participant in hearingDto.Participants)
{
if (participant.Role == GenericTestRole.Representative)
{

await EmailNotificationService.ValidateEmailReceived(participant.ContactEmail, EmailTemplates.ExistingProfessionalConfirmationMultiDay);
await EmailNotificationService.ValidateEmailReceived(participant.ContactEmail, EmailTemplates.HearingAmendmentProfessional);
}
else
{
await EmailNotificationService.ValidateEmailReceived(participant.ContactEmail, EmailTemplates.ExistingParticipantConfirmationMultiDay);
await EmailNotificationService.ValidateEmailReceived(participant.ContactEmail, EmailTemplates.HearingAmendment);
}
}
}

private SummaryPage EditMultiDayHearing(BookingDto hearingDto, SummaryPage summaryPage)
{
// Assign a new Judge
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,41 @@ public class EmailNotificationService
EmailTemplates.ExistingParticipantConfirmation,
"7458e52d-3954-4f33-bd2d-0a7d2de295fc"
},
{
EmailTemplates.ExistingParticipantConfirmationMultiDay,
"3d83ee22-71ef-47f6-9557-bdaf0c0eecae"
},
{
EmailTemplates.ExistingProfessionalConfirmation,
"bd64e5d2-610f-449a-a925-3db10f913019"
},
{
EmailTemplates.ExistingProfessionalConfirmationMultiDay,
"bc278f80-69a5-4e91-a0ef-4bfe2a52796e"
},
{
EmailTemplates.EmailReminder48Hour,
"cc5cbdca-6614-484d-8b2d-5446ebccb47b"
},
{
EmailTemplates.JudgeHearingConfirmation,
"811125fe-4cab-4829-88ed-d3e7d4689cdd"
},
{
EmailTemplates.JudgeHearingConfirmationMultiDay,
"b3b3b3b3-3b3b-3b3b-3b3b-3b3b3b3b3b3b"
},
{
EmailTemplates.HearingAmendment,
"197d2b04-a600-41ae-bf68-8021d6ea0057"
},
{
EmailTemplates.HearingAmendmentProfessional,
"bc278f80-69a5-4e91-a0ef-4bfe2a52796e"
},
{
EmailTemplates.HearingAmendmentJudge,
"3210895a-c096-4029-b43e-9fde4642a254"
}
};

Expand Down Expand Up @@ -61,7 +85,13 @@ public enum EmailTemplates
FirstEmailAllNewUsers,
SecondEmailNewUserConfirmation,
ExistingParticipantConfirmation,
ExistingParticipantConfirmationMultiDay,
ExistingProfessionalConfirmation,
EmailReminder48Hour,
ExistingProfessionalConfirmationMultiDay,
JudgeHearingConfirmation,
JudgeHearingConfirmationMultiDay,
HearingAmendment,
HearingAmendmentProfessional,
HearingAmendmentJudge,
EmailReminder48Hour
}

0 comments on commit d160893

Please sign in to comment.