From d3f55e499bd0f6f16c283dcf2ad39a6ec0042ae5 Mon Sep 17 00:00:00 2001 From: shaed-parkar <41630528+shaed-parkar@users.noreply.github.com> Date: Fri, 13 Oct 2023 14:19:51 +0100 Subject: [PATCH] VIH-10143 capture validation failure on save and display (#1284) * fix issue with manifest pointing to wrong path for favicons * Display error messages from API Remove validation from admin web and rely on bookings API to own the validation * fix code smells * fix code smells * update test assertion * Remove obsolete test project * Remove obsolete validation in Admin Web * use dev --- .../AdminWebsite.AcceptanceTests.csproj | 51 - .../Configuration/AdminWebConfig.cs | 21 - .../Configuration/AdminWebTestConfig.cs | 16 - .../Configuration/AdminWebTokens.cs | 9 - .../Configuration/AdminWebVhServiceConfig.cs | 10 - .../Configuration/NotifyConfiguration.cs | 11 - .../Configuration/WowzaConfiguration.cs | 9 - .../Data/AssertConference.cs | 88 - .../Data/AssertHearing.cs | 125 - .../Data/CallbackEvent.cs | 21 - .../Data/ConferenceEventRequestBuilder.cs | 55 - .../Data/DateFormats.cs | 21 - .../Data/HearingDetails.cs | 14 - .../Data/HearingRequestBuilder.cs | 52 - .../AdminWebsite.AcceptanceTests/Data/Test.cs | 25 - .../Data/TestData/CommonData.xml | 13 - .../Data/TestData/DefaultData.cs | 80 - .../Data/TestData/DefaultData.xml | 45 - .../Data/TestData/DefaultDataManager.cs | 14 - .../Data/UserToUserAccountMapper.cs | 29 - .../Features/Accessibility.feature | 69 - .../Features/AddParticipants.feature | 76 - .../Features/AssignJudge.feature | 20 - .../Features/BookingConfirmation.feature | 21 - .../Features/BookingDetails.feature | 58 - .../Features/BookingsList.feature | 10 - .../Features/ChangePassword.feature | 10 - .../Features/Dashboard.feature | 9 - .../Features/EditParticipantName.feature | 29 - .../Features/Errors.feature | 4 - .../Features/GetAudioFile.feature | 21 - .../Features/HearingDetails.feature | 21 - .../Features/HearingSchedule.feature | 32 - .../Features/Login.feature | 33 - .../Features/OtherInformation.feature | 15 - .../Features/Questionnaire.feature | 16 - .../Features/QuickLinks.feature | 41 - .../Features/Summary.feature | 16 - .../Features/TestHelpers.feature | 8 - .../Features/VideoAccessPoints.feature | 14 - .../Helpers/DateHelper.cs | 35 - .../Helpers/TestContext.cs | 29 - .../UserDetailsResponseToUsersMapper.cs | 30 - .../Helpers/Users.cs | 103 - .../Hooks/ConfigHooks.cs | 174 -- .../Hooks/DataHooks.cs | 228 -- .../Hooks/DriverHooks.cs | 100 - .../Hooks/HealthcheckHooks.cs | 32 - .../Hooks/HooksSequence.cs | 20 - .../Hooks/RegisterApisHooks.cs | 21 - .../Hooks/RemoveDataHooks.cs | 102 - .../Hooks/UnallocateUsersHooks.cs | 32 - .../Pages/AddPartcipantsPage.cs | 30 - .../Pages/AssignJudgePage.cs | 25 - .../Pages/BookingConfirmationPage.cs | 16 - .../Pages/BookingDetailsPage.cs | 41 - .../Pages/BookingsListPage.cs | 24 - .../Pages/ChangePasswordPage.cs | 13 - .../Pages/CommonAdminWebPage.cs | 16 - .../Pages/DashboardPage.cs | 14 - .../Pages/DeleteUserPage.cs | 15 - .../Pages/EditParticipantNamePage.cs | 23 - .../Pages/ErrorPage.cs | 10 - .../Pages/GetAudioFilePage.cs | 18 - .../Pages/HearingDetailsPage.cs | 14 - .../Pages/HearingSchedulePage.cs | 21 - .../Journeys/BookingConfirmationJourney.cs | 41 - .../Pages/Journeys/BookingDetailsJourney.cs | 42 - .../Pages/Journeys/BookingsListJourney.cs | 42 - .../Pages/Journeys/ChangePasswordJourney.cs | 34 - .../Journeys/EditParticipantNameJourney.cs | 34 - .../Pages/Journeys/GetAudioFileJourney.cs | 34 - .../Pages/Journeys/IJourney.cs | 13 - .../Pages/Journeys/Journey.cs | 13 - .../Pages/Journeys/QuestionnaireJourney.cs | 34 - .../Pages/OtherInformationPage.cs | 15 - .../Pages/Page.cs | 86 - .../Pages/QuestionnairePage.cs | 13 - .../Pages/SummaryPage.cs | 36 - .../Pages/VideoAccessPointsPage.cs | 12 - .../Properties/AssemblyInfo.cs | 4 - .../Steps/AccessibilitySteps.cs | 30 - .../Steps/AddParticipantSteps.cs | 419 --- .../Steps/AssignJudgeSteps.cs | 130 - .../Steps/BookingConfirmationSteps.cs | 63 - .../Steps/BookingDetailsSteps.cs | 138 - .../Steps/BookingsListSteps.cs | 71 - .../Steps/BrowserSteps.cs | 108 - .../Steps/ChangePasswordSteps.cs | 67 - .../Steps/CommonSteps.cs | 29 - .../Steps/DashboardSteps.cs | 110 - .../Steps/EditParticipantNameSteps.cs | 87 - .../Steps/ErrorSteps.cs | 38 - .../Steps/GetAudioFileSteps.cs | 116 - .../Steps/HearingDetailsSteps.cs | 90 - .../Steps/HearingScheduleSteps.cs | 190 -- .../Steps/LoginSteps.cs | 59 - .../Steps/NotificationSteps.cs | 41 - .../Steps/OtherInformationSteps.cs | 74 - .../Steps/ProgressionSteps.cs | 189 -- .../Steps/SummarySteps.cs | 267 -- .../Steps/TestHelperSteps.cs | 17 - .../Steps/VideoAccessPointsSteps.cs | 45 - .../TestAudioFiles/TestAudioFile.mp4 | Bin 10571 -> 0 bytes .../appsettings.json | 26 - .../packages.lock.json | 2704 ----------------- .../parameters.runsettings | 12 - .../HearingsController/EditHearingTests.cs | 316 +- .../Helper/ClientException.cs | 8 + .../Services/HearingServiceTests.cs | 276 +- AdminWebsite/AdminWebsite.sln | 7 - .../booking/summary/summary.component.html | 3 +- .../booking/summary/summary.component.spec.ts | 24 +- .../app/booking/summary/summary.component.ts | 23 +- .../justice-user-form.component.spec.ts | 4 +- .../save-failed-popup.component.html | 1 + .../save-failed-popup.component.ts | 5 +- .../src/app/services/clients/api-client.ts | 325 +- .../src/assets/images/favicons/manifest.json | 12 +- .../Controllers/HearingsController.cs | 57 +- .../AdminWebsite/Services/HearingsService.cs | 52 - 121 files changed, 121 insertions(+), 8983 deletions(-) delete mode 100644 AdminWebsite/AdminWebsite.AcceptanceTests/AdminWebsite.AcceptanceTests.csproj delete mode 100644 AdminWebsite/AdminWebsite.AcceptanceTests/Configuration/AdminWebConfig.cs delete mode 100644 AdminWebsite/AdminWebsite.AcceptanceTests/Configuration/AdminWebTestConfig.cs delete mode 100644 AdminWebsite/AdminWebsite.AcceptanceTests/Configuration/AdminWebTokens.cs delete mode 100644 AdminWebsite/AdminWebsite.AcceptanceTests/Configuration/AdminWebVhServiceConfig.cs delete mode 100644 AdminWebsite/AdminWebsite.AcceptanceTests/Configuration/NotifyConfiguration.cs delete mode 100644 AdminWebsite/AdminWebsite.AcceptanceTests/Configuration/WowzaConfiguration.cs delete mode 100644 AdminWebsite/AdminWebsite.AcceptanceTests/Data/AssertConference.cs delete mode 100644 AdminWebsite/AdminWebsite.AcceptanceTests/Data/AssertHearing.cs delete mode 100644 AdminWebsite/AdminWebsite.AcceptanceTests/Data/CallbackEvent.cs delete mode 100644 AdminWebsite/AdminWebsite.AcceptanceTests/Data/ConferenceEventRequestBuilder.cs delete mode 100644 AdminWebsite/AdminWebsite.AcceptanceTests/Data/DateFormats.cs delete mode 100644 AdminWebsite/AdminWebsite.AcceptanceTests/Data/HearingDetails.cs delete mode 100644 AdminWebsite/AdminWebsite.AcceptanceTests/Data/HearingRequestBuilder.cs delete mode 100644 AdminWebsite/AdminWebsite.AcceptanceTests/Data/Test.cs delete mode 100644 AdminWebsite/AdminWebsite.AcceptanceTests/Data/TestData/CommonData.xml delete mode 100644 AdminWebsite/AdminWebsite.AcceptanceTests/Data/TestData/DefaultData.cs delete mode 100644 AdminWebsite/AdminWebsite.AcceptanceTests/Data/TestData/DefaultData.xml delete mode 100644 AdminWebsite/AdminWebsite.AcceptanceTests/Data/TestData/DefaultDataManager.cs delete mode 100644 AdminWebsite/AdminWebsite.AcceptanceTests/Data/UserToUserAccountMapper.cs delete mode 100644 AdminWebsite/AdminWebsite.AcceptanceTests/Features/Accessibility.feature delete mode 100644 AdminWebsite/AdminWebsite.AcceptanceTests/Features/AddParticipants.feature delete mode 100644 AdminWebsite/AdminWebsite.AcceptanceTests/Features/AssignJudge.feature delete mode 100644 AdminWebsite/AdminWebsite.AcceptanceTests/Features/BookingConfirmation.feature delete mode 100644 AdminWebsite/AdminWebsite.AcceptanceTests/Features/BookingDetails.feature delete mode 100644 AdminWebsite/AdminWebsite.AcceptanceTests/Features/BookingsList.feature delete mode 100644 AdminWebsite/AdminWebsite.AcceptanceTests/Features/ChangePassword.feature delete mode 100644 AdminWebsite/AdminWebsite.AcceptanceTests/Features/Dashboard.feature delete mode 100644 AdminWebsite/AdminWebsite.AcceptanceTests/Features/EditParticipantName.feature delete mode 100644 AdminWebsite/AdminWebsite.AcceptanceTests/Features/Errors.feature delete mode 100644 AdminWebsite/AdminWebsite.AcceptanceTests/Features/GetAudioFile.feature delete mode 100644 AdminWebsite/AdminWebsite.AcceptanceTests/Features/HearingDetails.feature delete mode 100644 AdminWebsite/AdminWebsite.AcceptanceTests/Features/HearingSchedule.feature delete mode 100644 AdminWebsite/AdminWebsite.AcceptanceTests/Features/Login.feature delete mode 100644 AdminWebsite/AdminWebsite.AcceptanceTests/Features/OtherInformation.feature delete mode 100644 AdminWebsite/AdminWebsite.AcceptanceTests/Features/Questionnaire.feature delete mode 100644 AdminWebsite/AdminWebsite.AcceptanceTests/Features/QuickLinks.feature delete mode 100644 AdminWebsite/AdminWebsite.AcceptanceTests/Features/Summary.feature delete mode 100644 AdminWebsite/AdminWebsite.AcceptanceTests/Features/TestHelpers.feature delete mode 100644 AdminWebsite/AdminWebsite.AcceptanceTests/Features/VideoAccessPoints.feature delete mode 100644 AdminWebsite/AdminWebsite.AcceptanceTests/Helpers/DateHelper.cs delete mode 100644 AdminWebsite/AdminWebsite.AcceptanceTests/Helpers/TestContext.cs delete mode 100644 AdminWebsite/AdminWebsite.AcceptanceTests/Helpers/UserDetailsResponseToUsersMapper.cs delete mode 100644 AdminWebsite/AdminWebsite.AcceptanceTests/Helpers/Users.cs delete mode 100644 AdminWebsite/AdminWebsite.AcceptanceTests/Hooks/ConfigHooks.cs delete mode 100644 AdminWebsite/AdminWebsite.AcceptanceTests/Hooks/DataHooks.cs delete mode 100644 AdminWebsite/AdminWebsite.AcceptanceTests/Hooks/DriverHooks.cs delete mode 100644 AdminWebsite/AdminWebsite.AcceptanceTests/Hooks/HealthcheckHooks.cs delete mode 100644 AdminWebsite/AdminWebsite.AcceptanceTests/Hooks/HooksSequence.cs delete mode 100644 AdminWebsite/AdminWebsite.AcceptanceTests/Hooks/RegisterApisHooks.cs delete mode 100644 AdminWebsite/AdminWebsite.AcceptanceTests/Hooks/RemoveDataHooks.cs delete mode 100644 AdminWebsite/AdminWebsite.AcceptanceTests/Hooks/UnallocateUsersHooks.cs delete mode 100644 AdminWebsite/AdminWebsite.AcceptanceTests/Pages/AddPartcipantsPage.cs delete mode 100644 AdminWebsite/AdminWebsite.AcceptanceTests/Pages/AssignJudgePage.cs delete mode 100644 AdminWebsite/AdminWebsite.AcceptanceTests/Pages/BookingConfirmationPage.cs delete mode 100644 AdminWebsite/AdminWebsite.AcceptanceTests/Pages/BookingDetailsPage.cs delete mode 100644 AdminWebsite/AdminWebsite.AcceptanceTests/Pages/BookingsListPage.cs delete mode 100644 AdminWebsite/AdminWebsite.AcceptanceTests/Pages/ChangePasswordPage.cs delete mode 100644 AdminWebsite/AdminWebsite.AcceptanceTests/Pages/CommonAdminWebPage.cs delete mode 100644 AdminWebsite/AdminWebsite.AcceptanceTests/Pages/DashboardPage.cs delete mode 100644 AdminWebsite/AdminWebsite.AcceptanceTests/Pages/DeleteUserPage.cs delete mode 100644 AdminWebsite/AdminWebsite.AcceptanceTests/Pages/EditParticipantNamePage.cs delete mode 100644 AdminWebsite/AdminWebsite.AcceptanceTests/Pages/ErrorPage.cs delete mode 100644 AdminWebsite/AdminWebsite.AcceptanceTests/Pages/GetAudioFilePage.cs delete mode 100644 AdminWebsite/AdminWebsite.AcceptanceTests/Pages/HearingDetailsPage.cs delete mode 100644 AdminWebsite/AdminWebsite.AcceptanceTests/Pages/HearingSchedulePage.cs delete mode 100644 AdminWebsite/AdminWebsite.AcceptanceTests/Pages/Journeys/BookingConfirmationJourney.cs delete mode 100644 AdminWebsite/AdminWebsite.AcceptanceTests/Pages/Journeys/BookingDetailsJourney.cs delete mode 100644 AdminWebsite/AdminWebsite.AcceptanceTests/Pages/Journeys/BookingsListJourney.cs delete mode 100644 AdminWebsite/AdminWebsite.AcceptanceTests/Pages/Journeys/ChangePasswordJourney.cs delete mode 100644 AdminWebsite/AdminWebsite.AcceptanceTests/Pages/Journeys/EditParticipantNameJourney.cs delete mode 100644 AdminWebsite/AdminWebsite.AcceptanceTests/Pages/Journeys/GetAudioFileJourney.cs delete mode 100644 AdminWebsite/AdminWebsite.AcceptanceTests/Pages/Journeys/IJourney.cs delete mode 100644 AdminWebsite/AdminWebsite.AcceptanceTests/Pages/Journeys/Journey.cs delete mode 100644 AdminWebsite/AdminWebsite.AcceptanceTests/Pages/Journeys/QuestionnaireJourney.cs delete mode 100644 AdminWebsite/AdminWebsite.AcceptanceTests/Pages/OtherInformationPage.cs delete mode 100644 AdminWebsite/AdminWebsite.AcceptanceTests/Pages/Page.cs delete mode 100644 AdminWebsite/AdminWebsite.AcceptanceTests/Pages/QuestionnairePage.cs delete mode 100644 AdminWebsite/AdminWebsite.AcceptanceTests/Pages/SummaryPage.cs delete mode 100644 AdminWebsite/AdminWebsite.AcceptanceTests/Pages/VideoAccessPointsPage.cs delete mode 100644 AdminWebsite/AdminWebsite.AcceptanceTests/Properties/AssemblyInfo.cs delete mode 100644 AdminWebsite/AdminWebsite.AcceptanceTests/Steps/AccessibilitySteps.cs delete mode 100644 AdminWebsite/AdminWebsite.AcceptanceTests/Steps/AddParticipantSteps.cs delete mode 100644 AdminWebsite/AdminWebsite.AcceptanceTests/Steps/AssignJudgeSteps.cs delete mode 100644 AdminWebsite/AdminWebsite.AcceptanceTests/Steps/BookingConfirmationSteps.cs delete mode 100644 AdminWebsite/AdminWebsite.AcceptanceTests/Steps/BookingDetailsSteps.cs delete mode 100644 AdminWebsite/AdminWebsite.AcceptanceTests/Steps/BookingsListSteps.cs delete mode 100644 AdminWebsite/AdminWebsite.AcceptanceTests/Steps/BrowserSteps.cs delete mode 100644 AdminWebsite/AdminWebsite.AcceptanceTests/Steps/ChangePasswordSteps.cs delete mode 100644 AdminWebsite/AdminWebsite.AcceptanceTests/Steps/CommonSteps.cs delete mode 100644 AdminWebsite/AdminWebsite.AcceptanceTests/Steps/DashboardSteps.cs delete mode 100644 AdminWebsite/AdminWebsite.AcceptanceTests/Steps/EditParticipantNameSteps.cs delete mode 100644 AdminWebsite/AdminWebsite.AcceptanceTests/Steps/ErrorSteps.cs delete mode 100644 AdminWebsite/AdminWebsite.AcceptanceTests/Steps/GetAudioFileSteps.cs delete mode 100644 AdminWebsite/AdminWebsite.AcceptanceTests/Steps/HearingDetailsSteps.cs delete mode 100644 AdminWebsite/AdminWebsite.AcceptanceTests/Steps/HearingScheduleSteps.cs delete mode 100644 AdminWebsite/AdminWebsite.AcceptanceTests/Steps/LoginSteps.cs delete mode 100644 AdminWebsite/AdminWebsite.AcceptanceTests/Steps/NotificationSteps.cs delete mode 100644 AdminWebsite/AdminWebsite.AcceptanceTests/Steps/OtherInformationSteps.cs delete mode 100644 AdminWebsite/AdminWebsite.AcceptanceTests/Steps/ProgressionSteps.cs delete mode 100644 AdminWebsite/AdminWebsite.AcceptanceTests/Steps/SummarySteps.cs delete mode 100644 AdminWebsite/AdminWebsite.AcceptanceTests/Steps/TestHelperSteps.cs delete mode 100644 AdminWebsite/AdminWebsite.AcceptanceTests/Steps/VideoAccessPointsSteps.cs delete mode 100644 AdminWebsite/AdminWebsite.AcceptanceTests/TestAudioFiles/TestAudioFile.mp4 delete mode 100644 AdminWebsite/AdminWebsite.AcceptanceTests/appsettings.json delete mode 100644 AdminWebsite/AdminWebsite.AcceptanceTests/packages.lock.json delete mode 100644 AdminWebsite/AdminWebsite.AcceptanceTests/parameters.runsettings diff --git a/AdminWebsite/AdminWebsite.AcceptanceTests/AdminWebsite.AcceptanceTests.csproj b/AdminWebsite/AdminWebsite.AcceptanceTests/AdminWebsite.AcceptanceTests.csproj deleted file mode 100644 index a22a89433..000000000 --- a/AdminWebsite/AdminWebsite.AcceptanceTests/AdminWebsite.AcceptanceTests.csproj +++ /dev/null @@ -1,51 +0,0 @@ - - - - net6.0 - false - AdminWebsite.AcceptanceTests - true - true - false - false - false - B0F83938-CBCF-4059-9B42-8961B4D075A1 - ef943d1a-7506-483b-92b7-dc6e6b41270a - latestmajor - - - - - - - - - - - - - - - - - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - saucelabs.json - - - - - - - - diff --git a/AdminWebsite/AdminWebsite.AcceptanceTests/Configuration/AdminWebConfig.cs b/AdminWebsite/AdminWebsite.AcceptanceTests/Configuration/AdminWebConfig.cs deleted file mode 100644 index 1198579a4..000000000 --- a/AdminWebsite/AdminWebsite.AcceptanceTests/Configuration/AdminWebConfig.cs +++ /dev/null @@ -1,21 +0,0 @@ -using AcceptanceTests.Common.Configuration; -using AdminWebsite.Configuration; - -namespace AdminWebsite.AcceptanceTests.Configuration -{ - public class AdminWebConfig - { - public AzureAdConfiguration AzureAdConfiguration { get; set; } - public bool IsLive { get; set; } - public AdminWebTestConfig TestConfig { get; set; } - public AdminWebVhServiceConfig VhServices { get; set; } - public SauceLabsSettingsConfig SauceLabsConfiguration { get; set; } - public WowzaConfiguration Wowza { get; set; } - - public KinlyConfiguration KinlyConfiguration { get; set; } - public NotifyConfiguration NotifyConfiguration { get; set; } - public bool UsingEjud { get; set; } - public int SeleniumElementTimeout { get; set; } - public bool BookingConfirmToggle { get; set; } - } -} diff --git a/AdminWebsite/AdminWebsite.AcceptanceTests/Configuration/AdminWebTestConfig.cs b/AdminWebsite/AdminWebsite.AcceptanceTests/Configuration/AdminWebTestConfig.cs deleted file mode 100644 index a954ada18..000000000 --- a/AdminWebsite/AdminWebsite.AcceptanceTests/Configuration/AdminWebTestConfig.cs +++ /dev/null @@ -1,16 +0,0 @@ -using AcceptanceTests.Common.Configuration; -using AcceptanceTests.Common.Driver.Enums; - -namespace AdminWebsite.AcceptanceTests.Configuration -{ - public class AdminWebTestConfig : ITestSettingsConfig - { - public string TestUsernameStem { get; set; } - public string TestUserPassword { get; set; } - public TargetBrowser TargetBrowser { get; set; } - public string TargetBrowserVersion { get; set; } - public TargetDevice TargetDevice { get; set; } - public string TargetDeviceName { get; set; } - public TargetOS TargetOS { get; set; } - } -} diff --git a/AdminWebsite/AdminWebsite.AcceptanceTests/Configuration/AdminWebTokens.cs b/AdminWebsite/AdminWebsite.AcceptanceTests/Configuration/AdminWebTokens.cs deleted file mode 100644 index 24e2b6a68..000000000 --- a/AdminWebsite/AdminWebsite.AcceptanceTests/Configuration/AdminWebTokens.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace AdminWebsite.AcceptanceTests.Configuration -{ - public class AdminWebTokens - { - public string BookingsApiBearerToken { get; set; } - public string UserApiBearerToken { get; set; } - public string VideoApiBearerToken { get; set; } - } -} diff --git a/AdminWebsite/AdminWebsite.AcceptanceTests/Configuration/AdminWebVhServiceConfig.cs b/AdminWebsite/AdminWebsite.AcceptanceTests/Configuration/AdminWebVhServiceConfig.cs deleted file mode 100644 index 09bd03f2a..000000000 --- a/AdminWebsite/AdminWebsite.AcceptanceTests/Configuration/AdminWebVhServiceConfig.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace AdminWebsite.AcceptanceTests.Configuration -{ - public class AdminWebVhServiceConfig - { - public string AdminWebUrl { get; set; } - public bool RunningAdminWebLocally { get; set; } - public string TestApiUrl { get; set; } - public string TestApiResourceId { get; set; } - } -} diff --git a/AdminWebsite/AdminWebsite.AcceptanceTests/Configuration/NotifyConfiguration.cs b/AdminWebsite/AdminWebsite.AcceptanceTests/Configuration/NotifyConfiguration.cs deleted file mode 100644 index ed696d198..000000000 --- a/AdminWebsite/AdminWebsite.AcceptanceTests/Configuration/NotifyConfiguration.cs +++ /dev/null @@ -1,11 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace AdminWebsite.AcceptanceTests.Configuration -{ - public class NotifyConfiguration - { - public string ApiKey { get; set; } - } -} diff --git a/AdminWebsite/AdminWebsite.AcceptanceTests/Configuration/WowzaConfiguration.cs b/AdminWebsite/AdminWebsite.AcceptanceTests/Configuration/WowzaConfiguration.cs deleted file mode 100644 index 837df902f..000000000 --- a/AdminWebsite/AdminWebsite.AcceptanceTests/Configuration/WowzaConfiguration.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace AdminWebsite.AcceptanceTests.Configuration -{ - public class WowzaConfiguration - { - public string StorageAccountName { get; set; } - public string StorageAccountKey { get; set; } - public string StorageContainerName { get; set; } - } -} diff --git a/AdminWebsite/AdminWebsite.AcceptanceTests/Data/AssertConference.cs b/AdminWebsite/AdminWebsite.AcceptanceTests/Data/AssertConference.cs deleted file mode 100644 index bec0f4b8a..000000000 --- a/AdminWebsite/AdminWebsite.AcceptanceTests/Data/AssertConference.cs +++ /dev/null @@ -1,88 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using BookingsApi.Contract.V1.Responses; -using FluentAssertions; -using VideoApi.Contract.Enums; -using VideoApi.Contract.Responses; - -namespace AdminWebsite.AcceptanceTests.Data -{ - public static class AssertConference - { - public static void Assert(HearingDetailsResponse hearing, ConferenceDetailsResponse conference) - { - AssertConferenceDetails(hearing, conference); - AssertEndpoints(hearing.Endpoints, conference.Endpoints, hearing.Participants); - AssertConferenceParticipants(hearing.Participants, conference.Participants); - } - - private static void AssertConferenceDetails(HearingDetailsResponse hearing, ConferenceDetailsResponse conference) - { - conference.AudioRecordingRequired.Should().Be(hearing.AudioRecordingRequired); - hearing.Cases.First().Name.Should().StartWith(conference.CaseName); - conference.CaseNumber.Should().Be(hearing.Cases.First().Number); - conference.CaseType.Should().Be(hearing.CaseTypeName); - conference.ClosedDateTime.Should().BeNull(); - conference.CurrentStatus.Should().Be(ConferenceState.NotStarted); - conference.HearingId.Should().Be(hearing.Id); - conference.HearingVenueName.Should().Be(hearing.HearingVenueName); - conference.Id.Should().NotBeEmpty(); - conference.MeetingRoom.AdminUri.Should().NotBeNullOrEmpty(); - conference.MeetingRoom.JudgeUri.Should().NotBeNullOrEmpty(); - conference.MeetingRoom.ParticipantUri.Should().NotBeNullOrEmpty(); - conference.MeetingRoom.PexipNode.Should().NotBeNullOrEmpty(); - conference.MeetingRoom.PexipSelfTestNode.Should().NotBeNullOrEmpty(); - conference.ScheduledDateTime.Should().Be(hearing.ScheduledDateTime); - conference.ScheduledDuration.Should().Be(hearing.ScheduledDuration); - conference.StartedDateTime.Should().BeNull(); - conference.MeetingRoom.TelephoneConferenceId.Should().NotBeNullOrWhiteSpace(); - } - - private static void AssertEndpoints(IReadOnlyCollection hearingEndpoints, - IEnumerable conferenceEndpoints, IReadOnlyCollection hearingParticipants) - { - foreach (var conferenceEndpoint in conferenceEndpoints) - { - var hearingEndpoint = hearingEndpoints.First(x => x.Sip.Equals(conferenceEndpoint.SipAddress)); - - if (conferenceEndpoint.DefenceAdvocate == null) - { - hearingEndpoint.DefenceAdvocateId.Should().BeNull(); - } - else - { - hearingParticipants.Any(x => x.Username.Equals(conferenceEndpoint.DefenceAdvocate, StringComparison.CurrentCultureIgnoreCase)).Should().BeTrue(); - } - - conferenceEndpoint.DisplayName.Should().Be(hearingEndpoint.DisplayName); - conferenceEndpoint.Id.Should().NotBeEmpty(); - conferenceEndpoint.Pin.Should().Be(hearingEndpoint.Pin); - } - } - - private static void AssertConferenceParticipants(IReadOnlyCollection hearingParticipants, IEnumerable conferenceParticipants) - { - foreach (var conferenceParticipant in conferenceParticipants) - { - var hearingParticipant = hearingParticipants.First(x => x.ContactEmail.Equals(conferenceParticipant.ContactEmail)); - conferenceParticipant.CaseTypeGroup.Should().Be(hearingParticipant.CaseRoleName); - if (conferenceParticipant.UserRole != UserRole.Judge) - { - conferenceParticipant.ContactEmail.Should().Be(hearingParticipant.ContactEmail); - } - conferenceParticipant.Name.Trim().Should().Contain($"{hearingParticipant.FirstName.Trim()} {hearingParticipant.LastName.Trim()}"); - conferenceParticipant.ContactTelephone?.Trim().Should().Be(hearingParticipant.TelephoneNumber?.Trim()); - conferenceParticipant.CurrentStatus.Should().Be(ParticipantState.NotSignedIn); - conferenceParticipant.DisplayName.Trim().Should().Be(hearingParticipant.DisplayName.Trim()); - conferenceParticipant.FirstName.Trim().Should().Be(hearingParticipant.FirstName.Trim()); - conferenceParticipant.HearingRole.Trim().Should().Be(hearingParticipant.HearingRoleName.Trim()); - conferenceParticipant.Id.Should().NotBeEmpty(); - conferenceParticipant.LastName.Trim().Should().Be(hearingParticipant.LastName.Trim()); - conferenceParticipant.RefId.Should().Be(hearingParticipant.Id); - conferenceParticipant.UserRole.ToString().Should().Be(hearingParticipant.UserRoleName.Trim()); - conferenceParticipant.Username.Trim().Should().Be(hearingParticipant.Username.Trim()); - } - } - } -} diff --git a/AdminWebsite/AdminWebsite.AcceptanceTests/Data/AssertHearing.cs b/AdminWebsite/AdminWebsite.AcceptanceTests/Data/AssertHearing.cs deleted file mode 100644 index c4c1fde62..000000000 --- a/AdminWebsite/AdminWebsite.AcceptanceTests/Data/AssertHearing.cs +++ /dev/null @@ -1,125 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using FluentAssertions; -using AcceptanceTests.Common.Configuration.Users; -using AcceptanceTests.Common.Model.Participant; -using AdminWebsite.AcceptanceTests.Helpers; -using AdminWebsite.AcceptanceTests.Steps; -using BookingsApi.Contract.V1.Responses; - -namespace AdminWebsite.AcceptanceTests.Data -{ - public static class AssertHearing - { - public static void AssertHearingDetails(HearingDetailsResponse hearing, Test testData) - { - AssertDetails(hearing, testData); - AssertCreatedDate(hearing.CreatedDate, DateTime.UtcNow); - AssertQuestionnaire(hearing, testData); - } - - private static void AssertDetails(HearingDetailsResponse hearing, Test testData) - { - hearing.Cases.First().Name.Should().Contain(testData.HearingDetails.CaseName); - hearing.Cases.First().Number.Should().Contain(testData.HearingDetails.CaseNumber); - hearing.CaseTypeName.Should().Be(testData.HearingDetails.CaseType.Name); - hearing.HearingRoomName.Should().Be(testData.HearingSchedule.Room); - hearing.HearingTypeName.Should().Be(testData.HearingDetails.HearingType.Name); - hearing.HearingVenueName.Should().Be(testData.HearingSchedule.HearingVenue); - OtherInformationSteps.GetOtherInfo(hearing.OtherInformation).Should().Be(OtherInformationSteps.GetOtherInfo(testData.TestData.OtherInformationDetails.OtherInformation)); - } - - private static void AssertCreatedDate(DateTime actual, DateTime expected) - { - actual.ToShortDateString().Should().Be(expected.ToShortDateString()); - actual.ToShortTimeString().Should().BeOneOf( - expected.AddMinutes(-3).ToShortTimeString(), - expected.AddMinutes(-2).ToShortTimeString(), - expected.AddMinutes(-1).ToShortTimeString(), - expected.ToShortTimeString()); - } - - private static void AssertQuestionnaire(HearingDetailsResponse hearing, Test testData) - { - if (!hearing.Cases.First().Name.Contains("Day") || hearing.Cases.First().Name.Contains("Day 1 of")) - { - hearing.QuestionnaireNotRequired.Should().BeFalse(); - } - else - { - hearing.QuestionnaireNotRequired.Should().BeTrue(); - } - } - - public static void AssertScheduledDate(int day, DateTime actual, DateTime expected, bool isMultiDayHearing, - bool isRunningOnSauceLabs) - { - if (isMultiDayHearing) - { - var newDate = DateHelper.GetNextWorkingDay(expected, day - 1); - expected = newDate; - } - - actual.ToShortDateString().Should().Be(expected.ToShortDateString()); - - if (isRunningOnSauceLabs) - { - actual.ToShortTimeString().Should().BeOneOf( - expected.AddMinutes(-3).ToShortTimeString(), - expected.AddMinutes(-2).ToShortTimeString(), - expected.AddMinutes(-1).ToShortTimeString(), - expected.ToShortTimeString()); - } - } - - public static void AssertTimeSpansMatch(int actual, int hours, int minutes, bool isMultiDayHearing) - { - var actualDuration = TimeSpan.FromMinutes(actual); - var expectedDuration = isMultiDayHearing ? TimeSpan.FromHours(8) : TimeSpan.FromHours(hours).Add(TimeSpan.FromMinutes(minutes)); - actualDuration.Should().Be(expectedDuration); - } - - public static void AssertCreatedBy(string actual, string expected) - { - actual.Should().Be(expected); - } - - public static void AssertHearingParticipants(List participants, List testHearingParticipants, string organisation) - { - participants.Count.Should().Be(testHearingParticipants.Count); - foreach (var actualParticipant in participants) - { - var expectedParticipant = testHearingParticipants.First(x => x.Lastname.ToLower().Equals(actualParticipant.LastName.ToLower())); - if (expectedParticipant.Role.ToLower() != "judge") - { - actualParticipant.ContactEmail.Should().Be(expectedParticipant.AlternativeEmail); - } - - if (!string.IsNullOrEmpty(expectedParticipant.Interpretee)) - { - var interpretee = participants.FirstOrDefault(p => p.DisplayName == expectedParticipant.Interpretee); - actualParticipant.LinkedParticipants.Single(p => p.LinkedId == interpretee.Id).Should().NotBeNull(); - interpretee.LinkedParticipants.Single(p => p.LinkedId == actualParticipant.Id).Should().NotBeNull(); - } - - actualParticipant.CaseRoleName.Should().Be(expectedParticipant.CaseRoleName); - // actualParticipant.DisplayName.Should().Be($"{expectedParticipant.Firstname} {expectedParticipant.Role}"); TODO: removed as workaround for new user naming conventions - actualParticipant.FirstName.Should().Be(expectedParticipant.Firstname); - actualParticipant.HearingRoleName.Should().Be(expectedParticipant.HearingRoleName); - actualParticipant.LastName.Should().Be(expectedParticipant.Lastname); - var role = expectedParticipant.Role.ToLower().Equals("judge") ? "Judge" : expectedParticipant.Role; - actualParticipant.UserRoleName.Should().Be(role); - if (!expectedParticipant.HearingRoleName.Equals(PartyRole.Representative.Name)) continue; - actualParticipant.Organisation.Should().Be(organisation); - actualParticipant.Representee.Should().Be(expectedParticipant.Representee); - } - } - - public static void AssertUpdatedStatus(HearingDetailsResponse hearing, string updatedBy, DateTime updatedDate) - { - hearing.UpdatedBy.Should().Be(updatedBy); - hearing.UpdatedDate.ToLocalTime().ToShortTimeString().Should().BeOneOf(updatedDate.ToLocalTime().AddMinutes(-1).ToShortTimeString(), updatedDate.ToLocalTime().ToShortTimeString(), updatedDate.ToLocalTime().AddMinutes(1).ToShortTimeString()); - } - } -} diff --git a/AdminWebsite/AdminWebsite.AcceptanceTests/Data/CallbackEvent.cs b/AdminWebsite/AdminWebsite.AcceptanceTests/Data/CallbackEvent.cs deleted file mode 100644 index 36ef04679..000000000 --- a/AdminWebsite/AdminWebsite.AcceptanceTests/Data/CallbackEvent.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System; -using VideoApi.Contract.Enums; - - -namespace AdminWebsite.AcceptanceTests.Data -{ - public class CallbackEvent - { - public string EventId { get; set; } - public EventType EventType { get; set; } - public DateTime TimeStampUtc { get; set; } - public Guid ConferenceId { get; set; } - public Guid ParticipantId { get; set; } - - public string TransferFrom { get; set; } - - public string TransferTo { get; set; } - - public string Reason { get; set; } - } -} diff --git a/AdminWebsite/AdminWebsite.AcceptanceTests/Data/ConferenceEventRequestBuilder.cs b/AdminWebsite/AdminWebsite.AcceptanceTests/Data/ConferenceEventRequestBuilder.cs deleted file mode 100644 index 0c82a146a..000000000 --- a/AdminWebsite/AdminWebsite.AcceptanceTests/Data/ConferenceEventRequestBuilder.cs +++ /dev/null @@ -1,55 +0,0 @@ -using System; -using VideoApi.Contract.Enums; -using VideoApi.Contract.Requests; -using RoomType = AdminWebsite.Testing.Common.Data.RoomType; - -namespace AdminWebsite.AcceptanceTests.Data -{ - public class ConferenceEventRequestBuilder - { - private readonly ConferenceEventRequest _request; - - public ConferenceEventRequestBuilder() - { - _request = new ConferenceEventRequest() - { - EventId = Guid.NewGuid().ToString(), - Reason = "Automated", - TimeStampUtc = DateTime.UtcNow, - TransferFrom = RoomType.WaitingRoom, - TransferTo = RoomType.WaitingRoom - }; - } - - public ConferenceEventRequestBuilder FromRoomType(string roomType) - { - _request.TransferTo = roomType; - return this; - } - - public ConferenceEventRequestBuilder WithConferenceId(Guid conferenceId) - { - _request.ConferenceId = conferenceId.ToString(); - return this; - } - - public ConferenceEventRequestBuilder WithParticipantId(Guid? participantId) - { - if (participantId == null) - throw new DataMisalignedException("Participant Id cannot be null"); - _request.ParticipantId = participantId.ToString(); - return this; - } - - public ConferenceEventRequestBuilder WithEventType(EventType eventType) - { - _request.EventType = eventType; - return this; - } - - public ConferenceEventRequest Build() - { - return _request; - } - } -} diff --git a/AdminWebsite/AdminWebsite.AcceptanceTests/Data/DateFormats.cs b/AdminWebsite/AdminWebsite.AcceptanceTests/Data/DateFormats.cs deleted file mode 100644 index 90b52756e..000000000 --- a/AdminWebsite/AdminWebsite.AcceptanceTests/Data/DateFormats.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System.Globalization; - -namespace AdminWebsite.AcceptanceTests.Data -{ - public static class DateFormats - { - public static string LocalDateFormat(bool runningOnSaucelabs) - { - if (runningOnSaucelabs) return new CultureInfo("es-PR").DateTimeFormat.ShortDatePattern; - return CultureInfo.CurrentCulture.Name.ToLower().Equals("en-us") || CultureInfo.CurrentCulture.TwoLetterISOLanguageName.ToLower().Equals("iv") - ? new CultureInfo("en-GB").DateTimeFormat.ShortDatePattern - : CultureInfo.CurrentUICulture.DateTimeFormat.ShortDatePattern; - } - - public static string HearingSummaryDate = "dddd dd MMMM yyyy, h:mmtt"; - public static string AudioScheduledDate = "dd MMMM yyyy"; - public static string HearingSummaryDateMultiDays = "dddd dd MMMM yyyy"; - public static string HearingSummaryTimeMultiDays = "h:mmtt"; - - } -} diff --git a/AdminWebsite/AdminWebsite.AcceptanceTests/Data/HearingDetails.cs b/AdminWebsite/AdminWebsite.AcceptanceTests/Data/HearingDetails.cs deleted file mode 100644 index 669707c6d..000000000 --- a/AdminWebsite/AdminWebsite.AcceptanceTests/Data/HearingDetails.cs +++ /dev/null @@ -1,14 +0,0 @@ -using AcceptanceTests.Common.Model.Case; -using AcceptanceTests.Common.Model.Hearing; - -namespace AdminWebsite.AcceptanceTests.Data -{ - public class HearingDetails - { - public string CaseNumber { get; set; } - public string CaseName { get; set; } - public HearingType HearingType { get; set; } - public CaseType CaseType { get; set; } - public bool DoNotSendQuestionnaires { get; set; } - } -} diff --git a/AdminWebsite/AdminWebsite.AcceptanceTests/Data/HearingRequestBuilder.cs b/AdminWebsite/AdminWebsite.AcceptanceTests/Data/HearingRequestBuilder.cs deleted file mode 100644 index 969ff5933..000000000 --- a/AdminWebsite/AdminWebsite.AcceptanceTests/Data/HearingRequestBuilder.cs +++ /dev/null @@ -1,52 +0,0 @@ -using System; -using System.Collections.Generic; -using TestApi.Contract.Dtos; -using TestApi.Contract.Enums; -using TestApi.Contract.Requests; - -namespace AdminWebsite.AcceptanceTests.Data -{ - internal class HearingRequestBuilder - { - private readonly CreateHearingRequest _request; - private const string DEFAULT_VENUE = "Birmingham Civil and Family Justice Centre"; - private const string CACD_CaseTypeName = "Court of Appeal Criminal Division"; - - public HearingRequestBuilder() - { - _request = new CreateHearingRequest() - { - Application = Application.AdminWeb, - AudioRecordingRequired = false, - QuestionnaireNotRequired = false, - ScheduledDateTime = DateTime.UtcNow.AddHours(1), - TestType = TestType.Automated, - Users = new List(), - Venue = DEFAULT_VENUE - }; - } - - public HearingRequestBuilder WithUsers(List users) - { - _request.Users = users; - return this; - } - - public HearingRequestBuilder WithAudioRecordingRequired(bool audioRecording) - { - _request.AudioRecordingRequired = audioRecording; - return this; - } - - public CreateHearingRequest Build() - { - return _request; - } - - public HearingRequestBuilder WithCACDCaseType() - { - _request.CaseType = CACD_CaseTypeName; - return this; - } - } -} diff --git a/AdminWebsite/AdminWebsite.AcceptanceTests/Data/Test.cs b/AdminWebsite/AdminWebsite.AcceptanceTests/Data/Test.cs deleted file mode 100644 index 5ac738bb2..000000000 --- a/AdminWebsite/AdminWebsite.AcceptanceTests/Data/Test.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System.Collections.Generic; -using AcceptanceTests.Common.Configuration.Users; -using AcceptanceTests.Common.Data.TestData; -using AdminWebsite.AcceptanceTests.Data.TestData; -using BookingsApi.Contract.V1.Responses; -using VideoApi.Contract.Responses; - -namespace AdminWebsite.AcceptanceTests.Data -{ - public class Test - { - public string CreatedBy { get; set; } - public List HearingParticipants { get; set; } - public HearingDetails HearingDetails { get; set; } - public HearingSchedule HearingSchedule { get; set; } - public AssignJudge AssignJudge { get; set; } - public AddParticipant AddParticipant { get; set; } - public bool SubmittedAndCreatedNewAadUsers { get; set; } = false; - public CommonData CommonData { get; set; } - public DefaultData TestData { get; set; } - public ConferenceDetailsResponse ConferenceResponse { get; set; } - public HearingDetailsResponse HearingResponse { get; set; } - public VideoAccessPoints VideoAccessPoints { get; set; } - } -} diff --git a/AdminWebsite/AdminWebsite.AcceptanceTests/Data/TestData/CommonData.xml b/AdminWebsite/AdminWebsite.AcceptanceTests/Data/TestData/CommonData.xml deleted file mode 100644 index cdd7693bd..000000000 --- a/AdminWebsite/AdminWebsite.AcceptanceTests/Data/TestData/CommonData.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - @ondemand.eu-central-1.saucelabs.com:80/wd/hub - - - video-hearings@justice.gov.uk - 0300 303 0655 - - - login.microsoftonline.com - - diff --git a/AdminWebsite/AdminWebsite.AcceptanceTests/Data/TestData/DefaultData.cs b/AdminWebsite/AdminWebsite.AcceptanceTests/Data/TestData/DefaultData.cs deleted file mode 100644 index 0be0a58ab..000000000 --- a/AdminWebsite/AdminWebsite.AcceptanceTests/Data/TestData/DefaultData.cs +++ /dev/null @@ -1,80 +0,0 @@ -using System; - -namespace AdminWebsite.AcceptanceTests.Data.TestData -{ - public class DefaultData - { - public HearingDetails HearingDetails { get; set; } - public HearingSchedule HearingSchedule { get; set; } - public AssignJudge AssignJudge { get; set; } - public AddParticipant AddParticipant { get; set; } - public OtherInformationDetails OtherInformationDetails { get; set; } - public BookingDetailsPage BookingDetailsPage { get; set; } - public VideoAccessPoints VideoAccessPoints { get; set; } - } - - public class HearingDetails - { - public string CaseType { get; set; } - public string HearingType { get; set; } - public bool DoNotSendQuestionnaires { get; set; } - } - - public class HearingSchedule - { - public int DurationHours { get; set; } = 0; - public int DurationMinutes { get; set; } = 0; - public string HearingVenue { get; set; } - public string Room { get; set; } - public DateTime ScheduledDate { get; set; } - public int NumberOfMultiDays { get; set; } - public bool MultiDays { get; set; } - public DateTime EndHearingDate { get; set; } - } - - public class AssignJudge - { - public bool AudioRecord { get; set; } - public bool AddNewStaff { get; set; } - } - - public class AddParticipant - { - public Participant Participant { get; set; } - } - - public class Participant - { - public string NewUserPrefix { get; set; } - public string Title { get; set; } - public string Phone { get; set; } - public string Organisation { get; set; } - } - - public class OtherInformationDetails - { - public string OtherInformation { get; set; } - } - - public class Questionnaire - { - public string SelfTestQuestion1 { get; set; } - public string SelfTestQuestion2 { get; set; } - public string IndividualQuestion { get; set; } - public string RepresentativeQuestion { get; set; } - public string ExtendedAnswer { get; set; } - public string UnansweredQuestion { get; set; } - } - - public class BookingDetailsPage - { - public string CancelReason { get; set; } - public string CancelReason2 { get; set; } - public string DetailReason { get; set; } - } - - public class VideoAccessPoints - { - public string DisplayName { get; set; } - } -} diff --git a/AdminWebsite/AdminWebsite.AcceptanceTests/Data/TestData/DefaultData.xml b/AdminWebsite/AdminWebsite.AcceptanceTests/Data/TestData/DefaultData.xml deleted file mode 100644 index be214425d..000000000 --- a/AdminWebsite/AdminWebsite.AcceptanceTests/Data/TestData/DefaultData.xml +++ /dev/null @@ -1,45 +0,0 @@ - - - - Generic - Automated Test - false - - - 00 - 45 - 3 - Birmingham Civil and Family Justice Centre - 1 - - - false - - - - Automation_ - Mrs - 01234567890 - MoJ - - - - Endpoint 001 - CourtRoom1 - - - |JudgeEmail|test@test.com|JudgePhone|01234567890|OtherInformation|Other Info - - - Could you see yourself on the screen in the camera window? - Could you see the bar moving when you spoke? - Is there anything you'd like the court to take into account when it decides which type of hearing will be suitable? - Is there anything you'd like the court to know that could affect this hearing taking place by video? - An extended answer - Could you see and hear the video clearly? - - - Abandonment (not heard from all parties) - Other (please provide details) - Hearing cancelled due to unprecedented circumstances! - - diff --git a/AdminWebsite/AdminWebsite.AcceptanceTests/Data/TestData/DefaultDataManager.cs b/AdminWebsite/AdminWebsite.AcceptanceTests/Data/TestData/DefaultDataManager.cs deleted file mode 100644 index 7d9da1142..000000000 --- a/AdminWebsite/AdminWebsite.AcceptanceTests/Data/TestData/DefaultDataManager.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System.IO; -using AcceptanceTests.Common.Data.Helpers; - -namespace AdminWebsite.AcceptanceTests.Data.TestData -{ - public class DefaultDataManager - { - public DefaultData SerialiseTestData(string path = "Data/TestData/DefaultData.xml") - { - var xmlInputData = File.ReadAllText(path); - return XmlSerialiser.Deserialize(xmlInputData); - } - } -} diff --git a/AdminWebsite/AdminWebsite.AcceptanceTests/Data/UserToUserAccountMapper.cs b/AdminWebsite/AdminWebsite.AcceptanceTests/Data/UserToUserAccountMapper.cs deleted file mode 100644 index 9e9867207..000000000 --- a/AdminWebsite/AdminWebsite.AcceptanceTests/Data/UserToUserAccountMapper.cs +++ /dev/null @@ -1,29 +0,0 @@ -using System.Collections.Generic; -using AcceptanceTests.Common.Configuration.Users; -using TestApi.Contract.Dtos; - -namespace AdminWebsite.AcceptanceTests.Data -{ - public static class UserToUserAccountMapper - { - public static UserAccount Map(UserDto user) - { - return new UserAccount() - { - AlternativeEmail = user.ContactEmail, - CaseRoleName = null, - DefaultParticipant = false, - DisplayName = user.DisplayName, - Firstname = user.FirstName, - HearingRoleName = null, - HearingTypes = new List(), - Key = user.LastName, - Lastname = user.LastName, - Representee = null, - Reference = null, - Role = user.UserType.ToString(), - Username = user.Username - }; - } - } -} diff --git a/AdminWebsite/AdminWebsite.AcceptanceTests/Features/Accessibility.feature b/AdminWebsite/AdminWebsite.AcceptanceTests/Features/Accessibility.feature deleted file mode 100644 index a2e333959..000000000 --- a/AdminWebsite/AdminWebsite.AcceptanceTests/Features/Accessibility.feature +++ /dev/null @@ -1,69 +0,0 @@ -Feature: Accessibility - In order to ensure admin web is accessible to all users - As a service - I want to check each page for potential accessibility issues - -@Accessibility -Scenario: Dashboard page accessibility - Given the Video Hearings Officer user has progressed to the Dashboard page - Then the page should be accessible - -@Accessibility -Scenario: Hearing Details page accessibility - Given the Video Hearings Officer user has progressed to the Hearing Details page - Then the page should be accessible - -@Accessibility -Scenario: Hearing Schedule page accessibility - Given the Video Hearings Officer user has progressed to the Hearing Schedule page - Then the page should be accessible - -@Accessibility -Scenario: Assign Judge page accessibility - Given the Video Hearings Officer user has progressed to the Assign Judge page - Then the page should be accessible - -@Accessibility -Scenario: Add Participants page accessibility - Given the Video Hearings Officer user has progressed to the Add Participants page - Then the page should be accessible - -@Accessibility -Scenario: Other Information page accessibility - Given the Video Hearings Officer user has progressed to the Other Information page - Then the page should be accessible - -@Accessibility -Scenario: Summary page accessibility - Given the Video Hearings Officer user has progressed to the Summary page - Then the page should be accessible - -@Accessibility -Scenario: Booking Confirmation page accessibility - Given the Video Hearings Officer user has progressed to the Booking Confirmation page - Then the page should be accessible - -@Accessibility -Scenario: Bookings List page accessibility - Given the Video Hearings Officer user has progressed to the Bookings List page - Then the page should be accessible - -@Accessibility -Scenario: Booking Details page accessibility - Given the Video Hearings Officer user has progressed to the Booking Details page - Then the page should be accessible - -@Accessibility -Scenario: Questionnaire page accessibility - Given the Video Hearings Officer user has progressed to the Questionnaire page - Then the page should be accessible - -@Accessibility -Scenario: Get Audio Link File accessibility - Given the Video Hearings Officer user has progressed to the Get Audio File page - Then the page should be accessible - -@Accessibility -Scenario: Change Password page accessibility - Given the Video Hearings Officer user has progressed to the Change Password page - Then the page should be accessible \ No newline at end of file diff --git a/AdminWebsite/AdminWebsite.AcceptanceTests/Features/AddParticipants.feature b/AdminWebsite/AdminWebsite.AcceptanceTests/Features/AddParticipants.feature deleted file mode 100644 index fc6637f37..000000000 --- a/AdminWebsite/AdminWebsite.AcceptanceTests/Features/AddParticipants.feature +++ /dev/null @@ -1,76 +0,0 @@ -Feature: Add Participants - As a VH-Officer - I need to be able to assign a courtroom account to a hearing - So that a judge is assigned the hearing - -Scenario: Add Participants - Given the Video Hearings Officer user has progressed to the Add Participants page - When the user completes the add participants form - Then the user is on the Video Access Points page - -@Smoketest-Extended -Scenario: Edit New Participant - Given the Video Hearings Officer user has progressed to the Booking Details page - When the user edits a new participant - Then the participant details are updated - -@VIH-4194 -Scenario: Cannot Add Participants with reform email address - Given the Video Hearings Officer user has progressed to the Add Participants page - When the user attempts to add a participant with a reform email - Then an error message is displayed for the invalid email - -Scenario: Add Participant as Interpreter - Given the Video Hearings Officer user has progressed to the Add Participants page - When the user completes the add participants form with an Interpreter - And the user has progressed to the Summary page - Then the user views the information on the summary form - -@VIH-6938 -Scenario: Adding Interpreter sets and disables audio recording option - Given the Video Hearings Officer user has progressed to the Add Participants page - When the user completes the add participants form with an Interpreter - And the user has progressed to the Other Information page - Then audio recording is selected by default with options disabled - -Scenario: Adding participant sets and enables audio recording option - Given the Video Hearings Officer user has progressed to the Add Participants page - When the user completes the add participants form - And the user has progressed to the Other Information page - Then audio recording is selected by default with options enabled - -Scenario: Edit Audio Recording option - Given the Video Hearings Officer user has progressed to the Other information page - When the user sets audio recording to No - Then audio recording is set to No - -Scenario: Removing Participant and Interpreter - Given the Video Hearings Officer user has progressed to the Add Participants page - When the user completes the add participants form with an Interpreter And Litigant In Person - And the user has progressed to the Summary page - And the user removes participant - Then the user views the information on the summary form - -Scenario: Removing Interpreter - Given the Video Hearings Officer user has progressed to the Add Participants page - When the user completes the add participants form with an Interpreter - And the user has progressed to the Summary page - And the user removes Interpreter - Then the user views the information on the summary form - -Scenario: Edit Interpreter - Given the Video Hearings Officer user has progressed to the Add Participants page - And the user completes the add participants form with an Interpreter - When the user adds a Litigant in person - And the user edits an Interpreter - And the user has progressed to the summary page - Then the user views the information on the summary form - -Scenario: Edit Interpreter After Saving Booking - Given the Video Hearings Officer user has progressed to the Add Participants page - And the user completes the add participants form with an Interpreter - And the user has progressed to the Booking Confirmation page - When the user edits booking and adds a Litigant in person - And the user has progressed to the summary page - And the user edits a saved Interpreter - Then the user views the information on the summary form diff --git a/AdminWebsite/AdminWebsite.AcceptanceTests/Features/AssignJudge.feature b/AdminWebsite/AdminWebsite.AcceptanceTests/Features/AssignJudge.feature deleted file mode 100644 index 30f731632..000000000 --- a/AdminWebsite/AdminWebsite.AcceptanceTests/Features/AssignJudge.feature +++ /dev/null @@ -1,20 +0,0 @@ -Feature: Assign Judge - As a VH-Officer - I need to be able to assign a courtroom account to a hearing - So that a judge is assigned the hearing - -Scenario: Assign Judge - Given the Video Hearings Officer user has progressed to the Assign Judge page - When the user completes the assign judge form - Then the user is on the Add Participants page - -Scenario: Edit Audio Recording - Given the Video Hearings Officer user has progressed to the Booking Details page - When the user edits the audio recording - Then the details are updated - -@VIH-7159 -Scenario: Assign Judge With Email and Phone - Given the Video Hearings Officer user has progressed to the Assign Judge page - When the user completes the assign judge form with phone and email - Then the email and phone details are updated \ No newline at end of file diff --git a/AdminWebsite/AdminWebsite.AcceptanceTests/Features/BookingConfirmation.feature b/AdminWebsite/AdminWebsite.AcceptanceTests/Features/BookingConfirmation.feature deleted file mode 100644 index 8ec7e6e55..000000000 --- a/AdminWebsite/AdminWebsite.AcceptanceTests/Features/BookingConfirmation.feature +++ /dev/null @@ -1,21 +0,0 @@ -Feature: Booking Confirmation - As a VH-Officer - I need to be able to check that the information is correct before I submit the form - So that I can reduce the chances of mistakes on the booking - -Scenario: Booking Confirmation - Given the Video Hearings Officer user has progressed to the Booking Confirmation page - When the user views the booking confirmation form - And the user clicks the Return to dashboard link - Then the user is on the Dashboard page - -Scenario: Booking Confirmation Book Another Hearing - Given the Video Hearings Officer user has progressed to the Booking Confirmation page - When the user views the booking confirmation form - And the user clicks the Book another hearing button - Then the user is on the Hearing Details page - -Scenario: Email Notification For Newly Added Participants - Given the Video Hearings Officer user has progressed to the Booking Confirmation page - When the user views the booking confirmation form - Then the participant has been notified \ No newline at end of file diff --git a/AdminWebsite/AdminWebsite.AcceptanceTests/Features/BookingDetails.feature b/AdminWebsite/AdminWebsite.AcceptanceTests/Features/BookingDetails.feature deleted file mode 100644 index 688ee4d1e..000000000 --- a/AdminWebsite/AdminWebsite.AcceptanceTests/Features/BookingDetails.feature +++ /dev/null @@ -1,58 +0,0 @@ -Feature: Booking Details - As a VH-Officer - I need to be able to view the details of a booking - So that I can access the hearing information - -@Smoketest @Smoketest-Extended -Scenario: Bookings Details for single day hearing - Given the Video Hearings Officer user has progressed to the Booking Details page - When the user views the booking details - And the user confirms the hearing - Then the hearing is available in video web - And the conference details match the hearing - -@Smoketest @Smoketest-Extended -Scenario: Bookings Details for multi days hearing - Given the Video Hearings Officer user has progressed to the Booking Details page of a multi days hearing - When the user views the booking details - And the user confirms all the hearings - Then the hearings are available in video web - And the conference details match the hearing - -Scenario: Cancel a booked hearing - Given the Video Hearings Officer user has progressed to the Booking Details page - When the user cancels the hearing - Then the hearing is cancelled - -Scenario: Cancel a booked hearing without reason - Given the Video Hearings Officer user has progressed to the Booking Details page - When the user cancels the hearing without a cancel reason - Then an error message is displayed and hearing is not cancelled - -Scenario: Cancel a booked hearing with Cancel Reason - Given the Video Hearings Officer user has progressed to the Booking Details page - When the user cancels the hearing with other reason and no text - Then an error message is displayed for the details box and hearing is not cancelled - -Scenario: Cancel a booked hearing with Other cancel reason - Given the Video Hearings Officer user has progressed to the Booking Details page - When the user cancels the hearing with other reason and detail text - Then the hearing is cancelled - -@Smoketest-Extended -Scenario: Cancel a confirmed hearing - Given the Video Hearings Officer user has progressed to the Booking Details page - When the user confirms the hearing - Then the hearing is available in video web - When the user cancels the hearing - Then the hearing is cancelled - And the conference is deleted - -@VIH-2150 @VIH-3734 @Ignore -Scenario: Case admin user can view another users booking - Given the Video Hearings Officer user has progressed to the Booking Confirmation page - And the user logs out - And the Case Admin user has progressed to the Dashboard page - When the user navigates to the Bookings List page - And selects a booking - Then the user views the booking details diff --git a/AdminWebsite/AdminWebsite.AcceptanceTests/Features/BookingsList.feature b/AdminWebsite/AdminWebsite.AcceptanceTests/Features/BookingsList.feature deleted file mode 100644 index b37958f40..000000000 --- a/AdminWebsite/AdminWebsite.AcceptanceTests/Features/BookingsList.feature +++ /dev/null @@ -1,10 +0,0 @@ -Feature: Bookings List - As a VH-Officer - I need to be able to check all the future bookings - So that I can drill down for hearing information - -Scenario: Bookings List - Given the Video Hearings Officer user has progressed to the Bookings List page - When the user views the bookings list - And selects a booking - Then the user is on the Booking Details page \ No newline at end of file diff --git a/AdminWebsite/AdminWebsite.AcceptanceTests/Features/ChangePassword.feature b/AdminWebsite/AdminWebsite.AcceptanceTests/Features/ChangePassword.feature deleted file mode 100644 index 053935501..000000000 --- a/AdminWebsite/AdminWebsite.AcceptanceTests/Features/ChangePassword.feature +++ /dev/null @@ -1,10 +0,0 @@ -Feature: Change Password - In order to manage users - As an admin web user - I want the ability to reset users passwords - -@VIH-5416 @Smoketest-Extended @VIH-6530 -Scenario: Change Password - Given the Video Hearings Officer user has progressed to the Change Password page - When the user resets the participants password - Then the changed password message can be dismissed diff --git a/AdminWebsite/AdminWebsite.AcceptanceTests/Features/Dashboard.feature b/AdminWebsite/AdminWebsite.AcceptanceTests/Features/Dashboard.feature deleted file mode 100644 index 848542840..000000000 --- a/AdminWebsite/AdminWebsite.AcceptanceTests/Features/Dashboard.feature +++ /dev/null @@ -1,9 +0,0 @@ -Feature: Dashboard - In order to have an overview of the various user options - As a registered Video Hearings administrator - I want to be able to quickly access different screens within the application - -Scenario: Video Hearings Officer Dashboard - Given the Video Hearings Officer user has progressed to the Dashboard page - Then there are various dashboard options available - And they can navigate to the Open Government licence diff --git a/AdminWebsite/AdminWebsite.AcceptanceTests/Features/EditParticipantName.feature b/AdminWebsite/AdminWebsite.AcceptanceTests/Features/EditParticipantName.feature deleted file mode 100644 index c22db960e..000000000 --- a/AdminWebsite/AdminWebsite.AcceptanceTests/Features/EditParticipantName.feature +++ /dev/null @@ -1,29 +0,0 @@ -Feature: EditParticipantName - In order to manage users - As an admin web user - I want the ability to edit participant name - -@VIH-6637 -Scenario Outline: Edit Participant Name - Given the Video Hearings Officer user has progressed to the Edit Participant Name page - When I search for '' by contact email - And then update First and Last Name - Then the participant's details are updated - Examples: - | ParticipantTypes | - | Individual | - | Representative | - | PanelMember | - - -@VIH-6637 -Scenario: Edit Participant Does Not Exists - Given the Video Hearings Officer user has progressed to the Edit Participant Name page - When I search for 'Unknown' by contact email - Then the user does not exists message is displayed - -@VIH-6637 -Scenario: Edit Participant Should Not Retrieve Judge - Given the Video Hearings Officer user has progressed to the Edit Participant Name page - When I search for 'Judge' by contact email - Then the user is not allowed to be edited message is displayed \ No newline at end of file diff --git a/AdminWebsite/AdminWebsite.AcceptanceTests/Features/Errors.feature b/AdminWebsite/AdminWebsite.AcceptanceTests/Features/Errors.feature deleted file mode 100644 index 44d2bd3a4..000000000 --- a/AdminWebsite/AdminWebsite.AcceptanceTests/Features/Errors.feature +++ /dev/null @@ -1,4 +0,0 @@ -Feature: Error Pages - As a registered video hearings user - I would expect information error messages when things go wrong - So that I know how to resolve the issue diff --git a/AdminWebsite/AdminWebsite.AcceptanceTests/Features/GetAudioFile.feature b/AdminWebsite/AdminWebsite.AcceptanceTests/Features/GetAudioFile.feature deleted file mode 100644 index 20855c79a..000000000 --- a/AdminWebsite/AdminWebsite.AcceptanceTests/Features/GetAudioFile.feature +++ /dev/null @@ -1,21 +0,0 @@ -Feature: Get Audio File - In order to be able to retrieve audio recordings of hearings - As a Video Hearings Officier - I want to be able to search for audio recordings - -@VIH-5331 @Smoketest-Extended @AudioRecording -Scenario: Get Audio File - Given I have an audio recording for the closed conference - And the Video Hearings Officer user has progressed to the Get Audio File page - When I search for the audio recording by case number - Then the audio recording is retrieved - And the link can be retrieved - -#VIH-7984 -@Smoketest-Extended @AudioRecording -Scenario: Get Audio File For Main Hearing Room And Interpreter - Given I have an audio recording for the closed conference with an Interpreter - And the Video Hearings Officer user has progressed to the Get Audio File page - When I search for the audio recording by case number - Then the audio recording is retrieved - And the links can be retrieved \ No newline at end of file diff --git a/AdminWebsite/AdminWebsite.AcceptanceTests/Features/HearingDetails.feature b/AdminWebsite/AdminWebsite.AcceptanceTests/Features/HearingDetails.feature deleted file mode 100644 index 12f9002be..000000000 --- a/AdminWebsite/AdminWebsite.AcceptanceTests/Features/HearingDetails.feature +++ /dev/null @@ -1,21 +0,0 @@ -Feature: Hearing Details - As a VH-Officer - I need to be able to add hearing details - So that the correct information is available to all participants who are joining the hearing - -Scenario: Hearing Details - Given the Video Hearings Officer user has progressed to the Hearing Details page - When the user completes the hearing details form - Then the user is on the Hearing Schedule page - -@Smoketest-Extended -Scenario: Edit Hearing Details - Given the Video Hearings Officer user has progressed to the Booking Details page - When the user edits the hearing details - Then the details are updated - -#Scenario: Hearing details send questionnaires -# Given the Video Hearings Officer user has progressed to the Hearing Details page -# When the user elects to send the questionnaires -# And progresses from the Hearing Schedule page to the Summary page -# Then the questionnaires have been sent \ No newline at end of file diff --git a/AdminWebsite/AdminWebsite.AcceptanceTests/Features/HearingSchedule.feature b/AdminWebsite/AdminWebsite.AcceptanceTests/Features/HearingSchedule.feature deleted file mode 100644 index f9f210936..000000000 --- a/AdminWebsite/AdminWebsite.AcceptanceTests/Features/HearingSchedule.feature +++ /dev/null @@ -1,32 +0,0 @@ -Feature: Hearing Schedule - As a VH-Officer - I need to be able to add hearing schedule details - So that the correct information is available to all participants who are joining the hearing - -Scenario: Hearing Schedule - Given the Video Hearings Officer user has progressed to the Hearing Schedule page - When the user completes the hearing schedule form - Then the user is on the Assign Judge page - -Scenario: Hearing Schedule with multi days hearing - Given the Video Hearings Officer user has progressed to the Hearing Schedule page - When the user completes the hearing schedule form with multi days - Then the user is on the Assign Judge page - -@Smoketest-Extended -Scenario: Edit Hearing Schedule - Given the Video Hearings Officer user has progressed to the Booking Details page - When the user edits the hearing schedule - Then the details are updated - -Scenario: Hearing schedule date must be in the future - Given the Video Hearings Officer user has progressed to the Hearing Schedule page - When the user attempts to set a date in the past - Then an error message appears to enter a future date - And the user cannot proceed to the next page - -Scenario: Hearing schedule time must be in the future - Given the Video Hearings Officer user has progressed to the Hearing Schedule page - When the user attempts to set a time in the past - Then an error message appears to enter a future time - And the user cannot proceed to the next page \ No newline at end of file diff --git a/AdminWebsite/AdminWebsite.AcceptanceTests/Features/Login.feature b/AdminWebsite/AdminWebsite.AcceptanceTests/Features/Login.feature deleted file mode 100644 index cdcfd8610..000000000 --- a/AdminWebsite/AdminWebsite.AcceptanceTests/Features/Login.feature +++ /dev/null @@ -1,33 +0,0 @@ -Feature: Login - As a registered video hearings user - I would like to login and Logout - So that I can access and sign out of the application - -@Ignore -Scenario: Case Admin login - Given a Case Admin is on the login page - When they attempt to login with valid credentials - Then they should be on the Dashboard page - And they should be able to logout - -Scenario: Video Hearings Officer login - Given a Video Hearings Officer is on the login page - When they attempt to login with valid credentials - Then they should be on the Dashboard page - And they should be able to logout - -Scenario: Judge login denied - Given a Judge is on the login page - When they attempt to login with valid credentials - Then they should be on the Unauthorised page - -Scenario: Panel member login denied - Given a Panel Member is on the login page - When they attempt to login with valid credentials - Then they should be on the Unauthorised page - -@Winger -Scenario: Winger login denied - Given a Winger is on the login page - When they attempt to login with valid credentials - Then they should be on the Unauthorised page \ No newline at end of file diff --git a/AdminWebsite/AdminWebsite.AcceptanceTests/Features/OtherInformation.feature b/AdminWebsite/AdminWebsite.AcceptanceTests/Features/OtherInformation.feature deleted file mode 100644 index 53aff58f6..000000000 --- a/AdminWebsite/AdminWebsite.AcceptanceTests/Features/OtherInformation.feature +++ /dev/null @@ -1,15 +0,0 @@ -Feature: Other Information - As a VH-Officer - I need to be able to add other information to a hearing - So that I can keep a note of any extra hearing information - -Scenario: Other Information - Given the Video Hearings Officer user has progressed to the Other Information page - When the user completes the other information form - Then the user is on the Summary page - -@Smoketest-Extended -Scenario: Edit Other Information - Given the Video Hearings Officer user has progressed to the Booking Details page - When the user edits the other information - Then the details are updated \ No newline at end of file diff --git a/AdminWebsite/AdminWebsite.AcceptanceTests/Features/Questionnaire.feature b/AdminWebsite/AdminWebsite.AcceptanceTests/Features/Questionnaire.feature deleted file mode 100644 index 44fae0081..000000000 --- a/AdminWebsite/AdminWebsite.AcceptanceTests/Features/Questionnaire.feature +++ /dev/null @@ -1,16 +0,0 @@ -Feature: Questionnaire - In order to view submitted questionnaire answers - As a Video Hearings Offiver - I want to have access to those answers - -@Smoketest-Extended @QuestionnairesAlreadyPartiallyCompleted -Scenario: Questionnaire Individual - Given there is a hearing where an Individual participant has completed some questionnaire answers - And the Video Hearings Officer user has progressed to the Questionnaire page - Then the user can see a list of answers including the Individual specific answer - -@Smoketest-Extended @QuestionnairesAlreadyPartiallyCompleted -Scenario: Questionnaire Representative - Given there is a hearing where an Representative participant has completed some questionnaire answers - And the Video Hearings Officer user has progressed to the Questionnaire page - Then the user can see a list of answers including the Representative specific answer diff --git a/AdminWebsite/AdminWebsite.AcceptanceTests/Features/QuickLinks.feature b/AdminWebsite/AdminWebsite.AcceptanceTests/Features/QuickLinks.feature deleted file mode 100644 index 3c6803973..000000000 --- a/AdminWebsite/AdminWebsite.AcceptanceTests/Features/QuickLinks.feature +++ /dev/null @@ -1,41 +0,0 @@ -Feature: QuickLinks - As a VH-Officer - I need to be able to check that the information is correct before I submit the form - So that I can reduce the chances of mistakes on the booking - - -@Smoketest @Smoketest-Extended -Scenario: VHO Books Hearing Without Any Participants Except The Judge - Given the Video Hearings Officer user has progressed to the Add Participants page - When the user does not add participants and is on the Video Access Points page - Then the user is on the Video Access Points page - -@Smoketest @Smoketest-Extended -Scenario: VHO Confirms Booking Without Any Participants Except The Judge - Given the Video Hearings Officer user has progressed to the Add Participants page - When the user does not add participants and is on the Video Access Points page - And the user completes the Video access points form - And the user completes the other information form - And the user views the information on the summary form - And the user views the booking details after seeing the successful booking message - And the user confirms the hearing - Then the hearing is available in video web - And the conference details match the hearing - -Scenario: VHO Removes The Only Participant In The List - Given the Video Hearings Officer user has progressed to the Add Participants page - When the user adds an Individual - And the user is on the Video Access Points page - And the user completes the Video access points form - And the user completes the other information form - And the user removes Individual - Then the user views the information on the summary form - -Scenario: VHO Removes One Participant From The List Of Many Participants - Given the Video Hearings Officer user has progressed to the Add Participants page - When the user completes the add participants form - And the user is on the Video Access Points page - And the user completes the Video access points form - And the user completes the other information form - And the user removes Individual - Then the user views the information on the summary form \ No newline at end of file diff --git a/AdminWebsite/AdminWebsite.AcceptanceTests/Features/Summary.feature b/AdminWebsite/AdminWebsite.AcceptanceTests/Features/Summary.feature deleted file mode 100644 index dbeeb11ea..000000000 --- a/AdminWebsite/AdminWebsite.AcceptanceTests/Features/Summary.feature +++ /dev/null @@ -1,16 +0,0 @@ -Feature: Summary - As a VH-Officer - I need to be able to check that the information is correct before I submit the form - So that I can reduce the chances of mistakes on the booking - -@Smoketest-Extended -Scenario: Summary - Given the Video Hearings Officer user has progressed to the Summary page - When the user views the information on the summary form - Then the user is on the Booking Confirmation page - -@Smoketest-Extended -Scenario: Summary for multi days hearing - Given the Video Hearings Officer user has progressed to the Summary page of a multi days hearing - When the user views the information on the summary form - Then the user is on the Booking Confirmation page \ No newline at end of file diff --git a/AdminWebsite/AdminWebsite.AcceptanceTests/Features/TestHelpers.feature b/AdminWebsite/AdminWebsite.AcceptanceTests/Features/TestHelpers.feature deleted file mode 100644 index 766b2f3b6..000000000 --- a/AdminWebsite/AdminWebsite.AcceptanceTests/Features/TestHelpers.feature +++ /dev/null @@ -1,8 +0,0 @@ -Feature: Test Helpers - In order to reduce time manual testing - As a helper - I want to be able to execute certain functionality quickly - -@Ignore @KeepDataAfterTest -Scenario: Add hearings with questionnaire results - Given I have 10 hearings with questionnaire results diff --git a/AdminWebsite/AdminWebsite.AcceptanceTests/Features/VideoAccessPoints.feature b/AdminWebsite/AdminWebsite.AcceptanceTests/Features/VideoAccessPoints.feature deleted file mode 100644 index 126f51e58..000000000 --- a/AdminWebsite/AdminWebsite.AcceptanceTests/Features/VideoAccessPoints.feature +++ /dev/null @@ -1,14 +0,0 @@ -Feature: Video Access Points - As a VH-Officer - I need to be able to add video access points to a hearing - So that 0 or more video access points are assigned to the hearing - -Scenario: Add a video access endpoint - Given the Video Hearings Officer user has progressed to the Video access points page - When the user completes the Video access points form - Then the user is on the Other Information page - -Scenario: Edit a video access endpoint - Given the Video Hearings Officer user has progressed to the Booking Details page - When the user edits an endpoint display name - Then the details are updated diff --git a/AdminWebsite/AdminWebsite.AcceptanceTests/Helpers/DateHelper.cs b/AdminWebsite/AdminWebsite.AcceptanceTests/Helpers/DateHelper.cs deleted file mode 100644 index e947845dc..000000000 --- a/AdminWebsite/AdminWebsite.AcceptanceTests/Helpers/DateHelper.cs +++ /dev/null @@ -1,35 +0,0 @@ -using System; - -namespace AdminWebsite.AcceptanceTests.Helpers -{ - public class DateHelper - { - public static DateTime GetNextIfDayIfNotAWorkingDay(DateTime date) - { - while (IsWeekend(date)) - { - date = date.AddDays(1); - } - - return date; - } - - public static DateTime GetNextWorkingDay(DateTime date, int minDays) - { - var days = 0; - while (days < minDays) - { - days++; - date = date.AddDays(1); - date = GetNextIfDayIfNotAWorkingDay(date); - } - - return date; - } - - private static bool IsWeekend(DateTime date) - { - return date.DayOfWeek == DayOfWeek.Saturday || date.DayOfWeek == DayOfWeek.Sunday; - } - } -} \ No newline at end of file diff --git a/AdminWebsite/AdminWebsite.AcceptanceTests/Helpers/TestContext.cs b/AdminWebsite/AdminWebsite.AcceptanceTests/Helpers/TestContext.cs deleted file mode 100644 index 74a13340d..000000000 --- a/AdminWebsite/AdminWebsite.AcceptanceTests/Helpers/TestContext.cs +++ /dev/null @@ -1,29 +0,0 @@ -using System.Collections.Generic; -using AcceptanceTests.Common.Api.Hearings; -using AcceptanceTests.Common.AudioRecordings; -using AcceptanceTests.Common.Data.Time; -using AcceptanceTests.Common.Driver.Drivers; -using AdminWebsite.AcceptanceTests.Configuration; -using AdminWebsite.AcceptanceTests.Data; -using AdminWebsite.AcceptanceTests.Pages; -using AdminWebsite.Services.Models; -using TestApi.Contract.Dtos; -using Notify.Interfaces; - -namespace AdminWebsite.AcceptanceTests.Helpers -{ - public class TestContext - { - public TestApiManager Api { get; set; } - public List AzureStorage { get; set; } - public UserDto CurrentUser { get; set; } - public DriverSetup Driver { get; set; } - public Page Route { get; set; } - public Test Test { get; set; } - public TimeZone TimeZone { get; set; } - public string Token { get; set; } - public List Users { get; set; } - public AdminWebConfig WebConfig { get; set; } - public IAsyncNotificationClient NotifyClient { get; set; } - } -} diff --git a/AdminWebsite/AdminWebsite.AcceptanceTests/Helpers/UserDetailsResponseToUsersMapper.cs b/AdminWebsite/AdminWebsite.AcceptanceTests/Helpers/UserDetailsResponseToUsersMapper.cs deleted file mode 100644 index 0118b1a76..000000000 --- a/AdminWebsite/AdminWebsite.AcceptanceTests/Helpers/UserDetailsResponseToUsersMapper.cs +++ /dev/null @@ -1,30 +0,0 @@ -using System.Collections.Generic; -using System.Linq; -using TestApi.Contract.Dtos; -using TestApi.Contract.Responses; - -namespace AdminWebsite.AcceptanceTests.Helpers -{ - public static class UserDetailsResponseToUsersMapper - { - public static List Map(List usersResponses) - { - return usersResponses.Select(user => new UserDto() - { - Application = user.Application, - ContactEmail = user.ContactEmail, - CreatedDate = user.CreatedDate, - DisplayName = user.DisplayName, - FirstName = user.FirstName, - Id = user.Id, - IsProdUser = user.IsProdUser, - LastName = user.LastName, - Number = user.Number, - TestType = user.TestType, - UserType = user.UserType, - Username = user.Username - }) - .ToList(); - } - } -} diff --git a/AdminWebsite/AdminWebsite.AcceptanceTests/Helpers/Users.cs b/AdminWebsite/AdminWebsite.AcceptanceTests/Helpers/Users.cs deleted file mode 100644 index 87563ac10..000000000 --- a/AdminWebsite/AdminWebsite.AcceptanceTests/Helpers/Users.cs +++ /dev/null @@ -1,103 +0,0 @@ -using System.Collections.Generic; -using System.Data; -using System.Linq; -using TestApi.Contract.Dtos; -using TestApi.Contract.Enums; - -namespace AdminWebsite.AcceptanceTests.Helpers -{ - public static class Users - { - public static UserDto GetDefaultParticipantUser(List users) - { - return users.FirstOrDefault(x => x.UserType == UserType.Individual); - } - - public static UserDto GetJudgeUser(List users) - { - return users.FirstOrDefault(x => x.UserType == UserType.Judge); - } - - public static UserDto GetIndividualUser(List users) - { - return users.FirstOrDefault(x => x.UserType == UserType.Individual); - } - - public static UserDto GetRepresentativeUser(List users) - { - return users.FirstOrDefault(x => x.UserType == UserType.Representative); - } - - public static UserDto GetPanelMemberUser(List users) - { - return users.FirstOrDefault(x => x.UserType == UserType.PanelMember); - } - - public static UserDto GetWingerUser(List users) - { - return users.FirstOrDefault(x => x.UserType == UserType.Winger); - } - - public static UserDto GetUserFromDisplayName(List users, string displayName) - { - return users.FirstOrDefault(x => x.DisplayName.ToLower().Contains(displayName.ToLower().Replace(" ", ""))); - } - - public static UserDto GetUser(List users, string numberString, string user) - { - var number = GetNumberFromWords(numberString); - - if (user.ToLowerInvariant().Contains("judge")) - { - return users.First(x => x.UserType == UserType.Judge); - } - - if (user.ToLowerInvariant().Contains("individual")) - { - return GetAllUsersOfType(users, UserType.Individual)[number]; - } - - if (user.ToLowerInvariant().Contains("representative")) - { - return GetAllUsersOfType(users, UserType.Representative)[number]; - } - - if (user.ToLowerInvariant().Contains("panel member") || - user.ToLowerInvariant().Contains("panelmember")) - { - return GetAllUsersOfType(users, UserType.PanelMember)[number]; - } - - if (user.ToLowerInvariant().Contains("observer")) - { - return GetAllUsersOfType(users, UserType.Observer)[number]; - } - - if (user.ToLowerInvariant().Contains("video hearings officer") || - user.ToLowerInvariant().Contains("videohearingsofficer")) - { - return users.First(x => x.UserType == UserType.VideoHearingsOfficer); - } - - throw new DataException($"No matching user could be found from '{user}'"); - } - - private static int GetNumberFromWords(string text) - { - var numberTable = new Dictionary - { - {"one",1}, - {"two",2}, - {"three",3}, - {"four",4}, - {"five",5} - }; - return numberTable[text]; - } - - private static List GetAllUsersOfType(List users, UserType userType) - { - return users.FindAll(x => x.UserType == userType); - } - } -} diff --git a/AdminWebsite/AdminWebsite.AcceptanceTests/Hooks/ConfigHooks.cs b/AdminWebsite/AdminWebsite.AcceptanceTests/Hooks/ConfigHooks.cs deleted file mode 100644 index 79966246f..000000000 --- a/AdminWebsite/AdminWebsite.AcceptanceTests/Hooks/ConfigHooks.cs +++ /dev/null @@ -1,174 +0,0 @@ -using System.Collections.Generic; -using System.Threading.Tasks; -using AcceptanceTests.Common.Configuration; -using AcceptanceTests.Common.Configuration.Users; -using AcceptanceTests.Common.Data.TestData; -using AcceptanceTests.Common.Exceptions; -using AdminWebsite.AcceptanceTests.Configuration; -using AdminWebsite.AcceptanceTests.Data; -using AdminWebsite.AcceptanceTests.Data.TestData; -using AdminWebsite.AcceptanceTests.Helpers; -using BookingsApi.Contract.V1.Responses; -using TestApi.Contract.Dtos; -using FluentAssertions; -using Microsoft.Extensions.Configuration; -using Microsoft.Extensions.Options; -using TechTalk.SpecFlow; -using ConfigurationManager = AcceptanceTests.Common.Configuration.ConfigurationManager; -using HearingDetails = AdminWebsite.AcceptanceTests.Data.HearingDetails; -using AdminWebsite.Security; -using AdminWebsite.Configuration; - -namespace AdminWebsite.AcceptanceTests.Hooks -{ - [Binding] - public sealed class ConfigHooks - { - private readonly IConfigurationRoot _configRoot; - - public ConfigHooks(TestContext context) - { - _configRoot = ConfigurationManager.BuildConfig("f99a3fe8-cf72-486a-b90f-b65c27da84ee", "ef943d1a-7506-483b-92b7-dc6e6b41270a"); - context.WebConfig = new AdminWebConfig(); - context.Users = new List(); - } - - [BeforeScenario(Order = (int)HooksSequence.ConfigHooks)] - public async Task RegisterSecrets(TestContext context) - { - RegisterAzureSecrets(context); - RegisterTestUserSecrets(context); - RegisterDefaultData(context); - RegisterHearingServices(context); - RegisterIsLive(context); - RegisterUsingEjud(context); - RegisterSeleniumElementTimeout(context); - RegisterWowzaSettings(context); - RegisterSauceLabsSettings(context); - RegisterKinlySettings(context); - RegisterNotifySettings(context); - RunningAdminWebLocally(context); - await GenerateBearerTokens(context); - SetBookingConfirmToggleStatus(context); - } - - private void RegisterAzureSecrets(TestContext context) - { - context.WebConfig.AzureAdConfiguration = Options.Create(_configRoot.GetSection("AzureAd").Get()).Value; - ConfigurationManager.VerifyConfigValuesSet(context.WebConfig.AzureAdConfiguration); - } - - private void RegisterTestUserSecrets(TestContext context) - { - context.WebConfig.TestConfig = Options.Create(_configRoot.GetSection("TestUserSecrets").Get()).Value; - context.WebConfig.TestConfig.TargetBrowser.Should().NotBeNull(); - context.WebConfig.TestConfig.TargetDevice.Should().NotBeNull(); - context.WebConfig.TestConfig.TargetOS.Should().NotBeNull(); - context.WebConfig.TestConfig.TestUsernameStem.Should().NotBeNull(); - context.WebConfig.TestConfig.TestUserPassword.Should().NotBeNull(); - } - - private static void RegisterDefaultData(TestContext context) - { - context.Test = new Test - { - AddParticipant = new AddParticipant(), - AssignJudge = new AssignJudge(), - CommonData = LoadXmlFile.SerialiseCommonData(), - HearingDetails = new HearingDetails(), - HearingParticipants = new List(), - HearingResponse = new HearingDetailsResponse(), - HearingSchedule = new HearingSchedule(), - TestData = new DefaultDataManager().SerialiseTestData(), - VideoAccessPoints = new VideoAccessPoints() - }; - context.Test.AddParticipant = context.Test.TestData.AddParticipant; - } - - private void RegisterHearingServices(TestContext context) - { - context.WebConfig.VhServices = GetTargetTestEnvironment() == string.Empty ? Options.Create(_configRoot.GetSection("VhServices").Get()).Value - : Options.Create(_configRoot.GetSection($"Testing.{GetTargetTestEnvironment()}.VhServices").Get()).Value; - if (context.WebConfig.VhServices == null && GetTargetTestEnvironment() != string.Empty) - { - throw new TestSecretsFileMissingException(GetTargetTestEnvironment()); - } - ConfigurationManager.VerifyConfigValuesSet(context.WebConfig.VhServices); - } - - private void RegisterIsLive(TestContext context) - { - context.WebConfig.IsLive = _configRoot.GetValue("IsLive"); - context.WebConfig.Should().NotBeNull(); - } - - private void RegisterUsingEjud(TestContext context) - { - context.WebConfig.UsingEjud = _configRoot.GetValue("UsingEjud"); - } - - private void RegisterSeleniumElementTimeout(TestContext context) - { - context.WebConfig.SeleniumElementTimeout = _configRoot.GetValue("SeleniumElementTimeout"); - } - - private void RegisterWowzaSettings(TestContext context) - { - context.WebConfig.Wowza = Options.Create(_configRoot.GetSection("WowzaConfiguration").Get()).Value; - ConfigurationManager.VerifyConfigValuesSet(context.WebConfig.Wowza); - } - - private void RegisterKinlySettings(TestContext context) - { - context.WebConfig.KinlyConfiguration = Options.Create(_configRoot.GetSection("KinlyConfiguration").Get()).Value; - context.WebConfig.KinlyConfiguration.ConferencePhoneNumber.Should().NotBeNullOrWhiteSpace(); - } - - private void RegisterSauceLabsSettings(TestContext context) - { - context.WebConfig.SauceLabsConfiguration = RunOnSauceLabsFromLocal() ? Options.Create(_configRoot.GetSection("LocalSaucelabs").Get()).Value - : Options.Create(_configRoot.GetSection("Saucelabs").Get()).Value; - if (!context.WebConfig.SauceLabsConfiguration!.RunningOnSauceLabs()) return; - context.WebConfig.SauceLabsConfiguration.SetRemoteServerUrlForDesktop(context.Test.CommonData.CommonConfig.SauceLabsServerUrl); - context.WebConfig.SauceLabsConfiguration.AccessKey.Should().NotBeNullOrWhiteSpace(); - context.WebConfig.SauceLabsConfiguration.Username.Should().NotBeNullOrWhiteSpace(); - context.WebConfig.SauceLabsConfiguration.RealDeviceApiKey.Should().NotBeNullOrWhiteSpace(); - } - - private static string GetTargetTestEnvironment() - { - return NUnit.Framework.TestContext.Parameters["TargetTestEnvironment"] ?? string.Empty; - } - - private static bool RunOnSauceLabsFromLocal() - { - return NUnit.Framework.TestContext.Parameters["RunOnSauceLabs"] != null && - NUnit.Framework.TestContext.Parameters["RunOnSauceLabs"].Equals("true"); - } - - private void RegisterNotifySettings(TestContext context) - { - context.WebConfig.NotifyConfiguration = Options.Create(_configRoot.GetSection("NotifyConfiguration").Get()).Value; - ConfigurationManager.VerifyConfigValuesSet(context.WebConfig.NotifyConfiguration); - } - - private static void RunningAdminWebLocally(TestContext context) - { - context.WebConfig.VhServices.RunningAdminWebLocally = context.WebConfig.VhServices.AdminWebUrl.Contains("localhost"); - } - - private static async Task GenerateBearerTokens(TestContext context) - { - var tokenProvider = new TokenProvider(Options.Create(context.WebConfig.AzureAdConfiguration)); - context.Token = await tokenProvider.GetClientAccessToken(context.WebConfig.AzureAdConfiguration.ClientId, context.WebConfig.AzureAdConfiguration.ClientSecret, context.WebConfig.VhServices.TestApiResourceId); - context.Token.Should().NotBeNullOrEmpty(); - } - - private void SetBookingConfirmToggleStatus(TestContext context) - { - var featureToggle = - new FeatureToggles(_configRoot["FeatureToggle:SDKKey"], _configRoot["AzureAd:ResourceId"]); - context.WebConfig.BookingConfirmToggle = featureToggle.BookAndConfirmToggle(); - } - } -} diff --git a/AdminWebsite/AdminWebsite.AcceptanceTests/Hooks/DataHooks.cs b/AdminWebsite/AdminWebsite.AcceptanceTests/Hooks/DataHooks.cs deleted file mode 100644 index 375faaabe..000000000 --- a/AdminWebsite/AdminWebsite.AcceptanceTests/Hooks/DataHooks.cs +++ /dev/null @@ -1,228 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Net; -using System.Net.Http; -using System.Threading.Tasks; -using AcceptanceTests.Common.Api.Helpers; -using AcceptanceTests.Common.AudioRecordings; -using AdminWebsite.AcceptanceTests.Data; -using AdminWebsite.AcceptanceTests.Helpers; -using AdminWebsite.Services; -using BookingsApi.Contract.V1.Requests; -using BookingsApi.Contract.V1.Requests.Enums; -using BookingsApi.Contract.V1.Responses; -using FluentAssertions; -using Microsoft.Extensions.Caching.Memory; -using TechTalk.SpecFlow; -using TestApi.Contract.Enums; -using TestApi.Contract.Requests; -using TestApi.Contract.Responses; -using VideoApi.Contract.Enums; -using VideoApi.Contract.Responses; -using RoomType = AdminWebsite.Testing.Common.Data.RoomType; - -namespace AdminWebsite.AcceptanceTests.Hooks -{ - [Binding] - public sealed class DataHooks - { - private const int ALLOCATE_USERS_FOR_MINUTES = 3; - private readonly TestContext _c; - private readonly ScenarioContext _scenario; - - public DataHooks(TestContext context, ScenarioContext scenario) - { - _c = context; - _scenario = scenario; - } - - [BeforeScenario(Order = (int)HooksSequence.DataHooks)] - public void AddExistingUsers(ScenarioContext scenario) - { - AllocateUsers(); - - var exist = CheckIfParticipantsAlreadyExistInTheDb(); - - if (exist && !scenario.ScenarioInfo.Tags.Contains("QuestionnairesAlreadyPartiallyCompleted")) return; - _c.Test.HearingResponse = CreateHearing(); - RefreshJudgeDropdownList(); - } - - private void AllocateUsers() - { - var userTypes = new List - { - UserType.Judge, - UserType.VideoHearingsOfficer - }; - - if (_scenario.ScenarioInfo.Tags.Contains(UserType.Winger.ToString())) - { - userTypes.Add(UserType.Winger); - userTypes.Add(UserType.Individual); - } - else - { - userTypes.Add(UserType.CaseAdmin); - userTypes.Add(UserType.Individual); - userTypes.Add(UserType.Representative); - userTypes.Add(UserType.PanelMember); - } - - var request = new AllocateUsersRequest() - { - Application = Application.AdminWeb, - ExpiryInMinutes = ALLOCATE_USERS_FOR_MINUTES, - IsProdUser = _c.WebConfig.IsLive, - IsEjud = _c.WebConfig.UsingEjud, - TestType = TestType.Automated, - UserTypes = userTypes - }; - NUnit.Framework.TestContext.WriteLine($"AllocateUsersRequest: request.Application {request.Application} request.ExpiryInMinutes {request.ExpiryInMinutes} request.IsProdUser {request.IsProdUser} request.IsEjud {request.IsEjud} request.TestType {request.TestType} request.UserTypes {request.UserTypes}"); - - var response = _c.Api.AllocateUsers(request); - NUnit.Framework.TestContext.WriteLine($"AllocateUsersRequest Response: {response.Content}"); - response.StatusCode.Should().Be(HttpStatusCode.OK); - response.Should().NotBeNull(); - var users = RequestHelper.Deserialise>(response.Content); - users.Should().NotBeNullOrEmpty(); - _c.Users = UserDetailsResponseToUsersMapper.Map(users); - _c.Users.Should().NotBeNullOrEmpty(); - } - - [BeforeScenario(Order = (int)HooksSequence.AudioRecording)] - public async Task AddAudioRecording(ScenarioContext scenario) - { - if (!scenario.ScenarioInfo.Tags.Contains("AudioRecording")) return; - - _c.Test.HearingResponse = CreateHearing(true); - _c.Test.ConferenceResponse = CreateConference(); - StartTheHearing(); - CloseTheConference(); - - var file = FileManager.CreateNewAudioFile("TestAudioFile.mp4", _c.Test.HearingResponse.Id.ToString()); - - _c.AzureStorage = new List - { - new AzureStorageManager() - .SetStorageAccountName(_c.WebConfig.Wowza.StorageAccountName) - .SetStorageAccountKey(_c.WebConfig.Wowza.StorageAccountKey) - .SetStorageContainerName(_c.WebConfig.Wowza.StorageContainerName) - .CreateBlobClient(_c.Test.HearingResponse.Id.ToString()) - }; - - await _c.AzureStorage[0].UploadAudioFileToStorage(file); - FileManager.RemoveLocalAudioFile(file); - } - - private bool CheckIfParticipantsAlreadyExistInTheDb() - { - var exist = false; - - foreach (var response in from user in _c.Users - where user.UserType != UserType.CaseAdmin && user.UserType != UserType.VideoHearingsOfficer - select _c.Api.GetPersonByUsername(user.Username)) - { - exist = response.StatusCode == HttpStatusCode.OK; - } - - return exist; - } - - private HearingDetailsResponse CreateHearing(bool withAudioRecording = false) - { - var isWinger = _c.Users.Any(x => x.UserType == UserType.Winger); - - var hearingRequest = isWinger - ? CreateHearingForWinger() - : new HearingRequestBuilder() - .WithUsers(_c.Users) - .WithAudioRecordingRequired(withAudioRecording) - .Build(); - - var hearingResponse = _c.Api.CreateHearing(hearingRequest); - hearingResponse.StatusCode.Should().Be(HttpStatusCode.Created); - var hearing = RequestHelper.Deserialise(hearingResponse.Content); - hearing.Should().NotBeNull(); - ParticipantsShouldExistInTheDb(hearing.Id); - NUnit.Framework.TestContext.WriteLine($"Hearing created with Hearing Id {hearing.Id}"); - return hearing; - } - - private CreateHearingRequest CreateHearingForWinger() - { - return new HearingRequestBuilder() - .WithUsers(_c.Users) - .WithCACDCaseType() - .WithAudioRecordingRequired(false) - .Build(); - } - - private ConferenceDetailsResponse CreateConference() - { - var vho = _c.Users.First(x => x.UserType == UserType.VideoHearingsOfficer); - - var request = new UpdateBookingStatusRequest() - { - UpdatedBy = vho.Username, - CancelReason = null, - Status = UpdateBookingStatus.Created - }; - - var response = _c.Api.ConfirmHearingToCreateConference(_c.Test.HearingResponse.Id, request); - response.StatusCode.Should().Be(HttpStatusCode.Created); - var conference = RequestHelper.Deserialise(response.Content); - NUnit.Framework.TestContext.WriteLine($"Conference created with Conference Id {conference.Id}"); - return conference; - } - - private void ParticipantsShouldExistInTheDb(Guid hearingId) - { - var hearingResponse = _c.Api.GetHearing(hearingId); - var hearing = RequestHelper.Deserialise(hearingResponse.Content); - hearing.Should().NotBeNull(); - foreach (var user in _c.Users.Where(user => - user.UserType != UserType.CaseAdmin && user.UserType != UserType.VideoHearingsOfficer)) - { - hearing.Participants.Any(x => x.LastName.Equals(user.LastName)).Should().BeTrue(); - } - } - - private void StartTheHearing() - { - var judge = _c.Test.ConferenceResponse.Participants.First(x => x.UserRole == UserRole.Judge); - - var request = new ConferenceEventRequestBuilder() - .WithConferenceId(_c.Test.ConferenceResponse.Id) - .WithParticipantId(judge.Id) - .WithEventType(EventType.Start) - .FromRoomType(null) - .Build(); - - var response = _c.Api.SendEvent(request); - response.StatusCode.Should().Be(HttpStatusCode.NoContent); - } - - private void CloseTheConference() - { - var judge = _c.Test.ConferenceResponse.Participants.First(x => x.UserRole == UserRole.Judge); - - var request = new ConferenceEventRequestBuilder() - .WithConferenceId(_c.Test.ConferenceResponse.Id) - .WithParticipantId(judge.Id) - .WithEventType(EventType.Close) - .FromRoomType(RoomType.HearingRoom) - .Build(); - - var response = _c.Api.SendEvent(request); - response.StatusCode.Should().Be(HttpStatusCode.NoContent); - } - - private void RefreshJudgeDropdownList() - { - var response = _c.Api.RefreshJudgesCache(); - response.IsSuccessful.Should().BeTrue(); - } - } -} \ No newline at end of file diff --git a/AdminWebsite/AdminWebsite.AcceptanceTests/Hooks/DriverHooks.cs b/AdminWebsite/AdminWebsite.AcceptanceTests/Hooks/DriverHooks.cs deleted file mode 100644 index 58343dca1..000000000 --- a/AdminWebsite/AdminWebsite.AcceptanceTests/Hooks/DriverHooks.cs +++ /dev/null @@ -1,100 +0,0 @@ -using System.Collections.Generic; -using AcceptanceTests.Common.Data.Time; -using AcceptanceTests.Common.Driver.Drivers; -using AcceptanceTests.Common.Driver.Settings; -using AdminWebsite.AcceptanceTests.Helpers; -using BoDi; -using TechTalk.SpecFlow; -using TestApi.Contract.Dtos; - -namespace AdminWebsite.AcceptanceTests.Hooks -{ - [Binding] - public sealed class DriverHooks - { - private Dictionary _browsers; - private readonly IObjectContainer _objectContainer; - - public DriverHooks(IObjectContainer objectContainer) - { - _objectContainer = objectContainer; - } - - [BeforeTestRun(Order = (int)HooksSequence.CleanUpDriverInstances)] - [AfterTestRun(Order = (int)HooksSequence.CleanUpDriverInstances)] - public static void KillAnyLocalProcesses() - { - DriverManager.KillAnyLocalDriverProcesses(); - } - - [BeforeScenario(Order = (int)HooksSequence.InitialiseBrowserHooks)] - public void InitialiseBrowserContainer() - { - _browsers = new Dictionary(); - _objectContainer.RegisterInstanceAs(_browsers); - } - - [BeforeScenario(Order = (int)HooksSequence.ConfigureDriverHooks)] - public void ConfigureDriver(TestContext context, ScenarioContext scenario) - { - context.WebConfig.TestConfig.TargetBrowser = DriverManager.GetTargetBrowser(NUnit.Framework.TestContext.Parameters["TargetBrowser"]); - context.WebConfig.TestConfig.TargetBrowserVersion = NUnit.Framework.TestContext.Parameters["TargetBrowserVersion"]; - context.WebConfig.TestConfig.TargetDevice = DriverManager.GetTargetDevice(NUnit.Framework.TestContext.Parameters["TargetDevice"]); - context.WebConfig.TestConfig.TargetDeviceName = NUnit.Framework.TestContext.Parameters["TargetDeviceName"]; - context.WebConfig.TestConfig.TargetOS = DriverManager.GetTargetOS(NUnit.Framework.TestContext.Parameters["TargetOS"]); - - var driverOptions = new DriverOptions() - { - TargetBrowser = context.WebConfig.TestConfig.TargetBrowser, - TargetBrowserVersion = context.WebConfig.TestConfig.TargetBrowserVersion, - TargetDevice = context.WebConfig.TestConfig.TargetDevice, - TargetOS = context.WebConfig.TestConfig.TargetOS - }; - - var sauceLabsOptions = new SauceLabsOptions() - { - EnableLogging = false, - Name = scenario.ScenarioInfo.Title - }; - - context.Driver = new DriverSetup(context.WebConfig.SauceLabsConfiguration, driverOptions, sauceLabsOptions); - } - - [BeforeScenario(Order = (int)HooksSequence.SetTimeZone)] - public void SetTimeZone(TestContext context) - { - context.TimeZone = new TimeZone(context.WebConfig.SauceLabsConfiguration.RunningOnSauceLabs(), context.WebConfig.TestConfig.TargetOS); - } - - [AfterScenario(Order = (int)HooksSequence.LogResultHooks)] - public void LogResult(TestContext context, ScenarioContext scenarioContext) - { - if (_browsers == null) return; - if (_browsers.Count.Equals(0)) - { - context.CurrentUser = Users.GetDefaultParticipantUser(context.Users); - var browser = new UserBrowser() - .SetBaseUrl(context.WebConfig.VhServices.AdminWebUrl) - .SetTargetBrowser(context.WebConfig.TestConfig.TargetBrowser) - .SetTargetDevice(context.WebConfig.TestConfig.TargetDevice) - .SetDriver(context.Driver); - _browsers.Add(context.CurrentUser, browser); - } - - DriverManager.LogTestResult( - context.WebConfig.SauceLabsConfiguration.RunningOnSauceLabs(), - _browsers[context.CurrentUser].Driver, - scenarioContext.TestError == null); - } - - [AfterScenario(Order = (int)HooksSequence.TearDownBrowserHooks)] - public void TearDownBrowser() - { - if (_browsers == null) return; - foreach (var browser in _browsers.Values) - { - browser.BrowserTearDown(); - } - } - } -} diff --git a/AdminWebsite/AdminWebsite.AcceptanceTests/Hooks/HealthcheckHooks.cs b/AdminWebsite/AdminWebsite.AcceptanceTests/Hooks/HealthcheckHooks.cs deleted file mode 100644 index 55bdca5b5..000000000 --- a/AdminWebsite/AdminWebsite.AcceptanceTests/Hooks/HealthcheckHooks.cs +++ /dev/null @@ -1,32 +0,0 @@ -using System; -using System.Net; -using AdminWebsite.AcceptanceTests.Helpers; -using FluentAssertions; -using Polly; -using RestSharp; -using TechTalk.SpecFlow; - -namespace AdminWebsite.AcceptanceTests.Hooks -{ - [Binding] - public class HealthcheckHooks - { - private const int RETRIES = 4; - - [BeforeScenario(Order = (int)HooksSequence.HealthcheckHooks)] - public void CheckApiHealth(TestContext context) - { - var retryOnForbiddenFirewallExceptions = Policy - .HandleResult(r => r.StatusCode == HttpStatusCode.Forbidden) - .WaitAndRetry(RETRIES, retryAttempt => - TimeSpan.FromSeconds(Math.Pow(2, retryAttempt)), - (exception, timeSpan) => - { - NUnit.Framework.TestContext.WriteLine($"Encountered error '{exception.Result.StatusCode}' after {timeSpan.Seconds} seconds. Retrying..."); - }); - - var response = retryOnForbiddenFirewallExceptions.Execute(() => context.Api.HealthCheck()); - response.StatusCode.Should().Be(HttpStatusCode.OK, $"Healthcheck failed with '{response.StatusCode}' and error message '{response.ErrorMessage}'"); - } - } -} diff --git a/AdminWebsite/AdminWebsite.AcceptanceTests/Hooks/HooksSequence.cs b/AdminWebsite/AdminWebsite.AcceptanceTests/Hooks/HooksSequence.cs deleted file mode 100644 index 07b0279ef..000000000 --- a/AdminWebsite/AdminWebsite.AcceptanceTests/Hooks/HooksSequence.cs +++ /dev/null @@ -1,20 +0,0 @@ -namespace AdminWebsite.AcceptanceTests.Hooks -{ - internal enum HooksSequence - { - CleanUpDriverInstances, - ConfigHooks, - RegisterApisHooks, - HealthcheckHooks, - InitialiseBrowserHooks, - ConfigureDriverHooks, - SetTimeZone, - RemoveDataHooks, - DataHooks, - AudioRecording, - RemoveNewUsersHooks, - RemoveAudioFiles, - LogResultHooks, - TearDownBrowserHooks - } -} diff --git a/AdminWebsite/AdminWebsite.AcceptanceTests/Hooks/RegisterApisHooks.cs b/AdminWebsite/AdminWebsite.AcceptanceTests/Hooks/RegisterApisHooks.cs deleted file mode 100644 index 104d8c826..000000000 --- a/AdminWebsite/AdminWebsite.AcceptanceTests/Hooks/RegisterApisHooks.cs +++ /dev/null @@ -1,21 +0,0 @@ -using AcceptanceTests.Common.Api.Hearings; -using AcceptanceTests.Common.Configuration; -using AdminWebsite.AcceptanceTests.Helpers; -using Notify.Client; -using System.Linq; -using TechTalk.SpecFlow; - -namespace AdminWebsite.AcceptanceTests.Hooks -{ - [Binding] - public class RegisterApisHooks - { - [BeforeScenario(Order = (int)HooksSequence.RegisterApisHooks)] - public void RegisterApis(TestContext context) - { - context.Api = new TestApiManager(context.WebConfig.VhServices.TestApiUrl, context.Token); - ConfigurationManager.VerifyConfigValuesSet(context.Api); - context.NotifyClient = new NotificationClient(context.WebConfig.NotifyConfiguration.ApiKey); - } - } -} diff --git a/AdminWebsite/AdminWebsite.AcceptanceTests/Hooks/RemoveDataHooks.cs b/AdminWebsite/AdminWebsite.AcceptanceTests/Hooks/RemoveDataHooks.cs deleted file mode 100644 index 95ed8cada..000000000 --- a/AdminWebsite/AdminWebsite.AcceptanceTests/Hooks/RemoveDataHooks.cs +++ /dev/null @@ -1,102 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Net; -using AcceptanceTests.Common.Api.Hearings; -using AcceptanceTests.Common.Api.Helpers; -using AdminWebsite.AcceptanceTests.Helpers; -using BookingsApi.Contract.V1.Responses; -using FluentAssertions; -using TechTalk.SpecFlow; -using VideoApi.Contract.Responses; - -namespace AdminWebsite.AcceptanceTests.Hooks -{ - [Binding] - public sealed class RemoveDataHooks - { - private string _username; - - [AfterScenario] - public void RemovePreviousHearings(TestContext context) - { - if (context?.Users == null) return; - if (context.Users?.Count == 0) return; - _username = Users.GetJudgeUser(context.Users).Username; - ClearHearingsForUser(context.Api); - ClearClosedConferencesForUser(context.Api); - } - - private void ClearHearingsForUser(TestApiManager api) - { - var response = api.GetHearingsByUsername(_username); - var hearings = RequestHelper.Deserialise>(response.Content); - if (hearings == null) return; - - var ids = hearings.Select(x => x.GroupId).Distinct().ToList(); - foreach (var id in ids.Where(x=> x.HasValue)) - { - DeleteTheHearing(api, id.Value); - } - } - - private static void DeleteTheHearing(TestApiManager api, Guid hearingId) - { - var response = api.DeleteHearing(hearingId); - response.IsSuccessful.Should().BeTrue($"HearingDetails {hearingId} has been deleted. Status {response.StatusCode}. {response.Content}"); - } - - private void ClearClosedConferencesForUser(TestApiManager api) - { - var response = api.GetConferencesForTodayJudge(_username); - var todaysConferences = RequestHelper.Deserialise>(FormatSerializedString(response.Content)); - if (todaysConferences == null) return; - - foreach (var conference in todaysConferences) - { - var hearingId = GetTheHearingIdFromTheConference(api, conference.Id); - - if (HearingHasNotBeenDeletedAlready(api, hearingId) && !hearingId.Equals(Guid.Empty)) - DeleteTheHearing(api, hearingId); - - if (ConferenceHasNotBeenDeletedAlready(api, conference.Id)) - DeleteTheConference(api, hearingId, conference.Id); - } - } - - private static Guid GetTheHearingIdFromTheConference(TestApiManager api, Guid conferenceId) - { - var response = api.GetConferenceByConferenceId(conferenceId); - if (!response.IsSuccessful) return Guid.Empty; - var conference = RequestHelper.Deserialise(FormatSerializedString(response.Content)); - return conference.HearingId; - } - - private static string FormatSerializedString(string content) - { - var formattedContent = content; - formattedContent = formattedContent.Replace("\\", ""); - formattedContent = formattedContent.Replace("\"[", "["); - formattedContent = formattedContent.Replace("]\"", "]"); - - return formattedContent; - } - - private static bool HearingHasNotBeenDeletedAlready(TestApiManager api, Guid hearingId) - { - var response = api.GetHearing(hearingId); - return !response.StatusCode.Equals(HttpStatusCode.NotFound); - } - - private static bool ConferenceHasNotBeenDeletedAlready(TestApiManager api, Guid conferenceId) - { - var response = api.GetConferenceByConferenceId(conferenceId); - return !response.StatusCode.Equals(HttpStatusCode.NotFound); - } - - private static void DeleteTheConference(TestApiManager api, Guid hearingId, Guid conferenceId) - { - api.DeleteConference(hearingId, conferenceId); - } - } -} diff --git a/AdminWebsite/AdminWebsite.AcceptanceTests/Hooks/UnallocateUsersHooks.cs b/AdminWebsite/AdminWebsite.AcceptanceTests/Hooks/UnallocateUsersHooks.cs deleted file mode 100644 index f86525286..000000000 --- a/AdminWebsite/AdminWebsite.AcceptanceTests/Hooks/UnallocateUsersHooks.cs +++ /dev/null @@ -1,32 +0,0 @@ -using System.Linq; -using System.Net; -using AdminWebsite.AcceptanceTests.Helpers; -using FluentAssertions; -using TechTalk.SpecFlow; -using TestApi.Contract.Enums; -using TestApi.Contract.Requests; - -namespace AdminWebsite.AcceptanceTests.Hooks -{ - [Binding] - public class UnallocateUsersHooks - { - [AfterScenario] - public void UnallocateUsers(TestContext context) - { - if (context?.Api == null) return; - if (context.Users == null) return; - - var usernames = context.Users.Where(user => user.UserType != UserType.Judge).Select(user => user.Username).ToList(); - if (usernames.Count <= 0) return; - - var request = new UnallocateUsersRequest() - { - Usernames = usernames - }; - - var response = context.Api.UnallocateUsers(request); - response.StatusCode.Should().Be(HttpStatusCode.OK); - } - } -} diff --git a/AdminWebsite/AdminWebsite.AcceptanceTests/Pages/AddPartcipantsPage.cs b/AdminWebsite/AdminWebsite.AcceptanceTests/Pages/AddPartcipantsPage.cs deleted file mode 100644 index da0eba35a..000000000 --- a/AdminWebsite/AdminWebsite.AcceptanceTests/Pages/AddPartcipantsPage.cs +++ /dev/null @@ -1,30 +0,0 @@ -using AcceptanceTests.Common.PageObject.Helpers; -using OpenQA.Selenium; - -namespace AdminWebsite.AcceptanceTests.Pages -{ - public static class AddParticipantsPage - { - public static By PartyDropdown = By.Id("party"); - public static By RoleDropdown = By.Id("role"); - public static By ParticipantEmailTextfield = By.Id("participantEmail"); - public static By TitleDropdown = By.Id("title"); - public static By FirstNameTextfield = By.Id("firstName"); - public static By LastNameTextfield = By.Id("lastName"); - public static By IndividualOrganisationTextfield = By.Id("companyNameIndividual"); - public static By RepOrganisationTextfield = By.Id("companyName"); - public static By PhoneTextfield = By.Id("phone"); - public static By DisplayNameTextfield = By.Id("displayName"); - public static By RepresentingTextfield = By.Id("representing"); - public static By AddParticipantLink = By.Id("addParticipantBtn"); - public static By UpdateParticipantLink = By.Id("updateParticipantBtn"); - public static By ClearDetailsLink = By.PartialLinkText("Clear details"); - public static By NextButton = By.Id(("nextButton")); - public static By CancelButton = By.Id("cancelButton"); - public static By ExistingEmailLinks = By.XPath("//li[@class='vk-showlist-m30']/a"); - public static By ParticipantsList = By.XPath("//*[contains(@class, 'vhtable-header')]"); - public static By InvalidEmailError = CommonLocators.ElementContainingText("Please enter a valid email address"); - public static By JudgeUserParticipantsList(string username) => CommonLocators.ElementContainingText(username); - public static By InterpreteeDropdown = By.Id("interpreterFor"); - } -} diff --git a/AdminWebsite/AdminWebsite.AcceptanceTests/Pages/AssignJudgePage.cs b/AdminWebsite/AdminWebsite.AcceptanceTests/Pages/AssignJudgePage.cs deleted file mode 100644 index eda2fd61e..000000000 --- a/AdminWebsite/AdminWebsite.AcceptanceTests/Pages/AssignJudgePage.cs +++ /dev/null @@ -1,25 +0,0 @@ -using OpenQA.Selenium; - -namespace AdminWebsite.AcceptanceTests.Pages -{ - public static class AssignJudgePage - { - public static By JudgeSearchField = By.Id("judge-email"); - public static By JudgeDisplayNameTextfield = By.Id("judgeDisplayNameFld"); - public static By JudgeEmailTextField = By.Id("judgeEmailFld"); - public static By JudgePhoneTextField = By.Id("judgePhoneFld"); - public static By NextButton = By.Id("nextButton"); - public static By CancelButton = By.Id("cancelButton"); - public static By JudgeEmailId = By.Id("judge-email"); - public static By JudgePhoneId = By.Id("judge-phone"); - public static By SearchResults = By.Id("search-results-list"); - - public static By AddStaffMember = By.Id("showAddStaffMemberFld"); - public static By AddStaffEmailTextField = By.Id("staff-member-email"); - public static By AddStaffFirstNameTextField = By.Id("firstName"); - public static By AddStaffLastNameTextField = By.Id("lastName"); - public static By AddStaffPhoneTextField = By.Id("phone"); - public static By AddStaffDisplayNameTextField = By.Id("displayName"); - - } -} diff --git a/AdminWebsite/AdminWebsite.AcceptanceTests/Pages/BookingConfirmationPage.cs b/AdminWebsite/AdminWebsite.AcceptanceTests/Pages/BookingConfirmationPage.cs deleted file mode 100644 index bcaf1b9f0..000000000 --- a/AdminWebsite/AdminWebsite.AcceptanceTests/Pages/BookingConfirmationPage.cs +++ /dev/null @@ -1,16 +0,0 @@ -using AcceptanceTests.Common.PageObject.Helpers; -using OpenQA.Selenium; - -namespace AdminWebsite.AcceptanceTests.Pages -{ - public static class BookingConfirmationPage - { - public static By SuccessMessage = CommonLocators.ElementContainingText("Your hearing booking was successful"); - public static By CaseNumber = By.Id("caseNumber"); - public static By CaseName = By.Id("caseName"); - public static By HearingDate = By.Id("hearingDate"); - public static By BookAnotherHearingButton = By.Id("btnBookAnotherHearing"); - public static By ReturnToDashboardLink = By.PartialLinkText("Return to dashboard"); - public static By ViewThisBookingLink = By.LinkText("View this booking"); - } -} diff --git a/AdminWebsite/AdminWebsite.AcceptanceTests/Pages/BookingDetailsPage.cs b/AdminWebsite/AdminWebsite.AcceptanceTests/Pages/BookingDetailsPage.cs deleted file mode 100644 index 9cb6cd4e6..000000000 --- a/AdminWebsite/AdminWebsite.AcceptanceTests/Pages/BookingDetailsPage.cs +++ /dev/null @@ -1,41 +0,0 @@ -using System; -using OpenQA.Selenium; - -namespace AdminWebsite.AcceptanceTests.Pages -{ - public static class BookingDetailsPage - { - public static By CaseNumberTitle = By.Id("hearingNumber"); - public static By CreatedBy = By.Id("created-by"); - public static By CreatedDate = By.Id("created-date"); - public static By CaseNumber = By.Id("hearing-number"); - public static By CaseName = By.Id("hearing-name"); - public static By HearingType = By.Id("hearing-type"); - public static By HearingStartDate = By.Id("hearing-start"); - public static By CourtroomAddress = By.Id("court-room-address"); - public static By Duration = By.Id("duration"); - public static By AudioRecorded = By.Id("audioRecorded"); - public static By OtherInformation = By.Id("otherInformation"); - public static By EditButton = By.Id("edit-button"); - public static By CancelButton = By.Id("cancel-button"); - public static By ConfirmCancelButton = By.Id("btnCancelBooking"); - public static By ConfirmButton = By.Id("confirm-button"); - public static By ConfirmedLabel = By.Id("lblCreated"); - public static By JudgeName = By.Id("judge-name"); - public static By JudgeRole = By.Id("judge-hearing-role-name"); - public static By ParticipantName(Guid participantId) => By.Id($"participant-{participantId:D}-name"); - public static By ParticipantRole(Guid participantId) => By.Id($"participant-{participantId:D}-hearing-role-name"); - public static By ParticipantEmail(Guid participantId) => By.Id($"participant-{participantId:D}-email"); - public static By ParticipantUsername(Guid participantId) => By.Id($"participant-{participantId:D}-username"); - public static By ParticipantRepresentee(Guid participantId) => By.Id($"participant-{participantId:D}-representee"); - public static By ParticipantPhone(Guid participantId) => By.Id($"participant-{participantId:D}-phone"); - public static By CancelReasonDropdown = By.Id("cancel-reason"); - public static By CancelReasonDropdownErrorLabel = By.Id("cancelReason-error"); - public static By CancelReasonDetailsErrorLabel = By.Id("more-detail-error"); - public static By CancelReasonTextfield = By.Id("cancelReason-detail"); - public static By KeepBookingButton = By.Id("btnKeepBooking"); - public static By CaseType = By.Id("case-type"); - public static By VideoAccessPoints(int i) => By.Id($"displayName{i.ToString()}"); - public static By ConferencePhoneDetails = By.Id("conference_phone_details"); - } -} diff --git a/AdminWebsite/AdminWebsite.AcceptanceTests/Pages/BookingsListPage.cs b/AdminWebsite/AdminWebsite.AcceptanceTests/Pages/BookingsListPage.cs deleted file mode 100644 index a130102a6..000000000 --- a/AdminWebsite/AdminWebsite.AcceptanceTests/Pages/BookingsListPage.cs +++ /dev/null @@ -1,24 +0,0 @@ -using OpenQA.Selenium; - -namespace AdminWebsite.AcceptanceTests.Pages -{ - public static class BookingsListPage - { - public static By Rows = By.XPath("//div[contains(@class,'vh-a')]"); - public static By Row(string text) => By.XPath($"//div[contains(text(),'{text}')]/parent::div/parent::div"); - public static By RowWithId(string id) => By.Id(id); - public static By ScheduledTime(string id) => By.XPath($"//div[@id='{id}']//div[contains(text(),':')]"); - public static By ScheduledDuration(string id) => By.XPath($"//div[@id='{id}']//div[contains(text(),'listed for')]"); - public static By CaseNumber(string id, string caseNumber) => CaseInfo(id, caseNumber); - public static By CaseName(string id, string caseName) => CaseInfo(id, caseName); - public static By CaseType(string id, string caseType) => CaseInfo(id, caseType); - public static By Judge(string id, string judge) => CaseInfo(id, judge); - public static By Venue(string id, string venue) => CaseInfo(id, venue); - public static By CreatedBy(string id, string createdBy) => By.XPath($"//div[@id='{id}']//div[contains(text(),'{createdBy}')]"); - public static By HearingType(string id, string hearingType) => CaseInfo(id, hearingType); - private static By CaseInfo(string id, string info) - { - return By.XPath($"//div[@id='{id}']//div[contains(text(),'{info}')]"); - } - } -} diff --git a/AdminWebsite/AdminWebsite.AcceptanceTests/Pages/ChangePasswordPage.cs b/AdminWebsite/AdminWebsite.AcceptanceTests/Pages/ChangePasswordPage.cs deleted file mode 100644 index bc06ed1d8..000000000 --- a/AdminWebsite/AdminWebsite.AcceptanceTests/Pages/ChangePasswordPage.cs +++ /dev/null @@ -1,13 +0,0 @@ -using AcceptanceTests.Common.PageObject.Helpers; -using OpenQA.Selenium; - -namespace AdminWebsite.AcceptanceTests.Pages -{ - public static class ChangePasswordPage - { - public static By UsernameTextfield = By.Id("userName"); - public static By UpdateButton = By.Id("submit"); - public static By PasswordHasBeenChangedMessage = CommonLocators.ElementContainingText("User's password has been changed"); - public static By OkButton = By.Id("btnOkay"); - } -} diff --git a/AdminWebsite/AdminWebsite.AcceptanceTests/Pages/CommonAdminWebPage.cs b/AdminWebsite/AdminWebsite.AcceptanceTests/Pages/CommonAdminWebPage.cs deleted file mode 100644 index bd216c3f9..000000000 --- a/AdminWebsite/AdminWebsite.AcceptanceTests/Pages/CommonAdminWebPage.cs +++ /dev/null @@ -1,16 +0,0 @@ -using AcceptanceTests.Common.PageObject.Helpers; -using OpenQA.Selenium; - -namespace AdminWebsite.AcceptanceTests.Pages -{ - public static class CommonAdminWebPage - { - public static By DashboardLink = By.PartialLinkText("Dashboard"); - public static By BookingsListLink = By.PartialLinkText("Booking list"); - public static By ContactUsLink = By.PartialLinkText("Contact us"); - public static By ContactUsTitle = CommonLocators.ElementContainingText("Contact the video hearings service"); - public static By ContactUsPhoneNumber(string phoneNumber) => CommonLocators.ElementContainingText(phoneNumber); - public static By ContactUsEmail(string email) => CommonLocators.ElementContainingText(email); - public static By OpenGovernmentLicenceLink = By.PartialLinkText("Open Government Licence"); - } -} diff --git a/AdminWebsite/AdminWebsite.AcceptanceTests/Pages/DashboardPage.cs b/AdminWebsite/AdminWebsite.AcceptanceTests/Pages/DashboardPage.cs deleted file mode 100644 index be5e8deaa..000000000 --- a/AdminWebsite/AdminWebsite.AcceptanceTests/Pages/DashboardPage.cs +++ /dev/null @@ -1,14 +0,0 @@ -using OpenQA.Selenium; - -namespace AdminWebsite.AcceptanceTests.Pages -{ - public static class DashboardPage - { - public static By BookVideoHearingPanel = By.Id("bookHearingBtn"); - public static By QuestionnaireResultsPanel = By.Id("questionnaireResultsBtn"); - public static By GetAudioFilePanel = By.Id("getAudioLinkBtn"); - public static By ChangePasswordPanel = By.Id("changePasswordBtn"); - public static By DeleteUserPanel = By.Id("deleteUserBtn"); - public static By EditParticipantName = By.Id("editUserBtn"); - } -} diff --git a/AdminWebsite/AdminWebsite.AcceptanceTests/Pages/DeleteUserPage.cs b/AdminWebsite/AdminWebsite.AcceptanceTests/Pages/DeleteUserPage.cs deleted file mode 100644 index 763f0d6cb..000000000 --- a/AdminWebsite/AdminWebsite.AcceptanceTests/Pages/DeleteUserPage.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System; -using OpenQA.Selenium; - -namespace AdminWebsite.AcceptanceTests.Pages -{ - public static class DeleteUserPage - { - public static By CaseNumberTextField = By.Id("username"); - public static By SubmitButton = By.Id("submit"); - public static By ResultsCaseNumber(Guid hearingId) => By.Id($"{hearingId}-case-number"); - public static By ResultsScheduledTime(Guid hearingId) => By.Id($"{hearingId}-scheduled-time"); - public static By ResultsCaseName(Guid hearingId) => By.Id($"{hearingId}-case-name"); - public static By ResultsVenueName(Guid hearingId) => By.Id($"{hearingId}-venue"); - } -} \ No newline at end of file diff --git a/AdminWebsite/AdminWebsite.AcceptanceTests/Pages/EditParticipantNamePage.cs b/AdminWebsite/AdminWebsite.AcceptanceTests/Pages/EditParticipantNamePage.cs deleted file mode 100644 index 9df6f4905..000000000 --- a/AdminWebsite/AdminWebsite.AcceptanceTests/Pages/EditParticipantNamePage.cs +++ /dev/null @@ -1,23 +0,0 @@ -using AcceptanceTests.Common.PageObject.Helpers; -using OpenQA.Selenium; -using System; -using System.Collections.Generic; -using System.Text; - -namespace AdminWebsite.AcceptanceTests.Pages -{ - public static class EditParticipantNamePage - { - public static By ContactEmailTextField = By.Id("contactEmail"); - public static By SubmitButton = By.Id("submit"); - public static By FullNameField = By.Id("fullName"); - public static By UserNotFounMessage = CommonLocators.ElementContainingText("Sorry, we can't find a user with that email address."); - public static By JudgeNotAllowedToBeEditedMessage = CommonLocators.ElementContainingText("Judge accounts cannot be edited"); - public static By SaveButton = By.Id("saveButton"); - public static By FirstNameField = By.Id("firstName"); - public static By LastNameField = By.Id("lastName"); - public static By CompleteSignField = By.Id("completeSign"); - public static string CompleteSignText = "participant name updated"; - public static By ContactEmailLink(string email) => By.LinkText(email.ToLower()); - } -} diff --git a/AdminWebsite/AdminWebsite.AcceptanceTests/Pages/ErrorPage.cs b/AdminWebsite/AdminWebsite.AcceptanceTests/Pages/ErrorPage.cs deleted file mode 100644 index 21f410ded..000000000 --- a/AdminWebsite/AdminWebsite.AcceptanceTests/Pages/ErrorPage.cs +++ /dev/null @@ -1,10 +0,0 @@ -using AcceptanceTests.Common.PageObject.Helpers; -using OpenQA.Selenium; - -namespace AdminWebsite.AcceptanceTests.Pages -{ - public static class ErrorPage - { - public static By UnsupportedBrowserTitle = CommonLocators.ElementContainingText("You've signed in using an unsupported browser"); - } -} diff --git a/AdminWebsite/AdminWebsite.AcceptanceTests/Pages/GetAudioFilePage.cs b/AdminWebsite/AdminWebsite.AcceptanceTests/Pages/GetAudioFilePage.cs deleted file mode 100644 index c0bc3a3ef..000000000 --- a/AdminWebsite/AdminWebsite.AcceptanceTests/Pages/GetAudioFilePage.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System; -using OpenQA.Selenium; - -namespace AdminWebsite.AcceptanceTests.Pages -{ - public static class GetAudioFilePage - { - public static By CaseNumberTextField = By.Id("caseNumber"); - public static By SubmitButton = By.Id("submit"); - public static By GetLinkButton = By.Id("getLinkButton"); - public static By CopyLinkButton(int fileIndex) => By.Id($"{fileIndex}-copyLinkButton"); - public static By LinkCopiedSuccessMessage(int fileIndex) => By.Id($"{fileIndex}-linkCopied"); - public static By ResultsCaseNumber(Guid hearingId) => By.Id($"{hearingId}-case-number"); - public static By ResultsScheduledTime(Guid hearingId) => By.Id($"{hearingId}-scheduled-time"); - public static By ResultsCaseName(Guid hearingId) => By.Id($"{hearingId}-case-name"); - public static By ResultsVenue(Guid hearingId) => By.Id($"{hearingId}-venue"); - } -} diff --git a/AdminWebsite/AdminWebsite.AcceptanceTests/Pages/HearingDetailsPage.cs b/AdminWebsite/AdminWebsite.AcceptanceTests/Pages/HearingDetailsPage.cs deleted file mode 100644 index 169c5ad62..000000000 --- a/AdminWebsite/AdminWebsite.AcceptanceTests/Pages/HearingDetailsPage.cs +++ /dev/null @@ -1,14 +0,0 @@ -using OpenQA.Selenium; - -namespace AdminWebsite.AcceptanceTests.Pages -{ - public static class HearingDetailsPage - { - public static By CaseNumberTextfield = By.Id("caseNumber"); - public static By CaseNameTextfield = By.Id("caseName"); - public static By CaseTypeDropdown = By.Id("caseType"); - public static By HearingTypeDropdown = By.Id("hearingType"); - public static By NextButton = By.Id("nextButton"); - public static By CancelButton = By.Id("cancelButton"); - } -} diff --git a/AdminWebsite/AdminWebsite.AcceptanceTests/Pages/HearingSchedulePage.cs b/AdminWebsite/AdminWebsite.AcceptanceTests/Pages/HearingSchedulePage.cs deleted file mode 100644 index bc8404476..000000000 --- a/AdminWebsite/AdminWebsite.AcceptanceTests/Pages/HearingSchedulePage.cs +++ /dev/null @@ -1,21 +0,0 @@ -using OpenQA.Selenium; - -namespace AdminWebsite.AcceptanceTests.Pages -{ - public static class HearingSchedulePage - { - public static By HearingDateTextfield = By.Id("hearingDate"); - public static By HearingStartTimeHourTextfield = By.Id("hearingStartTimeHour"); - public static By HearingStartTimeMinuteTextfield = By.Id("hearingStartTimeMinute"); - public static By HearingDurationHourTextfield = By.Id("hearingDurationHour"); - public static By HearingDurationMinuteTextfield = By.Id("hearingDurationMinute"); - public static By CourtAddressDropdown = By.Id("courtAddress"); - public static By CourtRoomTextfield = By.Id("court-room"); - public static By NextButton = By.Id("nextButton"); - public static By CancelButton = By.Id("cancelButton"); - public static By HearingDateError = By.Id("hearingDate-past-error"); - public static By HearingTimeError = By.Id("hearingTime-error"); - public static By HearingEndDateTextField = By.Id("endHearingDate"); - public static By MultiDaysCheckBox = By.Id("multiDaysHearing"); - } -} diff --git a/AdminWebsite/AdminWebsite.AcceptanceTests/Pages/Journeys/BookingConfirmationJourney.cs b/AdminWebsite/AdminWebsite.AcceptanceTests/Pages/Journeys/BookingConfirmationJourney.cs deleted file mode 100644 index f2411d6e0..000000000 --- a/AdminWebsite/AdminWebsite.AcceptanceTests/Pages/Journeys/BookingConfirmationJourney.cs +++ /dev/null @@ -1,41 +0,0 @@ -using System.Collections.Generic; -using FluentAssertions; -using TestApi.Contract.Enums; - -namespace AdminWebsite.AcceptanceTests.Pages.Journeys -{ - public class BookingsConfirmationJourney : IJourney - { - public List Journey() - { - return new List() - { - Page.Login, - Page.Dashboard, - Page.HearingDetails, - Page.HearingSchedule, - Page.AssignJudge, - Page.AddParticipants, - Page.VideoAccessPoints, - Page.OtherInformation, - Page.Summary, - Page.BookingConfirmation - }; - } - - public void VerifyUserIsApplicableToJourney(UserType userType) - { - userType.ToString().ToLower().Should().BeOneOf("videohearingsofficer", "caseadmin"); - } - - public void VerifyDestinationIsInThatJourney(Page destinationPage) - { - Journey().Should().Contain(destinationPage); - } - - public Page GetNextPage(Page currentPage) - { - return Journey()[Journey().IndexOf(currentPage) + 1]; - } - } -} diff --git a/AdminWebsite/AdminWebsite.AcceptanceTests/Pages/Journeys/BookingDetailsJourney.cs b/AdminWebsite/AdminWebsite.AcceptanceTests/Pages/Journeys/BookingDetailsJourney.cs deleted file mode 100644 index 55959d213..000000000 --- a/AdminWebsite/AdminWebsite.AcceptanceTests/Pages/Journeys/BookingDetailsJourney.cs +++ /dev/null @@ -1,42 +0,0 @@ -using System.Collections.Generic; -using FluentAssertions; -using TestApi.Contract.Enums; - -namespace AdminWebsite.AcceptanceTests.Pages.Journeys -{ - public class BookingDetailsJourney : IJourney - { - public List Journey() - { - return new List() - { - Page.Login, - Page.Dashboard, - Page.HearingDetails, - Page.HearingSchedule, - Page.AssignJudge, - Page.AddParticipants, - Page.VideoAccessPoints, - Page.OtherInformation, - Page.Summary, - Page.BookingConfirmation, - Page.BookingDetails - }; - } - - public void VerifyUserIsApplicableToJourney(UserType userType) - { - userType.ToString().ToLower().Should().BeOneOf("videohearingsofficer", "caseadmin"); - } - - public void VerifyDestinationIsInThatJourney(Page destinationPage) - { - Journey().Should().Contain(destinationPage); - } - - public Page GetNextPage(Page currentPage) - { - return Journey()[Journey().IndexOf(currentPage) + 1]; - } - } -} diff --git a/AdminWebsite/AdminWebsite.AcceptanceTests/Pages/Journeys/BookingsListJourney.cs b/AdminWebsite/AdminWebsite.AcceptanceTests/Pages/Journeys/BookingsListJourney.cs deleted file mode 100644 index f63cd3c92..000000000 --- a/AdminWebsite/AdminWebsite.AcceptanceTests/Pages/Journeys/BookingsListJourney.cs +++ /dev/null @@ -1,42 +0,0 @@ -using System.Collections.Generic; -using FluentAssertions; -using TestApi.Contract.Enums; - -namespace AdminWebsite.AcceptanceTests.Pages.Journeys -{ - public class BookingListJourney : IJourney - { - public List Journey() - { - return new List() - { - Page.Login, - Page.Dashboard, - Page.HearingDetails, - Page.HearingSchedule, - Page.AssignJudge, - Page.AddParticipants, - Page.VideoAccessPoints, - Page.OtherInformation, - Page.Summary, - Page.BookingConfirmation, - Page.BookingsList - }; - } - - public void VerifyUserIsApplicableToJourney(UserType userType) - { - userType.ToString().ToLower().Should().BeOneOf("videohearingsofficer", "caseadmin"); - } - - public void VerifyDestinationIsInThatJourney(Page destinationPage) - { - Journey().Should().Contain(destinationPage); - } - - public Page GetNextPage(Page currentPage) - { - return Journey()[Journey().IndexOf(currentPage) + 1]; - } - } -} diff --git a/AdminWebsite/AdminWebsite.AcceptanceTests/Pages/Journeys/ChangePasswordJourney.cs b/AdminWebsite/AdminWebsite.AcceptanceTests/Pages/Journeys/ChangePasswordJourney.cs deleted file mode 100644 index 1a47aa113..000000000 --- a/AdminWebsite/AdminWebsite.AcceptanceTests/Pages/Journeys/ChangePasswordJourney.cs +++ /dev/null @@ -1,34 +0,0 @@ -using System.Collections.Generic; -using FluentAssertions; -using TestApi.Contract.Enums; - -namespace AdminWebsite.AcceptanceTests.Pages.Journeys -{ - public class ChangePasswordJourney : IJourney - { - public List Journey() - { - return new List() - { - Page.Login, - Page.Dashboard, - Page.ChangePassword - }; - } - - public void VerifyUserIsApplicableToJourney(UserType userType) - { - userType.Should().Be(UserType.VideoHearingsOfficer); - } - - public void VerifyDestinationIsInThatJourney(Page destinationPage) - { - Journey().Should().Contain(destinationPage); - } - - public Page GetNextPage(Page currentPage) - { - return Journey()[Journey().IndexOf(currentPage) + 1]; - } - } -} diff --git a/AdminWebsite/AdminWebsite.AcceptanceTests/Pages/Journeys/EditParticipantNameJourney.cs b/AdminWebsite/AdminWebsite.AcceptanceTests/Pages/Journeys/EditParticipantNameJourney.cs deleted file mode 100644 index 688a35440..000000000 --- a/AdminWebsite/AdminWebsite.AcceptanceTests/Pages/Journeys/EditParticipantNameJourney.cs +++ /dev/null @@ -1,34 +0,0 @@ -using FluentAssertions; -using System.Collections.Generic; -using TestApi.Contract.Enums; - -namespace AdminWebsite.AcceptanceTests.Pages.Journeys -{ - public class EditParticipantNameJourney : IJourney - { - public List Journey() - { - return new List() - { - Page.Login, - Page.Dashboard, - Page.EditParticipantName - }; - } - - public void VerifyUserIsApplicableToJourney(UserType userType) - { - userType.Should().Be(UserType.VideoHearingsOfficer); - } - - public void VerifyDestinationIsInThatJourney(Page destinationPage) - { - Journey().Should().Contain(destinationPage); - } - - public Page GetNextPage(Page currentPage) - { - return Journey()[Journey().IndexOf(currentPage) + 1]; - } - } -} diff --git a/AdminWebsite/AdminWebsite.AcceptanceTests/Pages/Journeys/GetAudioFileJourney.cs b/AdminWebsite/AdminWebsite.AcceptanceTests/Pages/Journeys/GetAudioFileJourney.cs deleted file mode 100644 index 9ebce6e4d..000000000 --- a/AdminWebsite/AdminWebsite.AcceptanceTests/Pages/Journeys/GetAudioFileJourney.cs +++ /dev/null @@ -1,34 +0,0 @@ -using System.Collections.Generic; -using FluentAssertions; -using TestApi.Contract.Enums; - -namespace AdminWebsite.AcceptanceTests.Pages.Journeys -{ - public class GetAudioFileJourney : IJourney - { - public List Journey() - { - return new List() - { - Page.Login, - Page.Dashboard, - Page.GetAudioFile - }; - } - - public void VerifyUserIsApplicableToJourney(UserType userType) - { - userType.Should().Be(UserType.VideoHearingsOfficer); - } - - public void VerifyDestinationIsInThatJourney(Page destinationPage) - { - Journey().Should().Contain(destinationPage); - } - - public Page GetNextPage(Page currentPage) - { - return Journey()[Journey().IndexOf(currentPage) + 1]; - } - } -} diff --git a/AdminWebsite/AdminWebsite.AcceptanceTests/Pages/Journeys/IJourney.cs b/AdminWebsite/AdminWebsite.AcceptanceTests/Pages/Journeys/IJourney.cs deleted file mode 100644 index 980e0526d..000000000 --- a/AdminWebsite/AdminWebsite.AcceptanceTests/Pages/Journeys/IJourney.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System.Collections.Generic; -using TestApi.Contract.Enums; - -namespace AdminWebsite.AcceptanceTests.Pages.Journeys -{ - public interface IJourney - { - List Journey(); - void VerifyDestinationIsInThatJourney(Page destinationPage); - void VerifyUserIsApplicableToJourney(UserType userType); - Page GetNextPage(Page currentPage); - } -} diff --git a/AdminWebsite/AdminWebsite.AcceptanceTests/Pages/Journeys/Journey.cs b/AdminWebsite/AdminWebsite.AcceptanceTests/Pages/Journeys/Journey.cs deleted file mode 100644 index 060fd11f1..000000000 --- a/AdminWebsite/AdminWebsite.AcceptanceTests/Pages/Journeys/Journey.cs +++ /dev/null @@ -1,13 +0,0 @@ -namespace AdminWebsite.AcceptanceTests.Pages.Journeys -{ - public enum Journey - { - BookingConfirmation, - BookingDetails, - BookingsList, - ChangePassword, - EditParticipantName, - GetAudioFile, - Questionnaire - } -} diff --git a/AdminWebsite/AdminWebsite.AcceptanceTests/Pages/Journeys/QuestionnaireJourney.cs b/AdminWebsite/AdminWebsite.AcceptanceTests/Pages/Journeys/QuestionnaireJourney.cs deleted file mode 100644 index 1b996d382..000000000 --- a/AdminWebsite/AdminWebsite.AcceptanceTests/Pages/Journeys/QuestionnaireJourney.cs +++ /dev/null @@ -1,34 +0,0 @@ -using System.Collections.Generic; -using FluentAssertions; -using TestApi.Contract.Enums; - -namespace AdminWebsite.AcceptanceTests.Pages.Journeys -{ - public class QuestionnaireJourney : IJourney - { - public List Journey() - { - return new List() - { - Page.Login, - Page.Dashboard, - Page.Questionnaire - }; - } - - public void VerifyUserIsApplicableToJourney(UserType userType) - { - userType.ToString().ToLower().Should().BeOneOf("videohearingsofficer", "caseadmin"); - } - - public void VerifyDestinationIsInThatJourney(Page destinationPage) - { - Journey().Should().Contain(destinationPage); - } - - public Page GetNextPage(Page currentPage) - { - return Journey()[Journey().IndexOf(currentPage) + 1]; - } - } -} diff --git a/AdminWebsite/AdminWebsite.AcceptanceTests/Pages/OtherInformationPage.cs b/AdminWebsite/AdminWebsite.AcceptanceTests/Pages/OtherInformationPage.cs deleted file mode 100644 index a41983722..000000000 --- a/AdminWebsite/AdminWebsite.AcceptanceTests/Pages/OtherInformationPage.cs +++ /dev/null @@ -1,15 +0,0 @@ -using AcceptanceTests.Common.PageObject.Helpers; -using OpenQA.Selenium; - -namespace AdminWebsite.AcceptanceTests.Pages -{ - public static class OtherInformationPage - { - public static By OtherInformationTextfield = By.Id("details-other-information"); - public static By NextButton = By.Id("nextButton"); - public static By CancelButton = By.Id("cancelButton"); - public static By AudioRecordYesRadioButton = By.Id("audio-choice-yes"); - public static By AudioRecordNoRadioButton = By.Id("audio-choice-no"); - public static By AudioRecordingInterpreterMessage = CommonLocators.ElementContainingText("(mandatory for hearings with interpreters)"); - } -} diff --git a/AdminWebsite/AdminWebsite.AcceptanceTests/Pages/Page.cs b/AdminWebsite/AdminWebsite.AcceptanceTests/Pages/Page.cs deleted file mode 100644 index f5a71d0f6..000000000 --- a/AdminWebsite/AdminWebsite.AcceptanceTests/Pages/Page.cs +++ /dev/null @@ -1,86 +0,0 @@ -using System; -using System.Collections.Generic; - -namespace AdminWebsite.AcceptanceTests.Pages -{ - public class Page - { - public string Name { get; } - public string Url { get; } - - private Page(string name, string url) - { - Name = name; - Url = url; - } - - public static readonly Page Login = new Page("Login", "login.microsoftonline.com"); - public static readonly Page Dashboard = new Page("Dashboard", "dashboard"); - public static readonly Page BookingsList = new Page("Bookings List", "bookings-list"); - public static readonly Page BookingDetails = new Page("Booking Details", "booking-details"); - public static readonly Page Questionnaire = new Page("Questionnaire", "questionnaire"); - public static readonly Page ChangePassword = new Page("Change Password", "change-password"); - public static readonly Page EditParticipantName = new Page("Edit Participant Name", "edit-participant"); - public static readonly Page GetAudioFile = new Page("Get Audio File", "get-audio-file"); - public static readonly Page DeleteUser = new Page("Delete User", "delete-user"); - public static readonly Page HearingDetails = new Page("Hearing Details", "book-hearing"); - public static readonly Page HearingSchedule = new Page("Hearing Schedule", "hearing-schedule"); - public static readonly Page AssignJudge = new Page("Assign Judge", "assign-judge"); - public static readonly Page AddParticipants = new Page("Add Participants", "add-participants"); - public static readonly Page VideoAccessPoints = new Page("Video Access Points", "video-access-points"); - public static readonly Page OtherInformation = new Page("Other Information", "other-information"); - public static readonly Page Summary = new Page("Summary", "summary"); - public static readonly Page BookingConfirmation = new Page("Booking Confirmation", "booking-confirmation"); - public static readonly Page NotFound = new Page("Not Found", "not-found"); - public static readonly Page Unauthorised = new Page("Unauthorised", "unauthorised"); - public static readonly Page ContactUs = new Page("Contact Us", "contact-us"); - public static readonly Page OpenGovernmentLicence = new Page("Open Government Licence", "open-government-licence"); - public static readonly Page UnsupportedBrowser = new Page("Unsupported Browser", "unsupported-browser"); - - public string ToString(Page page) - { - return page.Name; - } - - public static Page FromString(string name) - { - foreach (var page in Values) - { - if (page.Name.ToLower().Equals(name.ToLower())) - { - return page; - } - } - throw new ArgumentOutOfRangeException($"No page found with name '{name}'"); - } - - private static IEnumerable Values - { - get - { - yield return Login; - yield return Dashboard; - yield return BookingsList; - yield return BookingDetails; - yield return Questionnaire; - yield return ChangePassword; - yield return GetAudioFile; - yield return DeleteUser; - yield return HearingDetails; - yield return HearingSchedule; - yield return AssignJudge; - yield return AddParticipants; - yield return VideoAccessPoints; - yield return OtherInformation; - yield return Summary; - yield return BookingConfirmation; - yield return NotFound; - yield return Unauthorised; - yield return ContactUs; - yield return OpenGovernmentLicence; - yield return UnsupportedBrowser; - yield return EditParticipantName; - } - } - } -} diff --git a/AdminWebsite/AdminWebsite.AcceptanceTests/Pages/QuestionnairePage.cs b/AdminWebsite/AdminWebsite.AcceptanceTests/Pages/QuestionnairePage.cs deleted file mode 100644 index 4a5dbb9e6..000000000 --- a/AdminWebsite/AdminWebsite.AcceptanceTests/Pages/QuestionnairePage.cs +++ /dev/null @@ -1,13 +0,0 @@ -using AcceptanceTests.Common.PageObject.Helpers; -using OpenQA.Selenium; - -namespace AdminWebsite.AcceptanceTests.Pages -{ - public static class QuestionnairePage - { - public static By QuestionnaireLink(string name) => By.XPath($"//span[contains(text(),'{name}')]/parent::a"); - public static By AllQuestions = By.XPath("//*[@class='govuk-body vh-date vh-wrap vh-mr15']/../../div/span[@class='govuk-body vh-table-row']"); - public static By AllAnswers = By.XPath("//*[@class='govuk-body vh-date vh-wrap vh-mr15']"); - public static By ExtendedAnswer(string extendedAnswer) => CommonLocators.ElementContainingText(extendedAnswer); - } -} diff --git a/AdminWebsite/AdminWebsite.AcceptanceTests/Pages/SummaryPage.cs b/AdminWebsite/AdminWebsite.AcceptanceTests/Pages/SummaryPage.cs deleted file mode 100644 index da55faa8a..000000000 --- a/AdminWebsite/AdminWebsite.AcceptanceTests/Pages/SummaryPage.cs +++ /dev/null @@ -1,36 +0,0 @@ -using AcceptanceTests.Common.Data.TestData; -using AcceptanceTests.Common.PageObject.Helpers; -using OpenQA.Selenium; - -namespace AdminWebsite.AcceptanceTests.Pages -{ - public static class SummaryPage - { - public static By CaseNumber = By.Id("caseNumber"); - public static By CaseName = By.Id("caseName"); - public static By CaseHearingType = By.Id("caseHearingType"); - public static By HearingDate = By.Id("hearingDate"); - public static By CourtAddress = By.Id("courtAddress"); - public static By HearingDuration = By.Id("hearingDuration"); - public static By AudioRecording = By.Id("audioRecording"); - public static By OtherInformation = By.Id("otherInformation"); - public static By Judge = By.Id("judge-name"); - public static By RemoveParticipant = By.Id("btn-remove"); - public static By RemoveInterpreter = By.Id("btnConfirmRemoveInterpreter"); - public static By CancelRemoveParticipant = By.Id("btn-cancel"); - public static By RemoveInterpreterMessage = CommonLocators.ElementContainingText("Removing this participant will also remove their interpreter."); - public static By RemoveParticipantMessage(string displayName) => CommonLocators.ElementContainingText($"Are you sure you want to remove {displayName} from the hearing booking?"); - public static By ParticipantConfirmationMessage = By.XPath("//h1[contains(text(),'hearing booking')]"); - public static By ParticipantsLink = By.XPath("//a[contains(text(),'Participants')]"); - public static By BookButton = By.Id("bookButton"); - public static By EditScreenLink(string screen) => By.Id($"edit-link{screen.ToLower().Replace(" ", "-")}-id"); - public static By EditParticipantLink(string firstName) => By.XPath($"//div[contains(text(),'{firstName}')]/parent::div/parent::div//a[text()='Edit']"); - public static By RemoveParticipantLink(string firstName) => By.XPath($"//div[contains(text(),'{firstName}')]/parent::div/parent::div//a[text()='Remove']"); - public static By CaseType = By.Id("caseType"); - public static By HearingType = By.Id("caseHearingType"); - public static By VideoAccessPoints(int i) => By.Id($"displayName{i.ToString()}"); - public static By HearingStartDateMultiDays = By.Id("hearingStartDate"); - public static By HearingEndDateMultiDays = By.Id("hearingEndDateTime"); - public static By WaitPopUp = By.Id("waitPopup"); - } -} diff --git a/AdminWebsite/AdminWebsite.AcceptanceTests/Pages/VideoAccessPointsPage.cs b/AdminWebsite/AdminWebsite.AcceptanceTests/Pages/VideoAccessPointsPage.cs deleted file mode 100644 index 4d5cab95d..000000000 --- a/AdminWebsite/AdminWebsite.AcceptanceTests/Pages/VideoAccessPointsPage.cs +++ /dev/null @@ -1,12 +0,0 @@ -using OpenQA.Selenium; - -namespace AdminWebsite.AcceptanceTests.Pages -{ - public static class VideoAccessPointsPage - { - public static By DisplayNameField(int i) => By.Id($"displayName{i.ToString()}"); - public static By AddAnotherButton = By.Id("addEndpoint"); - public static By NextButton = By.Id("nextButton"); - public static By CancelButton = By.Id("cancelButton"); - } -} diff --git a/AdminWebsite/AdminWebsite.AcceptanceTests/Properties/AssemblyInfo.cs b/AdminWebsite/AdminWebsite.AcceptanceTests/Properties/AssemblyInfo.cs deleted file mode 100644 index bc9a5d30e..000000000 --- a/AdminWebsite/AdminWebsite.AcceptanceTests/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,4 +0,0 @@ -using NUnit.Framework; - -[assembly: Parallelizable(ParallelScope.Fixtures)] -[assembly: LevelOfParallelism(3)] \ No newline at end of file diff --git a/AdminWebsite/AdminWebsite.AcceptanceTests/Steps/AccessibilitySteps.cs b/AdminWebsite/AdminWebsite.AcceptanceTests/Steps/AccessibilitySteps.cs deleted file mode 100644 index 2dcfa368f..000000000 --- a/AdminWebsite/AdminWebsite.AcceptanceTests/Steps/AccessibilitySteps.cs +++ /dev/null @@ -1,30 +0,0 @@ -using System.Collections.Generic; -using AcceptanceTests.Common.Driver.Drivers; -using AdminWebsite.AcceptanceTests.Helpers; -using TestApi.Contract.Dtos; -using FluentAssertions; -using Selenium.Axe; -using TechTalk.SpecFlow; - -namespace AdminWebsite.AcceptanceTests.Steps -{ - [Binding] - public class AccessibilitySteps - { - private readonly TestContext _c; - private readonly Dictionary _browsers; - - public AccessibilitySteps(TestContext testContext, Dictionary browsers) - { - _c = testContext; - _browsers = browsers; - } - - [Then(@"the page should be accessible")] - public void ThenThePageShouldBeAccessible() - { - var axeResult = new AxeBuilder(_browsers[_c.CurrentUser].Driver).Analyze(); - axeResult.Violations.Should().BeEmpty(); - } - } -} diff --git a/AdminWebsite/AdminWebsite.AcceptanceTests/Steps/AddParticipantSteps.cs b/AdminWebsite/AdminWebsite.AcceptanceTests/Steps/AddParticipantSteps.cs deleted file mode 100644 index c0da27c27..000000000 --- a/AdminWebsite/AdminWebsite.AcceptanceTests/Steps/AddParticipantSteps.cs +++ /dev/null @@ -1,419 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading; -using AcceptanceTests.Common.Configuration.Users; -using AcceptanceTests.Common.Driver.Drivers; -using AcceptanceTests.Common.Driver.Helpers; -using AcceptanceTests.Common.Model.Participant; -using AcceptanceTests.Common.Test.Steps; -using AdminWebsite.AcceptanceTests.Data; -using AdminWebsite.AcceptanceTests.Helpers; -using AdminWebsite.AcceptanceTests.Pages; -using TestApi.Contract.Dtos; -using FluentAssertions; -using OpenQA.Selenium; -using OpenQA.Selenium.Support.UI; -using TechTalk.SpecFlow; -using TestApi.Contract.Enums; - -namespace AdminWebsite.AcceptanceTests.Steps -{ - [Binding] - public class AddParticipantSteps : ISteps - { - private const int TimeoutToRetrieveUserFromAad = 60; - private const string RepresentingText = "Representative for"; - private const string InterpreterText = "Interpreting for"; - private readonly TestContext _c; - private readonly Dictionary _browsers; - private string _individualDisplayName = RepresentingText; - private readonly CommonSharedSteps _commonSharedSteps; - private readonly BookingDetailsSteps _bookingDetailsSteps; - - public AddParticipantSteps(TestContext testContext, Dictionary browsers, - CommonSharedSteps commonSharedSteps, BookingDetailsSteps bookingDetailsSteps) - { - _c = testContext; - _browsers = browsers; - _bookingDetailsSteps = bookingDetailsSteps; - _commonSharedSteps = commonSharedSteps; - } - - [When(@"the user completes the add participants form")] - public void ProgressToNextPage() - { - AddExistingClaimantIndividual(); - AddExistingClaimantRep(); - AddNewDefendantIndividual(PartyRole.LitigantInPerson); - AddNewDefendantRep(); - VerifyUsersAreAddedToTheParticipantsList(); - ClickNext(); - } - - [When(@"the user adds an Individual")] - public void TheUserAddsAnIndividual() - { - AddExistingClaimantIndividual(); - VerifyUsersAreAddedToTheParticipantsList(); - ClickNext(); - } - - [When(@"the user does not add participants and is on the (.*) page")] - public void TheUserCompletesTheAddParticipantsFormwithOnlyTheJudge(string page) - { - ClickNext(); - _browsers[_c.CurrentUser].PageUrl(Page.FromString(page).Url); - } - - [When(@"the user completes the add participants form with an Interpreter And Litigant In Person")] - public void WhenTheUserCompletesTheAddParticipantsFormWithAnInterpreterAndLitigantInPerson() - { - AddNewDefendantIndividual(PartyRole.LitigantInPerson); - AddNewDefendantIndividual(PartyRole.Interpreter); - AddNewDefendantIndividual(PartyRole.LitigantInPerson); - VerifyUsersAreAddedToTheParticipantsList(); - ClickNext(); - } - - [When(@"the user completes the add participants form with an Interpreter")] - [Given(@"the user completes the add participants form with an Interpreter")] - public void WhenTheUserCompletesTheAddParticipantsFormWithAnInterpreter() - { - AddNewDefendantIndividual(PartyRole.LitigantInPerson); - AddNewDefendantIndividual(PartyRole.Interpreter); - VerifyUsersAreAddedToTheParticipantsList(); - ClickNext(); - } - - [When(@"the user edits booking and adds a Litigant in person")] - public void WhenTheUserEditsBookingAndAddsALitigantInPerson() - { - _browsers[_c.CurrentUser].ClickLink(BookingConfirmationPage.ViewThisBookingLink); - _bookingDetailsSteps.ClickEdit(); - _browsers[_c.CurrentUser].ClickLink(SummaryPage.ParticipantsLink); - AddNewDefendantIndividual(PartyRole.LitigantInPerson); - VerifyUsersAreAddedToTheParticipantsList(); - ClickNext(); - } - - [When(@"the user adds a Litigant in person")] - public void WhenTheUserAddsALitigantInPerson() - { - _browsers[_c.CurrentUser].ClickLink(SummaryPage.ParticipantsLink); - AddNewDefendantIndividual(PartyRole.LitigantInPerson); - VerifyUsersAreAddedToTheParticipantsList(); - } - - - public void ClickNext() - { - _browsers[_c.CurrentUser].Driver.WaitUntilVisible(AddParticipantsPage.NextButton); - _browsers[_c.CurrentUser].Click(AddParticipantsPage.NextButton); - } - - private void AddExistingClaimantIndividual() - { - var individualUser = Users.GetIndividualUser(_c.Users); - var individual = UserToUserAccountMapper.Map(individualUser); - individual.CaseRoleName = Party.Claimant.Name; - individual.HearingRoleName = PartyRole.LitigantInPerson.Name; - _c.Test.HearingParticipants.Add(individual); - SetParty(individual.CaseRoleName); - SetRole(individual.HearingRoleName); - SetExistingIndividualDetails(individual); - } - - private void AddExistingClaimantRep() - { - var repUser = Users.GetRepresentativeUser(_c.Users); - var rep = UserToUserAccountMapper.Map(repUser); - rep.CaseRoleName = Party.Claimant.Name; - rep.HearingRoleName = PartyRole.Representative.Name; - rep.Representee = _c.Users.First(x => x.UserType == UserType.Individual).DisplayName; - _c.Test.HearingParticipants.Add(rep); - SetParty(rep.CaseRoleName); - SetRole(rep.HearingRoleName); - SetExistingRepDetails(rep); - } - - private void AddNewDefendantIndividual(PartyRole partyRole) - { - var individual = CreateNewUser("Individual"); - individual.CaseRoleName = Party.Defendant.Name; - individual.HearingRoleName = partyRole.Name; - _individualDisplayName = individual.DisplayName; - _c.Test.HearingParticipants.Add(individual); - SetParty(individual.CaseRoleName); - SetRole(individual.HearingRoleName); - SetNewIndividualDetails(individual); - } - - private void AddNewDefendantRep() - { - var rep = CreateNewUser("Representative"); - rep.CaseRoleName = Party.Defendant.Name; - rep.HearingRoleName = PartyRole.Representative.Name; - rep.Representee = _individualDisplayName; - _c.Test.HearingParticipants.Add(rep); - SetParty(rep.CaseRoleName); - SetRole(rep.HearingRoleName); - SetNewRepDetails(rep); - } - - private void SetParty(string party) - { - var el = _browsers[_c.CurrentUser].Driver.FindElement(AddParticipantsPage.PartyDropdown); - var partyList = new SelectElement(el); - var waiter = new WebDriverWait(_browsers[_c.CurrentUser].Driver, TimeSpan.FromSeconds(5)); - waiter.Until(_ => partyList.Options.Count > 0); - - _commonSharedSteps.WhenTheUserSelectsTheOptionFromTheDropdown(_browsers[_c.CurrentUser].Driver, AddParticipantsPage.PartyDropdown, Party.FromString(party).Name); - } - - private void SetRole(string role) - { - _commonSharedSteps.WhenTheUserSelectsTheOptionFromTheDropdown(_browsers[_c.CurrentUser].Driver, AddParticipantsPage.RoleDropdown, PartyRole.FromString(role).Name); - } - - private UserAccount CreateNewUser(string role) - { - var user = new UserAccount(); - var prefix = _c.Test.TestData.AddParticipant.Participant.NewUserPrefix; - user.AlternativeEmail = $"{prefix}{Faker.RandomNumber.Next()}@hmcts.net"; - var firstname = Faker.Name.First(); - var lastname = Faker.Name.Last(); - var displayName = $"{firstname} {lastname}"; - user.Firstname = $"{prefix}{firstname}"; - user.Lastname = $"{lastname}"; - user.DisplayName = $"{prefix}{displayName}"; - user.Role = role; - user.Username = $"{user.Firstname.ToLower()}.{user.Lastname.ToLower()}{_c.WebConfig.TestConfig.TestUsernameStem.ToLower()}"; - return user; - } - - private void SetNewIndividualDetails(UserAccount user) - { - _browsers[_c.CurrentUser].Driver.WaitUntilVisible(AddParticipantsPage.ParticipantEmailTextfield).SendKeys(user.AlternativeEmail); - var title = _c.Test.TestData.AddParticipant.Participant.Title; - _commonSharedSteps.WhenTheUserSelectsTheOptionFromTheDropdown(_browsers[_c.CurrentUser].Driver, AddParticipantsPage.TitleDropdown, title); - _browsers[_c.CurrentUser].Driver.WaitUntilVisible(AddParticipantsPage.FirstNameTextfield, _c.WebConfig.SeleniumElementTimeout).SendKeys(user.Firstname); - _browsers[_c.CurrentUser].Driver.WaitUntilVisible(AddParticipantsPage.LastNameTextfield).SendKeys(user.Lastname); - var organisation = _c.Test.TestData.AddParticipant.Participant.Organisation; - _browsers[_c.CurrentUser].Driver.WaitUntilVisible(AddParticipantsPage.IndividualOrganisationTextfield).SendKeys(organisation); - var telephone = _c.Test.TestData.AddParticipant.Participant.Phone; - _browsers[_c.CurrentUser].Driver.WaitUntilVisible(AddParticipantsPage.PhoneTextfield).SendKeys(telephone); - if (user.HearingRoleName == PartyRole.Interpreter.Name) - { - var citizen = _c.Test.HearingParticipants.First(p => p.HearingRoleName == PartyRole.LitigantInPerson.Name); - _commonSharedSteps.WhenTheUserSelectsTheOptionFromTheDropdown(_browsers[_c.CurrentUser].Driver, - AddParticipantsPage.InterpreteeDropdown, citizen.DisplayName); - user.Interpretee = citizen.DisplayName; - } - _browsers[_c.CurrentUser].Driver.WaitUntilVisible(AddParticipantsPage.DisplayNameTextfield).SendKeys(user.DisplayName); - _browsers[_c.CurrentUser].Driver.WaitUntilVisible(AddParticipantsPage.AddParticipantLink); - _browsers[_c.CurrentUser].ScrollTo(AddParticipantsPage.AddParticipantLink); - _browsers[_c.CurrentUser].ClickLink(AddParticipantsPage.AddParticipantLink); - } - - private void EnterTextIfFieldIsNotPrePopulated(By element, string value) - { - if (_browsers[_c.CurrentUser].Driver.WaitUntilVisible(element).GetAttribute("value").Length.Equals(0)) - _browsers[_c.CurrentUser].Driver.WaitUntilVisible(element).SendKeys(value); - } - - private void SetNewRepDetails(UserAccount user) - { - _browsers[_c.CurrentUser].Driver.WaitUntilVisible(AddParticipantsPage.ParticipantEmailTextfield).SendKeys(user.AlternativeEmail); - var title = _c.Test.TestData.AddParticipant.Participant.Title; - _commonSharedSteps.WhenTheUserSelectsTheOptionFromTheDropdown(_browsers[_c.CurrentUser].Driver, AddParticipantsPage.TitleDropdown, title); - _browsers[_c.CurrentUser].Driver.WaitUntilVisible(AddParticipantsPage.FirstNameTextfield).SendKeys(user.Firstname); - _browsers[_c.CurrentUser].Driver.WaitUntilVisible(AddParticipantsPage.LastNameTextfield).SendKeys(user.Lastname); - var telephone = _c.Test.TestData.AddParticipant.Participant.Phone; - _browsers[_c.CurrentUser].Driver.WaitUntilVisible(AddParticipantsPage.PhoneTextfield).SendKeys(telephone); - _browsers[_c.CurrentUser].Driver.WaitUntilVisible(AddParticipantsPage.DisplayNameTextfield).SendKeys(user.DisplayName); - var organisation = _c.Test.TestData.AddParticipant.Participant.Organisation; - _browsers[_c.CurrentUser].Driver.WaitUntilVisible(AddParticipantsPage.RepOrganisationTextfield).SendKeys(organisation); - _browsers[_c.CurrentUser].Driver.WaitUntilVisible(AddParticipantsPage.RepresentingTextfield).SendKeys(user.Representee); - - _browsers[_c.CurrentUser].Driver.WaitUntilVisible(AddParticipantsPage.AddParticipantLink); - _browsers[_c.CurrentUser].ScrollTo(AddParticipantsPage.AddParticipantLink); - _browsers[_c.CurrentUser].ClickLink(AddParticipantsPage.AddParticipantLink); - } - - private void SetExistingIndividualDetails(UserAccount user) - { - ExistingUserEmailIsSelected(user.AlternativeEmail).Should().BeTrue("Existing user email appeared in the dropdown list retrieved from AAD"); - IndividualFieldsAreSet(user); - _browsers[_c.CurrentUser].Driver.WaitUntilVisible(AddParticipantsPage.DisplayNameTextfield).SendKeys(user.DisplayName); - _browsers[_c.CurrentUser].Driver.WaitUntilVisible(AddParticipantsPage.AddParticipantLink); - _browsers[_c.CurrentUser].ScrollTo(AddParticipantsPage.AddParticipantLink); - Thread.Sleep(TimeSpan.FromSeconds(1)); - _browsers[_c.CurrentUser].ClickLink(AddParticipantsPage.AddParticipantLink); - } - - private void SetExistingRepDetails(UserAccount user) - { - ExistingUserEmailIsSelected(user.AlternativeEmail).Should().BeTrue("Existing user email appeared in the dropdown list retrieved from AAD"); - RepFieldsAreSet(user); - _browsers[_c.CurrentUser].Driver.WaitUntilVisible(AddParticipantsPage.DisplayNameTextfield).SendKeys(user.DisplayName); - var organisation = _c.Test.TestData.AddParticipant.Participant.Organisation; - EnterTextIfFieldIsNotPrePopulated(AddParticipantsPage.RepOrganisationTextfield, organisation); - _browsers[_c.CurrentUser].Driver.WaitUntilVisible(AddParticipantsPage.RepresentingTextfield).SendKeys(user.Representee); - _browsers[_c.CurrentUser].Driver.WaitUntilVisible(AddParticipantsPage.AddParticipantLink); - _browsers[_c.CurrentUser].ScrollTo(AddParticipantsPage.AddParticipantLink); - Thread.Sleep(TimeSpan.FromSeconds(1)); - _browsers[_c.CurrentUser].ClickLink(AddParticipantsPage.AddParticipantLink); - } - - private bool ExistingUserEmailIsSelected(string alternativeEmail) - { - _browsers[_c.CurrentUser].Driver.WaitUntilVisible(AddParticipantsPage.ParticipantEmailTextfield).SendKeys(alternativeEmail); - var retrievedListOfEmails = _browsers[_c.CurrentUser].Driver.WaitUntilElementsVisible(AddParticipantsPage.ExistingEmailLinks, TimeoutToRetrieveUserFromAad); - retrievedListOfEmails.Count.Should().BeGreaterThan(0); - foreach (var email in retrievedListOfEmails) - { - if (!email.Text.ToLower().Contains(alternativeEmail.ToLower())) continue; - email.Click(); - return true; - } - - return false; - } - - private void IndividualFieldsAreSet(UserAccount user) - { - _browsers[_c.CurrentUser].Driver.WaitUntilVisible(AddParticipantsPage.ParticipantEmailTextfield).Enabled.Should().BeFalse(); - _browsers[_c.CurrentUser].Driver.WaitUntilVisible(AddParticipantsPage.FirstNameTextfield).Enabled.Should().BeFalse(); - _browsers[_c.CurrentUser].Driver.WaitUntilVisible(AddParticipantsPage.LastNameTextfield).Enabled.Should().BeFalse(); - _browsers[_c.CurrentUser].Driver.WaitUntilVisible(AddParticipantsPage.ParticipantEmailTextfield).GetAttribute("value").Should().Be(user.AlternativeEmail); - _browsers[_c.CurrentUser].Driver.WaitUntilVisible(AddParticipantsPage.FirstNameTextfield).GetAttribute("value").Should().Be(user.Firstname); - _browsers[_c.CurrentUser].Driver.WaitUntilVisible(AddParticipantsPage.LastNameTextfield).GetAttribute("value").Should().Be(user.Lastname); - _browsers[_c.CurrentUser].Driver.WaitUntilVisible(AddParticipantsPage.PhoneTextfield).GetAttribute("value").Should().NotBeNullOrWhiteSpace(); - var organisation = _c.Test.TestData.AddParticipant.Participant.Organisation; - EnterTextIfFieldIsNotPrePopulated(AddParticipantsPage.IndividualOrganisationTextfield, organisation); - } - - private void RepFieldsAreSet(UserAccount user) - { - _browsers[_c.CurrentUser].Driver.WaitUntilVisible(AddParticipantsPage.ParticipantEmailTextfield).Enabled.Should().BeFalse(); - _browsers[_c.CurrentUser].Driver.WaitUntilVisible(AddParticipantsPage.FirstNameTextfield).Enabled.Should().BeFalse(); - _browsers[_c.CurrentUser].Driver.WaitUntilVisible(AddParticipantsPage.LastNameTextfield).Enabled.Should().BeFalse(); - _browsers[_c.CurrentUser].Driver.WaitUntilVisible(AddParticipantsPage.ParticipantEmailTextfield).GetAttribute("value").Should().Be(user.AlternativeEmail); - _browsers[_c.CurrentUser].Driver.WaitUntilVisible(AddParticipantsPage.FirstNameTextfield).GetAttribute("value").Should().Be(user.Firstname); - _browsers[_c.CurrentUser].Driver.WaitUntilVisible(AddParticipantsPage.LastNameTextfield).GetAttribute("value").Should().Be(user.Lastname); - _browsers[_c.CurrentUser].Driver.WaitUntilVisible(AddParticipantsPage.PhoneTextfield).GetAttribute("value").Should().NotBeNullOrWhiteSpace(); - _browsers[_c.CurrentUser].Driver.WaitUntilVisible(AddParticipantsPage.RepOrganisationTextfield).GetAttribute("value").Should().NotBeNullOrWhiteSpace(); - } - - private void VerifyUsersAreAddedToTheParticipantsList() - { - var judge = Users.GetJudgeUser(_c.Users); - _browsers[_c.CurrentUser].Driver - .WaitUntilVisible(AddParticipantsPage.JudgeUserParticipantsList(judge.Username)) - .Displayed.Should().BeTrue(); - - var actualResult = GetAllParticipantsDetails(); - var title = _c.Test.TestData.AddParticipant.Participant.Title; - - foreach (var participant in _c.Test.HearingParticipants) - { - if (participant.Role.ToLower().Equals("judge") || participant.Role.ToLower().Equals("judge")) continue; - if (participant.Role.ToLower().Equals("staff member")) continue; - - var fullNameTitle = $"{title} {participant.Firstname} {participant.Lastname}"; - var expectedParticipant = $"{fullNameTitle} {participant.HearingRoleName} {participant.CaseRoleName}"; - - if (participant.HearingRoleName == PartyRole.Representative.Name) - { - expectedParticipant = $"{fullNameTitle} {RepresentingText} {participant.Representee} {participant.CaseRoleName}"; - } - if (participant.HearingRoleName == PartyRole.Interpreter.Name) - { - expectedParticipant = $"{fullNameTitle} {InterpreterText} {participant.Interpretee} {participant.CaseRoleName}"; - } - - actualResult.Any(x => x.Replace(Environment.NewLine, " ").Equals(expectedParticipant)).Should() - .BeTrue($"expected participant matches {expectedParticipant}"); - } - } - - public List GetAllParticipantsDetails() - { - var elements = _browsers[_c.CurrentUser].Driver.WaitUntilElementsVisible(AddParticipantsPage.ParticipantsList); - return elements.Select(element => element.Text.Trim().Replace("\r\n", " ")).ToList(); - } - - public void EditANewParticipant(string alternativeEmail) - { - var user = GetParticipantByEmailAndUpdateDisplayName(alternativeEmail); - _browsers[_c.CurrentUser].Clear(AddParticipantsPage.DisplayNameTextfield); - _browsers[_c.CurrentUser].Driver.WaitUntilVisible(AddParticipantsPage.DisplayNameTextfield).SendKeys(user.DisplayName); - _browsers[_c.CurrentUser].Driver.WaitUntilVisible(AddParticipantsPage.NextButton); - _browsers[_c.CurrentUser].ScrollTo(AddParticipantsPage.NextButton); - _browsers[_c.CurrentUser].Click(AddParticipantsPage.NextButton); - } - - public void EditAnInterpreter(string alternativeEmail,bool saved = true) - { - var user = GetParticipantByEmailAndUpdateDisplayName(alternativeEmail); - - var citizen = _c.Test.HearingParticipants.FirstOrDefault(p => p.DisplayName != user.Interpretee && p.HearingRoleName == PartyRole.LitigantInPerson.Name); - _commonSharedSteps.WhenTheUserSelectsTheOptionFromTheDropdown(_browsers[_c.CurrentUser].Driver, - AddParticipantsPage.InterpreteeDropdown, citizen.DisplayName); - user.Interpretee = citizen.DisplayName; - if(!saved) - { - _browsers[_c.CurrentUser].Driver.WaitUntilVisible(AddParticipantsPage.UpdateParticipantLink); - _browsers[_c.CurrentUser].ScrollTo(AddParticipantsPage.UpdateParticipantLink); - _browsers[_c.CurrentUser].Click(AddParticipantsPage.UpdateParticipantLink); - } - - ClickNext(); - - } - - private UserAccount GetParticipantByEmailAndUpdateDisplayName(string alternativeEmail) - { - var user = _c.Test.HearingParticipants.First(x => x.AlternativeEmail.ToLower().Equals(alternativeEmail.ToLower())); - user.DisplayName = $"{_c.Test.AddParticipant.Participant.NewUserPrefix}Updated display name"; - return user; - } - - [When(@"the user attempts to add a participant with a reform email")] - public void WhenTheUserAttemptsToAddAParticipantWithAReformEmail() - { - var individualUser = Users.GetIndividualUser(_c.Users); - var individual = UserToUserAccountMapper.Map(individualUser); - individual.CaseRoleName = Party.Claimant.Name; - individual.HearingRoleName = PartyRole.LitigantInPerson.Name; - _c.Test.HearingParticipants.Add(individual); - SetParty(individual.CaseRoleName); - SetRole(individual.HearingRoleName); - _browsers[_c.CurrentUser].Driver.WaitUntilVisible(AddParticipantsPage.ParticipantEmailTextfield).SendKeys(individual.Username); - _browsers[_c.CurrentUser].Driver.WaitUntilVisible(AddParticipantsPage.ParticipantEmailTextfield).SendKeys(Keys.Tab); - } - - [Then(@"an error message is displayed for the invalid email")] - public void ThenAnErrorMessageIsDisplayedForTheInvalidEmail() - { - _browsers[_c.CurrentUser].Driver.WaitUntilVisible(AddParticipantsPage.InvalidEmailError).Displayed.Should().BeTrue(); - } - - [Then(@"audio recording is selected by default with options (.*)")] - public void ThenAudioRecordingIsSelectedByDefaultWithOptions(string option) - { - var enabled = option != "disabled"; - if (!enabled) - { - _browsers[_c.CurrentUser].Driver.WaitUntilVisible(OtherInformationPage.AudioRecordingInterpreterMessage).Displayed.Should().BeTrue(); - } - - _browsers[_c.CurrentUser].Driver.FindElement(OtherInformationPage.AudioRecordYesRadioButton).Selected.Should().BeTrue(); - _browsers[_c.CurrentUser].Driver.FindElement(OtherInformationPage.AudioRecordYesRadioButton).Enabled.Should().Be(enabled); - } - - - - } -} diff --git a/AdminWebsite/AdminWebsite.AcceptanceTests/Steps/AssignJudgeSteps.cs b/AdminWebsite/AdminWebsite.AcceptanceTests/Steps/AssignJudgeSteps.cs deleted file mode 100644 index 05460d7de..000000000 --- a/AdminWebsite/AdminWebsite.AcceptanceTests/Steps/AssignJudgeSteps.cs +++ /dev/null @@ -1,130 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading; -using AcceptanceTests.Common.Configuration.Users; -using AcceptanceTests.Common.Driver.Drivers; -using AcceptanceTests.Common.Driver.Helpers; -using AcceptanceTests.Common.Model.Participant; -using AcceptanceTests.Common.Test.Steps; -using AdminWebsite.AcceptanceTests.Data; -using AdminWebsite.AcceptanceTests.Helpers; -using AdminWebsite.AcceptanceTests.Pages; -using TestApi.Contract.Dtos; -using FluentAssertions; -using TechTalk.SpecFlow; -using OpenQA.Selenium; - -namespace AdminWebsite.AcceptanceTests.Steps -{ - [Binding] - public class AssignJudgeSteps : ISteps - { - private readonly TestContext _c; - private readonly Dictionary _browsers; - private readonly CommonSharedSteps _commonSharedSteps; - - private UserAccount Judge => _c.Test.HearingParticipants.FirstOrDefault(c => c.HearingRoleName == "Judge"); - private string JudgePhone => "01234567890"; - - public AssignJudgeSteps(TestContext testContext, Dictionary browsers, CommonSharedSteps commonSharedSteps) - { - _c = testContext; - _browsers = browsers; - _commonSharedSteps = commonSharedSteps; - } - - [When(@"the user completes the assign judge form")] - public void ProgressToNextPage() - { - JudgeSteps(false); - } - - [When(@"the user completes the assign judge form with phone and email")] - public void WhenTheUserCompletesTheAssignJudgeFormWithPhoneAndEmail() - { - JudgeSteps(true); - } - - private void JudgeSteps(bool updatePhoneAndEmail) - { - _browsers[_c.CurrentUser].WaitForPageToLoad(); - SetTheJudge(); - if (updatePhoneAndEmail) - { - SetJudgeEmailAndPhone(); - } - - if (_c.Test.AssignJudge.AddNewStaff) - { - SetTheNewStaff(); - } - ClickNext(); - } - - [Then(@"the email and phone details are updated")] - public void ThenTheEmailAndPhoneDetailsAreUpdated() - { - _browsers[_c.CurrentUser].Driver.WaitUntilVisible(AssignJudgePage.JudgeEmailId); - _browsers[_c.CurrentUser].Driver.WaitUntilVisible(AssignJudgePage.JudgePhoneId); - _browsers[_c.CurrentUser].TextOf(AssignJudgePage.JudgeEmailId).Should().Be(Judge.AlternativeEmail); - _browsers[_c.CurrentUser].TextOf(AssignJudgePage.JudgePhoneId).Should().Be(JudgePhone); - } - - private void SetTheJudge() - { - var judgeUser = Users.GetJudgeUser(_c.Users); - var judge = UserToUserAccountMapper.Map(judgeUser); - judge.CaseRoleName = Party.Judge.Name; - judge.HearingRoleName = PartyRole.Judge.Name; - _browsers[_c.CurrentUser].Driver.WaitUntilVisible(AssignJudgePage.JudgeSearchField).SendKeys(judge.Username); - _browsers[_c.CurrentUser].Driver.WaitUntilVisible(AssignJudgePage.SearchResults).FindElements(By.TagName("li")).FirstOrDefault().Click(); - _c.Test.HearingParticipants.Add(judge); - } - - private void SetTheNewStaff() - { - string staffMemberDisplayName = "Auto Staff Member"; - string staffMemberRole = "Staff Member"; - - _browsers[_c.CurrentUser].Click(AssignJudgePage.AddStaffMember); - _browsers[_c.CurrentUser].Driver.WaitUntilVisible(AssignJudgePage.AddStaffEmailTextField).SendKeys("man"); - _browsers[_c.CurrentUser].Driver.WaitUntilVisible(AssignJudgePage.SearchResults).FindElements(By.TagName("li")).FirstOrDefault().Click(); - _browsers[_c.CurrentUser].Driver.WaitUntilVisible(AssignJudgePage.AddStaffDisplayNameTextField).SendKeys(staffMemberDisplayName); - - var staffUser = new UserDto() - { - ContactEmail = "manual.StaffMember_01@hearings.reform.hmcts.net", - DisplayName = staffMemberDisplayName, - FirstName = "Manual", - LastName = "StaffMember_01" - }; - - var staffMember = UserToUserAccountMapper.Map(staffUser); - staffMember.CaseRoleName = staffMemberRole; - staffMember.HearingRoleName = staffMemberRole; - staffMember.Role = staffMemberRole; - - _c.Test.HearingParticipants.Add(staffMember); - } - - private void SetJudgeEmailAndPhone() - { - _browsers[_c.CurrentUser].Driver.WaitUntilVisible(AssignJudgePage.JudgeEmailTextField).SendKeys(Judge.AlternativeEmail); - _browsers[_c.CurrentUser].Driver.WaitUntilVisible(AssignJudgePage.JudgePhoneTextField).SendKeys(JudgePhone); - } - - public void EditAudioRecording() - { - Thread.Sleep(TimeSpan.FromSeconds(1)); - ClickNext(); - Thread.Sleep(TimeSpan.FromSeconds(1)); - } - - public void ClickNext() - { - _browsers[_c.CurrentUser].Driver.WaitUntilVisible(AssignJudgePage.NextButton); - _browsers[_c.CurrentUser].Click(AssignJudgePage.NextButton); - } - } -} diff --git a/AdminWebsite/AdminWebsite.AcceptanceTests/Steps/BookingConfirmationSteps.cs b/AdminWebsite/AdminWebsite.AcceptanceTests/Steps/BookingConfirmationSteps.cs deleted file mode 100644 index 7996d265d..000000000 --- a/AdminWebsite/AdminWebsite.AcceptanceTests/Steps/BookingConfirmationSteps.cs +++ /dev/null @@ -1,63 +0,0 @@ -using System.Collections.Generic; -using AcceptanceTests.Common.Driver.Drivers; -using AcceptanceTests.Common.Driver.Helpers; -using AcceptanceTests.Common.Test.Steps; -using AdminWebsite.AcceptanceTests.Data; -using AdminWebsite.AcceptanceTests.Helpers; -using AdminWebsite.AcceptanceTests.Pages; -using TestApi.Contract.Dtos; -using FluentAssertions; -using TechTalk.SpecFlow; - -namespace AdminWebsite.AcceptanceTests.Steps -{ - [Binding] - public class BookingConfirmationSteps : ISteps - { - private readonly TestContext _c; - private readonly Dictionary _browsers; - public BookingConfirmationSteps(TestContext testContext, Dictionary browsers) - { - _c = testContext; - _browsers = browsers; - } - - public void ProgressToNextPage() - { - VerifyBookingWasSuccessful(); - _browsers[_c.CurrentUser].ClickLink(_c.Route.Equals(Page.BookingDetails) - ? BookingConfirmationPage.ViewThisBookingLink - : CommonAdminWebPage.BookingsListLink); - } - - [When(@"the user views the booking details after seeing the successful booking message")] - public void TheUserViewsTheBookingDetails() - { - VerifyBookingWasSuccessful(); - _browsers[_c.CurrentUser].ClickLink(BookingConfirmationPage.ViewThisBookingLink); - } - - [When(@"the user views the booking confirmation form")] - public void VerifyBookingWasSuccessful() - { - _browsers[_c.CurrentUser].Driver.WaitUntilVisible(BookingConfirmationPage.SuccessMessage).Displayed.Should().BeTrue(); - _browsers[_c.CurrentUser].Driver.WaitForPageToLoad(); - _browsers[_c.CurrentUser].TextOf(BookingConfirmationPage.CaseNumber).Should().Contain(_c.Test.HearingDetails.CaseNumber); - _browsers[_c.CurrentUser].TextOf(BookingConfirmationPage.CaseName).Should().Contain(_c.Test.HearingDetails.CaseName); - var scheduleDate = _c.Test.HearingSchedule.ScheduledDate.ToString(DateFormats.HearingSummaryDate); - _browsers[_c.CurrentUser].TextOf(BookingConfirmationPage.HearingDate).ToLower().Should().Be(scheduleDate.ToLower()); - } - - [When(@"the user clicks the Return to dashboard link")] - public void WhenTheUserClicksTheDashboardLink() - { - _browsers[_c.CurrentUser].ClickLink(BookingConfirmationPage.ReturnToDashboardLink); - } - - [When(@"the user clicks the Book another hearing button")] - public void WhenTheUserClicksTheBookAnotherHearingButton() - { - _browsers[_c.CurrentUser].Click(BookingConfirmationPage.BookAnotherHearingButton); - } - } -} diff --git a/AdminWebsite/AdminWebsite.AcceptanceTests/Steps/BookingDetailsSteps.cs b/AdminWebsite/AdminWebsite.AcceptanceTests/Steps/BookingDetailsSteps.cs deleted file mode 100644 index d6e8294ed..000000000 --- a/AdminWebsite/AdminWebsite.AcceptanceTests/Steps/BookingDetailsSteps.cs +++ /dev/null @@ -1,138 +0,0 @@ -using System.Collections.Generic; -using AcceptanceTests.Common.Driver.Drivers; -using AcceptanceTests.Common.Driver.Helpers; -using AcceptanceTests.Common.Test.Steps; -using AdminWebsite.AcceptanceTests.Helpers; -using AdminWebsite.AcceptanceTests.Pages; -using FluentAssertions; -using TechTalk.SpecFlow; -using TestApi.Contract.Dtos; - -namespace AdminWebsite.AcceptanceTests.Steps -{ - [Binding] - public class BookingDetailsSteps : ISteps - { - private readonly TestContext _c; - private readonly Dictionary _browsers; - private readonly CommonSharedSteps _commonSharedSteps; - private readonly BookingsListSteps _bookingsListSteps; - - public BookingDetailsSteps(TestContext testContext, Dictionary browsers, CommonSharedSteps commonSharedSteps, BookingsListSteps bookingsListSteps) - { - _c = testContext; - _browsers = browsers; - _commonSharedSteps = commonSharedSteps; - _bookingsListSteps = bookingsListSteps; - } - - [When(@"the user views the booking details")] - [Then(@"the user views the booking details")] - public void WhenTheUserViewsTheBookingDetails() - { - } - - [When(@"the user confirms the hearing")] - public void WhenTheUserConfirmsTheBooking() - { - } - - [When(@"the user confirms all the hearings")] - public void WhenTheUserConfirmsAllTheBookings() - { - } - - [Then(@"the hearing is available in video web")] - public void ThenTheHearingIsAvailableInTheVideoWeb() - { - } - - [Then(@"the hearings are available in video web")] - public void ThenTheHearingsAreAvailableInTheVideoWeb() - { - } - - [Then(@"the conference details match the hearing")] - public void ThenTheConferenceMatchesTheHearing() - { - } - - [When(@"the user cancels the hearing without a cancel reason")] - public void WhenTheUserCancelsTheHearingWithoutACancelReason() - { - _browsers[_c.CurrentUser].Driver.WaitUntilVisible(BookingDetailsPage.CancelButton); - _browsers[_c.CurrentUser].ScrollTo(BookingDetailsPage.CancelButton); - _browsers[_c.CurrentUser].Click(BookingDetailsPage.CancelButton); - _browsers[_c.CurrentUser].Click(BookingDetailsPage.ConfirmCancelButton); - } - - [Then(@"an error message is displayed and hearing is not cancelled")] - public void ThenAnErrorMessageIsDisplayedAndHearingIsNotCancelled() - { - _browsers[_c.CurrentUser].Driver.WaitUntilVisible(BookingDetailsPage.CancelReasonDropdownErrorLabel).Displayed.Should().BeTrue(); - _browsers[_c.CurrentUser].Click(BookingDetailsPage.KeepBookingButton); - } - - [When(@"the user cancels the hearing")] - public void WhenTheUserAttemptsToCancelTheHearing() - { - _browsers[_c.CurrentUser].Driver.WaitUntilVisible(BookingDetailsPage.CancelButton); - _browsers[_c.CurrentUser].ScrollTo(BookingDetailsPage.CancelButton); - _browsers[_c.CurrentUser].Click(BookingDetailsPage.CancelButton); - - _commonSharedSteps.WhenTheUserSelectsTheOptionFromTheDropdown(_browsers[_c.CurrentUser].Driver, - BookingDetailsPage.CancelReasonDropdown, _c.Test.TestData.BookingDetailsPage.CancelReason); - _browsers[_c.CurrentUser].Click(BookingDetailsPage.ConfirmCancelButton); - } - - [When(@"the user cancels the hearing with other reason and no text")] - public void WhenTheUserCancelsTheHearingWithOtherReason() - { - _browsers[_c.CurrentUser].Driver.WaitUntilVisible(BookingDetailsPage.CancelButton); - _browsers[_c.CurrentUser].ScrollTo(BookingDetailsPage.CancelButton); - _browsers[_c.CurrentUser].Click(BookingDetailsPage.CancelButton); - - _commonSharedSteps.WhenTheUserSelectsTheOptionFromTheDropdown(_browsers[_c.CurrentUser].Driver, - BookingDetailsPage.CancelReasonDropdown, _c.Test.TestData.BookingDetailsPage.CancelReason2); - _browsers[_c.CurrentUser].Click(BookingDetailsPage.ConfirmCancelButton); - } - - [Then(@"an error message is displayed for the details box and hearing is not cancelled")] - public void ThenAnErrorMessageIsDisplayedForTheDetailsBoxAndHearingIsNotCancelled() - { - _browsers[_c.CurrentUser].Driver.WaitUntilVisible(BookingDetailsPage.CancelReasonDetailsErrorLabel).Displayed.Should().BeTrue(); - _browsers[_c.CurrentUser].Click(BookingDetailsPage.KeepBookingButton); - } - - [Then(@"the hearing is cancelled")] - public void ThenTheHearingIsCancelled() - { - } - - [Then(@"the conference is deleted")] - public void ThenTheConferenceIsDeleted() - { - } - - [When(@"the user cancels the hearing with other reason and detail text")] - public void WhenTheUserCancelsTheHearingWithOtherReasonAndDetailText() - { - _browsers[_c.CurrentUser].Driver.WaitUntilVisible(BookingDetailsPage.CancelButton); - _browsers[_c.CurrentUser].ScrollTo(BookingDetailsPage.CancelButton); - _browsers[_c.CurrentUser].Click(BookingDetailsPage.CancelButton); - - _commonSharedSteps.WhenTheUserSelectsTheOptionFromTheDropdown(_browsers[_c.CurrentUser].Driver, - BookingDetailsPage.CancelReasonDropdown, _c.Test.TestData.BookingDetailsPage.CancelReason2); - _browsers[_c.CurrentUser].Driver.WaitUntilVisible(BookingDetailsPage.CancelReasonTextfield).SendKeys(_c.Test.TestData.BookingDetailsPage.DetailReason); - _browsers[_c.CurrentUser].Click(BookingDetailsPage.ConfirmCancelButton); - } - - public void ClickEdit() - { - _browsers[_c.CurrentUser].Driver.WaitUntilVisible(BookingDetailsPage.EditButton); - _browsers[_c.CurrentUser].ScrollTo(BookingDetailsPage.EditButton); - _browsers[_c.CurrentUser].Click(BookingDetailsPage.EditButton); - } - public void ProgressToNextPage() { } - } -} diff --git a/AdminWebsite/AdminWebsite.AcceptanceTests/Steps/BookingsListSteps.cs b/AdminWebsite/AdminWebsite.AcceptanceTests/Steps/BookingsListSteps.cs deleted file mode 100644 index 5a41496ff..000000000 --- a/AdminWebsite/AdminWebsite.AcceptanceTests/Steps/BookingsListSteps.cs +++ /dev/null @@ -1,71 +0,0 @@ -using System.Collections.Generic; -using AcceptanceTests.Common.Driver.Drivers; -using AcceptanceTests.Common.Driver.Helpers; -using AcceptanceTests.Common.Test.Steps; -using AdminWebsite.AcceptanceTests.Helpers; -using AdminWebsite.AcceptanceTests.Pages; -using TestApi.Contract.Dtos; -using FluentAssertions; -using TechTalk.SpecFlow; - -namespace AdminWebsite.AcceptanceTests.Steps -{ - [Binding] - public class BookingsListSteps : ISteps - { - private const int RETRIES = 10; - private readonly TestContext _c; - private readonly Dictionary _browsers; - private string _rowId; - public BookingsListSteps(TestContext testContext, Dictionary browsers) - { - _c = testContext; - _browsers = browsers; - } - - [When(@"selects a booking")] - public void ProgressToNextPage() - { - _rowId = GetRowId(_c.Test.HearingDetails.CaseNumber); - _browsers[_c.CurrentUser].Click(BookingsListPage.RowWithId(_rowId)); - } - - [When(@"selects a booking by case name (.*)")] - public void SelectsBookingByCaseName(string caseName) - { - NUnit.Framework.TestContext.WriteLine($"Searching for '{caseName}' to select..."); - - _browsers[_c.CurrentUser].Driver.WaitUntilVisible(BookingsListPage.Row(caseName)); - - for (var i = 0; i < RETRIES; i++) - { - _rowId = GetRowId(caseName); - if (_rowId == null || _rowId.Equals(string.Empty)) continue; - break; - } - - _browsers[_c.CurrentUser].Driver.WaitUntilVisible(BookingsListPage.RowWithId(_rowId)); - _browsers[_c.CurrentUser].Click(BookingsListPage.RowWithId(_rowId)); - } - - [When(@"the user views the bookings list")] - public void WhenTheUserViewsTheBookingsList() - { - _rowId = GetRowId(_c.Test.HearingDetails.CaseNumber); - _browsers[_c.CurrentUser].TextOf(BookingsListPage.ScheduledTime(_rowId)).ToLower().Should().Be(_c.Test.HearingSchedule.ScheduledDate.ToShortTimeString().ToLower()); - _browsers[_c.CurrentUser].TextOf(BookingsListPage.ScheduledDuration(_rowId)).Should().Contain($"listed for {_c.Test.TestData.HearingSchedule.DurationMinutes} minutes"); - _browsers[_c.CurrentUser].Driver.WaitUntilVisible(BookingsListPage.CaseName(_rowId, _c.Test.HearingDetails.CaseName)).Displayed.Should().BeTrue(); - _browsers[_c.CurrentUser].Driver.WaitUntilVisible(BookingsListPage.CaseNumber(_rowId, _c.Test.HearingDetails.CaseNumber)).Displayed.Should().BeTrue(); - _browsers[_c.CurrentUser].Driver.WaitUntilVisible(BookingsListPage.CaseType(_rowId, _c.Test.HearingDetails.CaseType.Name)).Displayed.Should().BeTrue(); - _browsers[_c.CurrentUser].Driver.WaitUntilVisible(BookingsListPage.HearingType(_rowId, _c.Test.HearingDetails.HearingType.Name)).Displayed.Should().BeTrue(); - var judge = Users.GetJudgeUser(_c.Users); - _browsers[_c.CurrentUser].Driver.WaitUntilVisible(BookingsListPage.Judge(_rowId, judge.DisplayName)).Displayed.Should().BeTrue(); - _browsers[_c.CurrentUser].Driver.WaitUntilVisible(BookingsListPage.Venue(_rowId, _c.Test.TestData.HearingSchedule.HearingVenue)).Displayed.Should().BeTrue(); - } - - private string GetRowId(string text) - { - return _browsers[_c.CurrentUser].Driver.WaitUntilVisible(BookingsListPage.Row(text)).GetAttribute("id"); - } - } -} diff --git a/AdminWebsite/AdminWebsite.AcceptanceTests/Steps/BrowserSteps.cs b/AdminWebsite/AdminWebsite.AcceptanceTests/Steps/BrowserSteps.cs deleted file mode 100644 index 0f7bc4e21..000000000 --- a/AdminWebsite/AdminWebsite.AcceptanceTests/Steps/BrowserSteps.cs +++ /dev/null @@ -1,108 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using AcceptanceTests.Common.Driver.Drivers; -using AcceptanceTests.Common.Driver.Enums; -using AdminWebsite.AcceptanceTests.Helpers; -using AdminWebsite.AcceptanceTests.Pages; -using TestApi.Contract.Dtos; -using TechTalk.SpecFlow; - -namespace AdminWebsite.AcceptanceTests.Steps -{ - [Binding] - public class BrowserSteps - { - private readonly TestContext _c; - private readonly Dictionary _browsers; - - public BrowserSteps(TestContext testContext, Dictionary browsers) - { - _c = testContext; - _browsers = browsers; - } - - [Given(@"a new browser is open for (?:user|the|a|an) (.*)")] - [Given(@"(?:the|an|a) (.*) is on the login page")] - public void GivenANewBrowserIsOpenFor(string user) - { - SwitchCurrentUser(user); - - _browsers.Add(_c.CurrentUser, new UserBrowser() - .SetBaseUrl(_c.WebConfig.VhServices.AdminWebUrl) - .SetTargetBrowser(_c.WebConfig.TestConfig.TargetBrowser) - .SetTargetDevice(_c.WebConfig.TestConfig.TargetDevice) - .SetDriver(_c.Driver)); - - _browsers[_c.CurrentUser].LaunchBrowser(); - _browsers[_c.CurrentUser].NavigateToPage(); - - if (_c.WebConfig.TestConfig.TargetBrowser != TargetBrowser.Ie11) - _browsers[_c.CurrentUser].PageUrl(_c.Test.CommonData.CommonUris.LoginUri); - } - - [Given(@"in (.*)'s browser")] - [When(@"in (.*)'s browser")] - [Then(@"in (.*)'s browser")] - public void GivenInTheUsersBrowser(string user) - { - SwitchCurrentUser(user); - - _browsers[_c.CurrentUser].Driver.SwitchTo().Window(_browsers[_c.CurrentUser].LastWindowName); - } - - private void SwitchCurrentUser(string user) - { - if (_c.CurrentUser != null) - _browsers[_c.CurrentUser].LastWindowName = _browsers[_c.CurrentUser].Driver.WrappedDriver.WindowHandles.Last(); - - if (user.Contains("the")) - { - var number = user.Split(" ")[1].Trim(); - _c.CurrentUser = Users.GetUser(_c.Users, number, user); - } - else - { - _c.CurrentUser = UserIsParticipant(user) ? GetDefaultParticipant() : GetMatchingDisplayName(user); - } - - if (_c.CurrentUser == null) - throw new ArgumentOutOfRangeException($"There are no users configured called '{user}'"); - } - - private static bool UserIsParticipant(string user) - { - return user.ToLower().Equals("participant"); - } - - private UserDto GetDefaultParticipant() - { - return Users.GetDefaultParticipantUser(_c.Users); - } - - private UserDto GetMatchingDisplayName(string user) - { - return Users.GetUserFromDisplayName(_c.Users, user); - } - - [When(@"switches to the (.*) tab")] - public void WhenSwitchesToTheNewTab(string url) - { - _browsers[_c.CurrentUser].LastWindowName = _browsers[_c.CurrentUser].SwitchTab(url); - } - - [When(@"the user is on the (.*) page")] - [Then(@"the user is on the (.*) page")] - [Then(@"they should be on the (.*) page")] - public void ThenTheUserIsOnThePage(string page) - { - _browsers[_c.CurrentUser].PageUrl(Page.FromString(page).Url); - } - - [Then(@"the user is not on the (.*) page")] - public void ThenTheUserIsNotOnThePage(string page) - { - _browsers[_c.CurrentUser].PageUrl(page); - } - } -} diff --git a/AdminWebsite/AdminWebsite.AcceptanceTests/Steps/ChangePasswordSteps.cs b/AdminWebsite/AdminWebsite.AcceptanceTests/Steps/ChangePasswordSteps.cs deleted file mode 100644 index c87d538e5..000000000 --- a/AdminWebsite/AdminWebsite.AcceptanceTests/Steps/ChangePasswordSteps.cs +++ /dev/null @@ -1,67 +0,0 @@ -using System.Collections.Generic; -using AcceptanceTests.Common.Driver.Drivers; -using AcceptanceTests.Common.Driver.Helpers; -using AcceptanceTests.Common.PageObject.Pages; -using AcceptanceTests.Common.Test.Steps; -using AdminWebsite.AcceptanceTests.Helpers; -using AdminWebsite.AcceptanceTests.Pages; -using TestApi.Contract.Dtos; -using FluentAssertions; -using TechTalk.SpecFlow; - -namespace AdminWebsite.AcceptanceTests.Steps -{ - [Binding] - public class ChangePasswordSteps - { - private readonly TestContext _c; - private readonly Dictionary _browsers; - private readonly BrowserSteps _browserSteps; - private LoginSharedSteps _loginSteps; - - private UserDto _participant; - - public ChangePasswordSteps(TestContext c, Dictionary browsers, BrowserSteps browserSteps) - { - _c = c; - _browsers = browsers; - _browserSteps = browserSteps; - } - - [When(@"the user resets the participants password")] - public void WhenTheUserResetsTheParticipantsPassword() - { - _participant = Users.GetIndividualUser(_c.Users); - _browsers[_c.CurrentUser].Driver.WaitUntilVisible(ChangePasswordPage.UsernameTextfield).SendKeys(_participant.Username); - _browsers[_c.CurrentUser].Click(ChangePasswordPage.UpdateButton); - _browsers[_c.CurrentUser].Driver.WaitUntilVisible(ChangePasswordPage.PasswordHasBeenChangedMessage).Displayed.Should().BeTrue(); - } - - [When(@"the participant accesses the application using the reset password")] - public void WhenTheParticipantAccessesTheApplicationUsingTheResetPassword() - { - _browserSteps.GivenANewBrowserIsOpenFor(_participant.LastName); - _loginSteps = new LoginSharedSteps(_browsers[_c.CurrentUser], _c.CurrentUser.Username, _c.WebConfig.AzureAdConfiguration.TemporaryPassword); - _loginSteps.ProgressToNextPage(); - } - - [Then(@"the user is prompted to change their password")] - public void ThenTheUserIsPromptedToChangeTheirPassword() - { - _browsers[_c.CurrentUser].Driver.WaitUntilVisible(LoginPage.CurrentPassword).Displayed.Should().BeTrue(); - } - - [Then(@"the changed password message can be dismissed")] - public void ThenTheChangedPasswordMessageCanBeDismissed() - { - _browsers[_c.CurrentUser].Click(ChangePasswordPage.OkButton); - _browsers[_c.CurrentUser].Driver.WaitUntilElementNotVisible(ChangePasswordPage.PasswordHasBeenChangedMessage); - } - - [When(@"the user changes their password")] - public void WhenTheUserChangesTheirPassword() - { - _loginSteps.ChangeThePassword(_c.WebConfig.AzureAdConfiguration.TemporaryPassword, _c.WebConfig.TestConfig.TestUserPassword); - } - } -} diff --git a/AdminWebsite/AdminWebsite.AcceptanceTests/Steps/CommonSteps.cs b/AdminWebsite/AdminWebsite.AcceptanceTests/Steps/CommonSteps.cs deleted file mode 100644 index b55e1e60a..000000000 --- a/AdminWebsite/AdminWebsite.AcceptanceTests/Steps/CommonSteps.cs +++ /dev/null @@ -1,29 +0,0 @@ -using System.Collections.Generic; -using AcceptanceTests.Common.Driver.Drivers; -using AdminWebsite.AcceptanceTests.Helpers; -using AdminWebsite.AcceptanceTests.Pages; -using TestApi.Contract.Dtos; -using TechTalk.SpecFlow; - -namespace AdminWebsite.AcceptanceTests.Steps -{ - [Binding] - public sealed class CommonSteps - { - private readonly TestContext _c; - private readonly Dictionary _browsers; - public CommonSteps(TestContext testContext, Dictionary browsers) - { - _c = testContext; - _browsers = browsers; - } - - [Then(@"they can navigate to the Open Government licence")] - public void ThenTheyCanNavigateToTheOpenGovernmentLicence() - { - _browsers[_c.CurrentUser].ScrollTo(CommonAdminWebPage.OpenGovernmentLicenceLink); - _browsers[_c.CurrentUser].ClickLink(CommonAdminWebPage.OpenGovernmentLicenceLink); - _browsers[_c.CurrentUser].NavigateBack(); - } - } -} diff --git a/AdminWebsite/AdminWebsite.AcceptanceTests/Steps/DashboardSteps.cs b/AdminWebsite/AdminWebsite.AcceptanceTests/Steps/DashboardSteps.cs deleted file mode 100644 index fb20bd531..000000000 --- a/AdminWebsite/AdminWebsite.AcceptanceTests/Steps/DashboardSteps.cs +++ /dev/null @@ -1,110 +0,0 @@ -using System.Collections.Generic; -using AcceptanceTests.Common.Driver.Drivers; -using AcceptanceTests.Common.Driver.Helpers; -using AcceptanceTests.Common.Test.Steps; -using AdminWebsite.AcceptanceTests.Helpers; -using AdminWebsite.AcceptanceTests.Pages; -using TestApi.Contract.Dtos; -using FluentAssertions; -using TechTalk.SpecFlow; -using TestApi.Contract.Enums; - -namespace AdminWebsite.AcceptanceTests.Steps -{ - [Binding] - public class DashboardSteps : ISteps - { - private readonly TestContext _c; - private readonly Dictionary _browsers; - public DashboardSteps(TestContext testContext, Dictionary browsers) - { - _c = testContext; - _browsers = browsers; - } - - public void ProgressToNextPage() - { - if (_c.Route.Equals(Page.HearingDetails)) - { - _browsers[_c.CurrentUser].Click(DashboardPage.BookVideoHearingPanel); - } - else if (_c.Route.Equals(Page.Questionnaire)) - { - _browsers[_c.CurrentUser].Click(DashboardPage.QuestionnaireResultsPanel); - } - else if (_c.Route.Equals(Page.ChangePassword)) - { - _browsers[_c.CurrentUser].Click(DashboardPage.ChangePasswordPanel); - } - else if (_c.Route.Equals(Page.GetAudioFile)) - { - _browsers[_c.CurrentUser].Click(DashboardPage.GetAudioFilePanel); - } - else if (_c.Route.Equals(Page.DeleteUser)) - { - _browsers[_c.CurrentUser].Click(DashboardPage.DeleteUserPanel); - } - else if (_c.Route.Equals(Page.EditParticipantName)) - { - _browsers[_c.CurrentUser].Click(DashboardPage.EditParticipantName); - } - else - { - _browsers[_c.CurrentUser].Click(DashboardPage.BookVideoHearingPanel); - } - } - - [When(@"the user navigates to the Bookings List page")] - public void WhenTheUserNavigatesToTheBookingsList() - { - _browsers[_c.CurrentUser].Click(CommonAdminWebPage.BookingsListLink); - } - - [Then(@"there are various dashboard options available")] - public void ThenThereAreVariousDashboardOptionsAvailable() - { - _browsers[_c.CurrentUser].Driver.WaitUntilVisible(DashboardPage.BookVideoHearingPanel).Displayed.Should().BeTrue(); - OnlyVhosCanSeeTheQuestionnaireResults(); - OnlyVhosCanSeeThePasswordReset(); - OnlyVhosCanSeeTheGetAudioFile(); - _browsers[_c.CurrentUser].Driver.WaitUntilVisible(CommonAdminWebPage.DashboardLink).Displayed.Should().BeTrue(); - _browsers[_c.CurrentUser].Driver.WaitUntilVisible(CommonAdminWebPage.BookingsListLink).Displayed.Should().BeTrue(); - } - - private void OnlyVhosCanSeeTheQuestionnaireResults() - { - if (_c.CurrentUser.UserType == UserType.VideoHearingsOfficer) - { - _browsers[_c.CurrentUser].Driver.WaitUntilVisible(DashboardPage.QuestionnaireResultsPanel).Displayed.Should().BeTrue(); - } - else - { - _browsers[_c.CurrentUser].Driver.WaitUntilElementNotVisible(DashboardPage.QuestionnaireResultsPanel).Should().BeTrue(); - } - } - - private void OnlyVhosCanSeeThePasswordReset() - { - if (_c.CurrentUser.UserType == UserType.VideoHearingsOfficer) - { - _browsers[_c.CurrentUser].Driver.WaitUntilVisible(DashboardPage.ChangePasswordPanel).Displayed.Should().BeTrue(); - } - else - { - _browsers[_c.CurrentUser].Driver.WaitUntilElementNotVisible(DashboardPage.ChangePasswordPanel).Should().BeTrue(); - } - } - - private void OnlyVhosCanSeeTheGetAudioFile() - { - if (_c.CurrentUser.UserType == UserType.VideoHearingsOfficer) - { - _browsers[_c.CurrentUser].Driver.WaitUntilVisible(DashboardPage.GetAudioFilePanel).Displayed.Should().BeTrue(); - } - else - { - _browsers[_c.CurrentUser].Driver.WaitUntilElementNotVisible(DashboardPage.GetAudioFilePanel).Should().BeTrue(); - } - } - } -} diff --git a/AdminWebsite/AdminWebsite.AcceptanceTests/Steps/EditParticipantNameSteps.cs b/AdminWebsite/AdminWebsite.AcceptanceTests/Steps/EditParticipantNameSteps.cs deleted file mode 100644 index a4c90580a..000000000 --- a/AdminWebsite/AdminWebsite.AcceptanceTests/Steps/EditParticipantNameSteps.cs +++ /dev/null @@ -1,87 +0,0 @@ -using AcceptanceTests.Common.Driver.Drivers; -using AcceptanceTests.Common.Driver.Helpers; -using AdminWebsite.AcceptanceTests.Helpers; -using AdminWebsite.AcceptanceTests.Pages; -using TestApi.Contract.Dtos; -using FluentAssertions; -using System.Collections.Generic; -using TechTalk.SpecFlow; - -namespace AdminWebsite.AcceptanceTests.Steps -{ - [Binding] - public class EditParticipantNameSteps - { - private readonly TestContext _c; - private readonly Dictionary _browsers; - private UserDto _participant; - - public EditParticipantNameSteps(TestContext c, Dictionary browsers) - { - _c = c; - _browsers = browsers; - } - - [When(@"I search for '(.*)' by contact email")] - public void WhenISearchForTheParticipantByContactEmail(string userType) - { - SearchParticipantBy(userType); - } - - [When(@"then update First and Last Name")] - public void WhenThenUpdateFirstAndLastName() - { - var emailLink = EditParticipantNamePage.ContactEmailLink(_participant.ContactEmail); - _browsers[_c.CurrentUser].Driver.WaitUntilVisible(emailLink); - _browsers[_c.CurrentUser].Click(emailLink); - _browsers[_c.CurrentUser].Driver.WaitUntilVisible(EditParticipantNamePage.FirstNameField).Clear(); - _browsers[_c.CurrentUser].Driver.WaitUntilVisible(EditParticipantNamePage.FirstNameField).SendKeys(_participant.FirstName); - _browsers[_c.CurrentUser].Driver.WaitUntilVisible(EditParticipantNamePage.LastNameField).Clear(); - _browsers[_c.CurrentUser].Driver.WaitUntilVisible(EditParticipantNamePage.LastNameField).SendKeys(_participant.LastName); - _browsers[_c.CurrentUser].Driver.WaitUntilVisible(EditParticipantNamePage.SaveButton); - _browsers[_c.CurrentUser].Click(EditParticipantNamePage.SaveButton); - } - - [Then(@"the participant's details are updated")] - public void ThenTheParticipantSDetailsAreUpdated() - { - _browsers[_c.CurrentUser].TextOf(EditParticipantNamePage.CompleteSignField).ToLower().Should().Be(EditParticipantNamePage.CompleteSignText); - } - - [Then(@"the user does not exists message is displayed")] - public void ThenTheUserDoesNotExistsMessageIsDisplayed() - { - _browsers[_c.CurrentUser].Driver.WaitUntilVisible(EditParticipantNamePage.UserNotFounMessage).Displayed.Should().BeTrue(); - } - - [Then(@"the user is not allowed to be edited message is displayed")] - public void ThenTheUserIsNotAllowedToBeEditedMessageIsDisplayed() - { - _browsers[_c.CurrentUser].Driver.WaitUntilVisible(EditParticipantNamePage.JudgeNotAllowedToBeEditedMessage).Displayed.Should().BeTrue(); - } - - private void SearchParticipantBy(string userType) - { - var contactEmail = GetParticipantEmail(userType); - _browsers[_c.CurrentUser].Driver.WaitUntilVisible(EditParticipantNamePage.ContactEmailTextField).SendKeys(contactEmail); - _browsers[_c.CurrentUser].Driver.WaitUntilElementClickable(EditParticipantNamePage.SubmitButton); - _browsers[_c.CurrentUser].Click(EditParticipantNamePage.SubmitButton); - - } - - private string GetParticipantEmail(string userType) - { - _participant = userType switch - { - "Individual" => Users.GetIndividualUser(_c.Users), - "Representative" => Users.GetRepresentativeUser(_c.Users), - "PanelMember" => Users.GetPanelMemberUser(_c.Users), - "Judge" => Users.GetJudgeUser(_c.Users), - _ => null - }; - - return _participant == null ? "user@hmcts.net": _participant.ContactEmail; - } - - } -} diff --git a/AdminWebsite/AdminWebsite.AcceptanceTests/Steps/ErrorSteps.cs b/AdminWebsite/AdminWebsite.AcceptanceTests/Steps/ErrorSteps.cs deleted file mode 100644 index d9169b1d8..000000000 --- a/AdminWebsite/AdminWebsite.AcceptanceTests/Steps/ErrorSteps.cs +++ /dev/null @@ -1,38 +0,0 @@ -using System.Collections.Generic; -using AcceptanceTests.Common.Driver.Drivers; -using AcceptanceTests.Common.Driver.Helpers; -using AdminWebsite.AcceptanceTests.Helpers; -using AdminWebsite.AcceptanceTests.Pages; -using TestApi.Contract.Dtos; -using FluentAssertions; -using TechTalk.SpecFlow; - -namespace AdminWebsite.AcceptanceTests.Steps -{ - [Binding] - public class ErrorSteps - { - private readonly TestContext _c; - private readonly Dictionary _browsers; - private readonly LoginSteps _loginSteps; - public ErrorSteps(TestContext testContext, Dictionary browsers, LoginSteps loginSteps) - { - _c = testContext; - _browsers = browsers; - _loginSteps = loginSteps; - } - - [When(@"the user attempts to access the page on their unsupported browser")] - public void WhenTheUserAttemptsToAccessThePageOnTheirUnsupportedBrowser() - { - _loginSteps.ProgressToNextPage(); - } - - [Then(@"the user is on the Unsupported Browser error page with text of how to rectify the problem")] - public void ThenTheUserIsOnTheUnsupportedBrowserErrorPageWithTextOfHowToRectifyTheProblem() - { - _browsers[_c.CurrentUser].Driver.Url.Should().NotContain(Page.Dashboard.Url); - _browsers[_c.CurrentUser].Driver.WaitUntilVisible(ErrorPage.UnsupportedBrowserTitle).Displayed.Should().BeTrue(); - } - } -} diff --git a/AdminWebsite/AdminWebsite.AcceptanceTests/Steps/GetAudioFileSteps.cs b/AdminWebsite/AdminWebsite.AcceptanceTests/Steps/GetAudioFileSteps.cs deleted file mode 100644 index b854e90fc..000000000 --- a/AdminWebsite/AdminWebsite.AcceptanceTests/Steps/GetAudioFileSteps.cs +++ /dev/null @@ -1,116 +0,0 @@ -using System.Collections.Generic; -using System.Linq; -using System.Net; -using System.Threading.Tasks; -using AcceptanceTests.Common.Api.Helpers; -using AcceptanceTests.Common.Driver.Drivers; -using AcceptanceTests.Common.Driver.Helpers; -using AdminWebsite.AcceptanceTests.Data; -using AdminWebsite.AcceptanceTests.Helpers; -using AdminWebsite.AcceptanceTests.Pages; -using TestApi.Contract.Dtos; -using FluentAssertions; -using TechTalk.SpecFlow; -using VideoApi.Contract.Responses; -using AcceptanceTests.Common.AudioRecordings; - -namespace AdminWebsite.AcceptanceTests.Steps -{ - [Binding] - public class GetAudioFileSteps - { - private readonly TestContext _c; - private readonly Dictionary _browsers; - - public GetAudioFileSteps(TestContext c, Dictionary browsers) - { - _c = c; - _browsers = browsers; - } - - [Given(@"I have an audio recording for the closed conference")] - public async Task GivenIHaveAnAudioRecordingForMainHearing() - { - var result = await _c.AzureStorage.First().VerifyAudioFileExistsInStorage(); - result.Should().BeTrue("Audio file successfully uploaded to Azure Storage"); - var response = _c.Api.GetConferenceByConferenceId(_c.Test.ConferenceResponse.Id); - response.StatusCode.Should().Be(HttpStatusCode.OK); - var conference = RequestHelper.Deserialise(response.Content); - conference.StartedDateTime.Should().NotBeNull(); - conference.ClosedDateTime.Should().NotBeNull(); - _c.Test.ConferenceResponse = conference; - } - - [Given(@"I have an audio recording for the closed conference with an Interpreter")] - public async Task GivenIHaveAnAudioRecordingForMainHearingAndInterpreter() - { - var fileName = $"{_c.Test.HearingResponse.Id}_interpreter"; - var file = FileManager.CreateNewAudioFile("TestAudioFile.mp4", fileName); - - var asm = new AzureStorageManager() - .SetStorageAccountName(_c.WebConfig.Wowza.StorageAccountName) - .SetStorageAccountKey(_c.WebConfig.Wowza.StorageAccountKey) - .SetStorageContainerName(_c.WebConfig.Wowza.StorageContainerName) - .CreateBlobClient(fileName); - - _c.AzureStorage.Add(asm); - - await asm.UploadAudioFileToStorage(file); - FileManager.RemoveLocalAudioFile(file); - - for (int i = 0; i < _c.AzureStorage.Count(); i++) - { - var result = await _c.AzureStorage[i].VerifyAudioFileExistsInStorage(); - result.Should().BeTrue("Audio file successfully uploaded to Azure Storage"); - } - - var response = _c.Api.GetConferenceByConferenceId(_c.Test.ConferenceResponse.Id); - response.StatusCode.Should().Be(HttpStatusCode.OK); - var conference = RequestHelper.Deserialise(response.Content); - conference.StartedDateTime.Should().NotBeNull(); - conference.ClosedDateTime.Should().NotBeNull(); - _c.Test.ConferenceResponse = conference; - } - - [When(@"I search for the audio recording by case number")] - public void WhenISearchForTheAudioRecordingByCaseNumber() - { - _browsers[_c.CurrentUser].Driver.WaitUntilVisible(GetAudioFilePage.CaseNumberTextField).SendKeys(_c.Test.HearingResponse.Cases.First().Number); - _browsers[_c.CurrentUser].Driver.WaitUntilElementClickable(GetAudioFilePage.SubmitButton); - _browsers[_c.CurrentUser].Click(GetAudioFilePage.SubmitButton); - } - - [Then(@"the audio recording is retrieved")] - public void ThenTheAudioRecordingIsRetrieved() - { - var hearing = _c.Test.HearingResponse; - var caseDetails = hearing.Cases.First(); - var date = _c.TimeZone.Adjust(hearing.ScheduledDateTime).Date.ToString(DateFormats.AudioScheduledDate); - - _browsers[_c.CurrentUser].Driver.WaitUntilVisible(GetAudioFilePage.ResultsCaseNumber(hearing.Id)); - _browsers[_c.CurrentUser].Driver.WaitUntilVisible(GetAudioFilePage.ResultsScheduledTime(hearing.Id)); - _browsers[_c.CurrentUser].Driver.WaitUntilVisible(GetAudioFilePage.ResultsCaseName(hearing.Id)); - _browsers[_c.CurrentUser].Driver.WaitUntilVisible(GetAudioFilePage.ResultsVenue(hearing.Id)); - - _browsers[_c.CurrentUser].TextOf(GetAudioFilePage.ResultsCaseNumber(hearing.Id)).Should().Be(caseDetails.Number); - _browsers[_c.CurrentUser].TextOf(GetAudioFilePage.ResultsScheduledTime(hearing.Id)).Should().Be(date); - _browsers[_c.CurrentUser].TextOf(GetAudioFilePage.ResultsCaseName(hearing.Id)).Should().Be(caseDetails.Name); - _browsers[_c.CurrentUser].TextOf(GetAudioFilePage.ResultsVenue(hearing.Id)).Should().Be($"{hearing.HearingVenueName} {hearing.HearingRoomName}"); - } - - [Then(@"the link can be retrieved")] - [Then(@"the links can be retrieved")] - public void ThenTheLinkCanBeRetrieved() - { - _browsers[_c.CurrentUser].Click(GetAudioFilePage.GetLinkButton); - _browsers[_c.CurrentUser].Driver.WaitUntilVisible(GetAudioFilePage.CopyLinkButton(0)).Displayed.Should().BeTrue(); - _browsers[_c.CurrentUser].ScrollTo(GetAudioFilePage.CopyLinkButton(0)); - - for (int i = 0; i < _c.AzureStorage.Count(); i++) - { - _browsers[_c.CurrentUser].Click(GetAudioFilePage.CopyLinkButton(i)); - _browsers[_c.CurrentUser].Driver.WaitUntilVisible(GetAudioFilePage.LinkCopiedSuccessMessage(i)).Displayed.Should().BeTrue(); - } - } - } -} diff --git a/AdminWebsite/AdminWebsite.AcceptanceTests/Steps/HearingDetailsSteps.cs b/AdminWebsite/AdminWebsite.AcceptanceTests/Steps/HearingDetailsSteps.cs deleted file mode 100644 index 2d8a163b3..000000000 --- a/AdminWebsite/AdminWebsite.AcceptanceTests/Steps/HearingDetailsSteps.cs +++ /dev/null @@ -1,90 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Threading; -using AcceptanceTests.Common.Data.Helpers; -using AcceptanceTests.Common.Driver.Drivers; -using AcceptanceTests.Common.Driver.Helpers; -using AcceptanceTests.Common.Model.Case; -using AcceptanceTests.Common.Model.Hearing; -using AcceptanceTests.Common.Test.Steps; -using AdminWebsite.AcceptanceTests.Helpers; -using AdminWebsite.AcceptanceTests.Pages; -using TestApi.Contract.Dtos; -using TechTalk.SpecFlow; - -namespace AdminWebsite.AcceptanceTests.Steps -{ - [Binding] - public class HearingDetailsSteps : ISteps - { - private readonly TestContext _c; - private readonly Dictionary _browsers; - private readonly CommonSharedSteps _commonSharedSteps; - private readonly Random _fromRandomNumber; - - public HearingDetailsSteps(TestContext testContext, Dictionary browsers, CommonSharedSteps commonSharedSteps) - { - _fromRandomNumber = new Random(); - _c = testContext; - _browsers = browsers; - _commonSharedSteps = commonSharedSteps; - } - - [When(@"the user completes the hearing details form")] - public void ProgressToNextPage() - { - SetHearingDetails(); - SetCaseType(); - SetHearingType(); - _c.Test.HearingDetails.DoNotSendQuestionnaires = _c.Test.TestData.HearingDetails.DoNotSendQuestionnaires; - _browsers[_c.CurrentUser].Click(HearingDetailsPage.NextButton); - } - - [When(@"the user elects to send the questionnaires")] - public void WhenTheUserSelectsToSendTheQuestionnaires() - { - SetHearingDetails(); - SetCaseType(); - SetHearingType(); - _c.Test.HearingDetails.DoNotSendQuestionnaires = false; - _browsers[_c.CurrentUser].Click(HearingDetailsPage.NextButton); - } - - public void EditHearingDetails() - { - Thread.Sleep(TimeSpan.FromSeconds(1)); - SetHearingDetails(); - _browsers[_c.CurrentUser].Driver.WaitUntilVisible(HearingDetailsPage.NextButton); - _browsers[_c.CurrentUser].Click(HearingDetailsPage.NextButton); - Thread.Sleep(TimeSpan.FromSeconds(1)); - } - - public void SetHearingDetails() - { - _c.Test.HearingDetails.CaseNumber = $"{GenerateRandom.CaseNumber(_fromRandomNumber)}"; - _browsers[_c.CurrentUser].Clear(HearingDetailsPage.CaseNumberTextfield); - _browsers[_c.CurrentUser].Driver.WaitUntilVisible(HearingDetailsPage.CaseNumberTextfield).SendKeys(_c.Test.HearingDetails.CaseNumber); - _browsers[_c.CurrentUser].Driver.WaitUntilTextPresent(HearingDetailsPage.CaseNumberTextfield, _c.Test.HearingDetails.CaseNumber); - _c.Test.HearingDetails.CaseName = $"Admin Web Automated Test {GenerateRandom.Letters(_fromRandomNumber)}"; - _browsers[_c.CurrentUser].Clear(HearingDetailsPage.CaseNameTextfield); - _browsers[_c.CurrentUser].Driver.WaitUntilVisible(HearingDetailsPage.CaseNameTextfield).SendKeys(_c.Test.HearingDetails.CaseName); - _browsers[_c.CurrentUser].Driver.WaitUntilTextPresent(HearingDetailsPage.CaseNameTextfield, _c.Test.HearingDetails.CaseName); - } - - public void SetCaseType(CaseType caseType = null) - { - caseType ??= CaseType.FromString(_c.Test.TestData.HearingDetails.CaseType); - - _c.Test.HearingDetails.CaseType = CaseType.FromString(_c.Test.TestData.HearingDetails.CaseType); - _commonSharedSteps.WhenTheUserSelectsTheOptionFromTheDropdown(_browsers[_c.CurrentUser].Driver, HearingDetailsPage.CaseTypeDropdown, CaseType.ToString(caseType)); - } - - public void SetHearingType(HearingType hearingType = null) - { - hearingType ??= HearingType.FromString(_c.Test.TestData.HearingDetails.HearingType); - - _c.Test.HearingDetails.HearingType = hearingType; - _commonSharedSteps.WhenTheUserSelectsTheOptionFromTheDropdown(_browsers[_c.CurrentUser].Driver, HearingDetailsPage.HearingTypeDropdown, HearingType.ToString(hearingType)); - } - } -} diff --git a/AdminWebsite/AdminWebsite.AcceptanceTests/Steps/HearingScheduleSteps.cs b/AdminWebsite/AdminWebsite.AcceptanceTests/Steps/HearingScheduleSteps.cs deleted file mode 100644 index a41fd449c..000000000 --- a/AdminWebsite/AdminWebsite.AcceptanceTests/Steps/HearingScheduleSteps.cs +++ /dev/null @@ -1,190 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading; -using AcceptanceTests.Common.Driver.Drivers; -using AcceptanceTests.Common.Driver.Helpers; -using AcceptanceTests.Common.Test.Steps; -using AdminWebsite.AcceptanceTests.Data; -using AdminWebsite.AcceptanceTests.Helpers; -using AdminWebsite.AcceptanceTests.Pages; -using FluentAssertions; -using TechTalk.SpecFlow; -using TestApi.Contract.Dtos; - -namespace AdminWebsite.AcceptanceTests.Steps -{ - [Binding] - public class HearingScheduleSteps : ISteps - { - private readonly TestContext _c; - private readonly Dictionary _browsers; - private readonly CommonSharedSteps _commonSharedSteps; - - public HearingScheduleSteps(TestContext testContext, Dictionary browsers, CommonSharedSteps commonSharedSteps) - { - _c = testContext; - _browsers = browsers; - _commonSharedSteps = commonSharedSteps; - } - - [When(@"the user completes the hearing schedule form")] - public void ProgressToNextPage() - { - SetHearingScheduleDetails(); - AddHearingDate(); - AddHearingTime(); - AddHearingScheduleDetails(); - ClickNext(); - } - - - [When(@"the user completes the hearing schedule form with multi days")] - public void ProgressToNextPageWithMultiDays() - { - _c.Test.HearingSchedule.MultiDays = true; - ProgressToNextPage(); - } - - public void AddHearingDate() - { - var date = _c.Test.HearingSchedule.ScheduledDate.Date.ToString(DateFormats.LocalDateFormat(_c.WebConfig.SauceLabsConfiguration.RunningOnSauceLabs())); - _browsers[_c.CurrentUser].Clear(HearingSchedulePage.HearingDateTextfield); - _browsers[_c.CurrentUser].Driver.WaitUntilVisible(HearingSchedulePage.HearingDateTextfield).SendKeys(date); - if (_c.Test.HearingSchedule.MultiDays) - { - var endDate = _c.Test.HearingSchedule.EndHearingDate.Date.ToString(DateFormats.LocalDateFormat(_c.WebConfig.SauceLabsConfiguration.RunningOnSauceLabs())); - _browsers[_c.CurrentUser].Clear(HearingSchedulePage.HearingEndDateTextField); - _browsers[_c.CurrentUser].Driver.WaitUntilVisible(HearingSchedulePage.HearingEndDateTextField).SendKeys(endDate); - } - } - - private void AddHearingTime() - { - _browsers[_c.CurrentUser].Clear(HearingSchedulePage.HearingStartTimeHourTextfield); - _browsers[_c.CurrentUser].Driver.WaitUntilVisible(HearingSchedulePage.HearingStartTimeHourTextfield).SendKeys(_c.Test.HearingSchedule.ScheduledDate.Hour.ToString()); - _browsers[_c.CurrentUser].Clear(HearingSchedulePage.HearingStartTimeMinuteTextfield); - _browsers[_c.CurrentUser].Driver.WaitUntilVisible(HearingSchedulePage.HearingStartTimeMinuteTextfield).SendKeys(_c.Test.HearingSchedule.ScheduledDate.Minute.ToString()); - } - - private void AddHearingScheduleDetails() - { - if (!_c.Test.HearingSchedule.MultiDays) - { - _browsers[_c.CurrentUser].Clear(HearingSchedulePage.HearingDurationHourTextfield); - _browsers[_c.CurrentUser].Driver.WaitUntilVisible(HearingSchedulePage.HearingDurationHourTextfield).SendKeys(_c.Test.HearingSchedule.DurationHours.ToString()); - _browsers[_c.CurrentUser].Clear(HearingSchedulePage.HearingDurationMinuteTextfield); - _browsers[_c.CurrentUser].Driver.WaitUntilVisible(HearingSchedulePage.HearingDurationMinuteTextfield).SendKeys(_c.Test.HearingSchedule.DurationMinutes.ToString()); - } - _commonSharedSteps.WhenTheUserSelectsTheOptionFromTheDropdown(_browsers[_c.CurrentUser].Driver, HearingSchedulePage.CourtAddressDropdown, _c.Test.HearingSchedule.HearingVenue); - _browsers[_c.CurrentUser].Clear(HearingSchedulePage.CourtRoomTextfield); - _browsers[_c.CurrentUser].Driver.WaitUntilVisible(HearingSchedulePage.CourtRoomTextfield).SendKeys(_c.Test.HearingSchedule.Room); - } - - private void SetHearingScheduleDetails() - { - _c.Test.HearingSchedule.ScheduledDate = _c.Test.HearingSchedule.ScheduledDate == default ? SetDateAsOneMinuteToMidnight() : UpdateDateAsTenMinutesToMidnight(); - _c.Test.HearingSchedule.DurationHours = _c.Test.HearingSchedule.DurationHours == 0 ? _c.Test.TestData.HearingSchedule.DurationHours : 0; - _c.Test.HearingSchedule.DurationMinutes = _c.Test.HearingSchedule.DurationMinutes == 0 ? _c.Test.TestData.HearingSchedule.DurationMinutes : 25; - _c.Test.HearingSchedule.HearingVenue = _c.Test.HearingSchedule.HearingVenue != null ? "Manchester Civil and Family Justice Centre" : _c.Test.TestData.HearingSchedule.HearingVenue; - _c.Test.HearingSchedule.Room = _c.Test.HearingSchedule.Room != null ? "2" : _c.Test.TestData.HearingSchedule.Room; - - if (!_c.Test.HearingSchedule.MultiDays) return; - SelectMultiDaysHearing(); - _c.Test.HearingSchedule.ScheduledDate = DateHelper.GetNextIfDayIfNotAWorkingDay(_c.Test.HearingSchedule.ScheduledDate); - _c.Test.HearingSchedule.EndHearingDate = DateHelper.GetNextWorkingDay(_c.Test.HearingSchedule.ScheduledDate, NotCountingToday()); - _c.Test.HearingSchedule.NumberOfMultiDays = _c.Test.TestData.HearingSchedule.NumberOfMultiDays; - } - - private int NotCountingToday() - { - return _c.Test.TestData.HearingSchedule.NumberOfMultiDays - 1; - } - - private void SelectMultiDaysHearing() - { - var isCheckboxSelected = _browsers[_c.CurrentUser].Driver.WaitUntilElementExists(HearingSchedulePage.MultiDaysCheckBox).Selected; - if (!isCheckboxSelected) { - _browsers[_c.CurrentUser].ClickCheckbox(HearingSchedulePage.MultiDaysCheckBox); - } - - } - - private static DateTime SetDateAsOneMinuteToMidnight() - { - return DateTime.Today.AddDays(AddDayIfCloseToMidnight()).AddMinutes(-1); - } - - private static DateTime UpdateDateAsTenMinutesToMidnight() - { - return DateTime.Today.AddDays(AddDayIfCloseToMidnight()).AddMinutes(-10); - } - - private static int AddDayIfCloseToMidnight() - { - var utcNow = DateTime.UtcNow.ToShortTimeString(); - if (utcNow.Equals("11:58 PM") || - utcNow.Equals("11:59 PM")) - { - return 2; - } - return 1; - } - - public void EditHearingSchedule() - { - Thread.Sleep(TimeSpan.FromSeconds(1)); - SetHearingScheduleDetails(); - AddHearingDate(); - AddHearingTime(); - AddHearingScheduleDetails(); - ClickNext(); - Thread.Sleep(TimeSpan.FromSeconds(1)); - } - - [When(@"the user attempts to set a date in the past")] - public void WhenTheUserAttemptsToSetADateInThePast() - { - SetHearingScheduleDetails(); - _c.Test.HearingSchedule.ScheduledDate = DateTime.MinValue; - AddHearingDate(); - AddHearingTime(); - AddHearingScheduleDetails(); - } - - [Then(@"an error message appears to enter a future date")] - public void ThenAnErrorMessageAppearsToEnterAFutureDate() - { - _browsers[_c.CurrentUser].Driver.WaitUntilVisible(HearingSchedulePage.HearingDateError).Displayed.Should().BeTrue(); - } - - [When(@"the user attempts to set a time in the past")] - public void WhenTheUserAttemptsToSetATimeInThePast() - { - SetHearingScheduleDetails(); - _c.Test.HearingSchedule.ScheduledDate = DateTime.Today; - AddHearingDate(); - AddHearingTime(); - AddHearingScheduleDetails(); - } - - [Then(@"an error message appears to enter a future time")] - public void ThenAnErrorMessageAppearsToEnterAFutureTime() - { - _browsers[_c.CurrentUser].Driver.WaitUntilVisible(HearingSchedulePage.HearingTimeError).Displayed.Should().BeTrue(); - } - - [Then(@"the user cannot proceed to the next page")] - public void ThenTheUserCannotProceedToTheNextPage() - { - ClickNext(); - _browsers[_c.CurrentUser].PageUrl(Page.AssignJudge.Url, true); - } - - private void ClickNext() - { - _browsers[_c.CurrentUser].Driver.WaitUntilVisible(HearingSchedulePage.NextButton); - _browsers[_c.CurrentUser].Click(HearingSchedulePage.NextButton); - } - } -} \ No newline at end of file diff --git a/AdminWebsite/AdminWebsite.AcceptanceTests/Steps/LoginSteps.cs b/AdminWebsite/AdminWebsite.AcceptanceTests/Steps/LoginSteps.cs deleted file mode 100644 index bb89e28b9..000000000 --- a/AdminWebsite/AdminWebsite.AcceptanceTests/Steps/LoginSteps.cs +++ /dev/null @@ -1,59 +0,0 @@ -using System.Collections.Generic; -using AcceptanceTests.Common.Driver.Drivers; -using AcceptanceTests.Common.PageObject.Pages; -using AcceptanceTests.Common.Test.Steps; -using AdminWebsite.AcceptanceTests.Helpers; -using TestApi.Contract.Dtos; -using FluentAssertions; -using TechTalk.SpecFlow; - -namespace AdminWebsite.AcceptanceTests.Steps -{ - [Binding] - public sealed class LoginSteps : ISteps - { - private LoginSharedSteps _loginSharedSteps; - private readonly Dictionary _browsers; - private readonly TestContext _c; - private const int ReachedThePageRetries = 2; - - public LoginSteps(Dictionary browsers, TestContext testContext) - { - _browsers = browsers; - _c = testContext; - } - - [When(@"they attempt to login with valid credentials")] - public void ProgressToNextPage() - { - _loginSharedSteps = new LoginSharedSteps(_browsers[_c.CurrentUser], _c.CurrentUser.Username, _c.WebConfig.TestConfig.TestUserPassword); - _loginSharedSteps.ProgressToNextPage(); - } - - [Given(@"the user logs out")] - [When(@"the user attempts to logout")] - public void WhenTheUserAttemptsToLogout() - { - _browsers[_c.CurrentUser].ClickLink(CommonPages.SignOutLink); - } - - [Then(@"the sign out link is displayed")] - public void ThenTheSignOutLinkIsDisplayed() - { - _loginSharedSteps.ThenTheSignOutLinkIsDisplayed(); - } - - [Then(@"the user should be navigated to sign in screen")] - public void ThenTheUserShouldBeNavigatedToSignInScreen() - { - _browsers[_c.CurrentUser].Retry(() => _browsers[_c.CurrentUser].Driver.Title.Trim().Should().Be(LoginPage.SignOutTitle), ReachedThePageRetries); - } - - [Then(@"they should be able to logout")] - public void ThenTheyShouldBeAbleToLogout() - { - WhenTheUserAttemptsToLogout(); - ThenTheUserShouldBeNavigatedToSignInScreen(); - } - } -} diff --git a/AdminWebsite/AdminWebsite.AcceptanceTests/Steps/NotificationSteps.cs b/AdminWebsite/AdminWebsite.AcceptanceTests/Steps/NotificationSteps.cs deleted file mode 100644 index 510799bb4..000000000 --- a/AdminWebsite/AdminWebsite.AcceptanceTests/Steps/NotificationSteps.cs +++ /dev/null @@ -1,41 +0,0 @@ -using AdminWebsite.AcceptanceTests.Helpers; -using FluentAssertions; -using System.Linq; -using System.Threading.Tasks; -using TechTalk.SpecFlow; - -namespace AdminWebsite.AcceptanceTests.Steps -{ - [Binding] - public class NotificationSteps - { - private readonly TestContext _testContext; - - public NotificationSteps(TestContext testContext) - { - _testContext = testContext; - } - - [Then(@"the participant has been notified")] - public async Task ThenTheParticipantDetailsAreUpdated() - { - var allNotifications = await _testContext.NotifyClient.GetNotificationsAsync("email"); - var newUserPrefix = _testContext.Test.TestData.AddParticipant.Participant.NewUserPrefix; - foreach (var participant in _testContext.Test.HearingParticipants) - { - var name = $"{participant.Firstname} {participant.Lastname}"; - var username = participant.Username; - var recentNotification = allNotifications.notifications.LastOrDefault(x => x.body.Contains(name) && x.body.Contains(username)); - if (participant.DisplayName.Contains(newUserPrefix)) - { - recentNotification.Should().NotBeNull(); - } - else - { - recentNotification.Should().BeNull(); - } - } - - } - } -} diff --git a/AdminWebsite/AdminWebsite.AcceptanceTests/Steps/OtherInformationSteps.cs b/AdminWebsite/AdminWebsite.AcceptanceTests/Steps/OtherInformationSteps.cs deleted file mode 100644 index 0474596d3..000000000 --- a/AdminWebsite/AdminWebsite.AcceptanceTests/Steps/OtherInformationSteps.cs +++ /dev/null @@ -1,74 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Threading; -using AcceptanceTests.Common.Driver.Drivers; -using AcceptanceTests.Common.Driver.Helpers; -using AcceptanceTests.Common.Test.Steps; -using AdminWebsite.AcceptanceTests.Data.TestData; -using AdminWebsite.AcceptanceTests.Helpers; -using AdminWebsite.AcceptanceTests.Pages; -using TestApi.Contract.Dtos; -using TechTalk.SpecFlow; - -namespace AdminWebsite.AcceptanceTests.Steps -{ - [Binding] - public class OtherInformationSteps : ISteps - { - private readonly TestContext _c; - private readonly Dictionary _browsers; - public OtherInformationSteps(TestContext testContext, Dictionary browsers) - { - _c = testContext; - _browsers = browsers; - } - - [When(@"the user completes the other information form")] - [Then(@"the user completes the other information form")] - public void ProgressToNextPage() - { - Thread.Sleep(TimeSpan.FromSeconds(1)); - SetOtherInformation(); - _browsers[_c.CurrentUser].Clear(OtherInformationPage.OtherInformationTextfield); - _browsers[_c.CurrentUser].Driver.WaitUntilVisible(OtherInformationPage.OtherInformationTextfield) - .SendKeys(GetOtherInfo(_c.Test.TestData.OtherInformationDetails.OtherInformation)); - - ClickNext(); - } - - [When(@"the user sets audio recording to No")] - public void WhenTheUserSetsAudioRecordingToNo() - { - SetAudioRecording(_c.Test.AssignJudge.AudioRecord); - ProgressToNextPage(); - } - - - private void SetOtherInformation() - { - var otherInformationText = "Updated other information"; - _c.Test.TestData.OtherInformationDetails ??= new OtherInformationDetails() { OtherInformation = otherInformationText }; - _c.Test.TestData.OtherInformationDetails.OtherInformation ??= otherInformationText; - } - - private void ClickNext() - { - _browsers[_c.CurrentUser].Driver.WaitUntilVisible(OtherInformationPage.NextButton); - _browsers[_c.CurrentUser].Click(OtherInformationPage.NextButton); - } - - private void SetAudioRecording(bool audioRecord) - { - _browsers[_c.CurrentUser].ClickRadioButton(audioRecord - ? OtherInformationPage.AudioRecordYesRadioButton - : OtherInformationPage.AudioRecordNoRadioButton); - _c.Test.AssignJudge.AudioRecord = audioRecord; - } - - public static string GetOtherInfo(string otherInformation) - { - string otherInformationKey = "|OtherInformation|"; - return otherInformation.Substring(otherInformation.IndexOf(otherInformationKey) + otherInformationKey.Length); - } - } -} diff --git a/AdminWebsite/AdminWebsite.AcceptanceTests/Steps/ProgressionSteps.cs b/AdminWebsite/AdminWebsite.AcceptanceTests/Steps/ProgressionSteps.cs deleted file mode 100644 index dfd86cdb8..000000000 --- a/AdminWebsite/AdminWebsite.AcceptanceTests/Steps/ProgressionSteps.cs +++ /dev/null @@ -1,189 +0,0 @@ -using System.Collections.Generic; -using AcceptanceTests.Common.Test.Steps; -using AdminWebsite.AcceptanceTests.Helpers; -using AdminWebsite.AcceptanceTests.Pages; -using AdminWebsite.AcceptanceTests.Pages.Journeys; -using TechTalk.SpecFlow; - -namespace AdminWebsite.AcceptanceTests.Steps -{ - [Binding] - public class ProgressionSteps - { - private readonly TestContext _c; - private readonly AddParticipantSteps _addParticipantSteps; - private readonly AssignJudgeSteps _assignJudgeSteps; - private readonly BookingConfirmationSteps _bookingConfirmationSteps; - private readonly BookingDetailsSteps _bookingDetailsSteps; - private readonly BookingsListSteps _bookingsListSteps; - private readonly BrowserSteps _browsersSteps; - private readonly DashboardSteps _dashboardSteps; - private readonly HearingDetailsSteps _hearingDetailsSteps; - private readonly HearingScheduleSteps _hearingScheduleSteps; - private readonly LoginSteps _loginSteps; - private readonly OtherInformationSteps _otherInformationSteps; - private readonly SummarySteps _summarySteps; - private readonly VideoAccessPointsSteps _videoAccessPointsSteps; - - public ProgressionSteps( - TestContext testContext, - AddParticipantSteps addParticipantSteps, - AssignJudgeSteps assignJudgeSteps, - BookingConfirmationSteps bookingConfirmationSteps, - BookingDetailsSteps bookingDetailsSteps, - BookingsListSteps bookingsListSteps, - BrowserSteps browserSteps, - DashboardSteps dashboardSteps, - HearingDetailsSteps hearingDetailsSteps, - HearingScheduleSteps hearingScheduleSteps, - LoginSteps loginSteps, - OtherInformationSteps otherInformationSteps, - SummarySteps summarySteps, - VideoAccessPointsSteps videoAccessPointsSteps) - { - _c = testContext; - _addParticipantSteps = addParticipantSteps; - _assignJudgeSteps = assignJudgeSteps; - _bookingConfirmationSteps = bookingConfirmationSteps; - _bookingDetailsSteps = bookingDetailsSteps; - _bookingsListSteps = bookingsListSteps; - _browsersSteps = browserSteps; - _dashboardSteps = dashboardSteps; - _hearingDetailsSteps = hearingDetailsSteps; - _hearingScheduleSteps = hearingScheduleSteps; - _loginSteps = loginSteps; - _otherInformationSteps = otherInformationSteps; - _summarySteps = summarySteps; - _videoAccessPointsSteps = videoAccessPointsSteps; - } - - [Given(@"the (.*) user has progressed to the (.*) page")] - public void GivenIAmOnThePage(string user, string page) - { - _browsersSteps.GivenANewBrowserIsOpenFor(user); - Progression(FromString(page), "Login", page); - } - - [When(@"the user has progressed to the (.*) page")] - [Given(@"the user has progressed to the (.*) page")] - public void WhenIHaveContinuedToThePage(string page) - { - Progression(FromString("Video Access Points"), "Video Access Points", page); - } - - [Given(@"the (.*) user has progressed to the (.*) page of a multi days hearing")] - public void GivenIAmOnThePageOfMultiDaysHearing(string user, string page) - { - _c.Test.HearingSchedule.MultiDays = true; - GivenIAmOnThePage(user, page); - } - - [When(@"progresses from the (.*) page to the (.*) page")] - public void WhenProgressesFromPageToAnotherPage(string from, string to) - { - Progression(FromString(to), from, to); - } - - private static Journey FromString(string page) - { - if (page.ToLower().Equals(Page.BookingsList.Name.ToLower())) - { - return Journey.BookingsList; - } - - if (page.ToLower().Equals(Page.BookingDetails.Name.ToLower())) - { - return Journey.BookingDetails; - } - - if (page.ToLower().Equals(Page.Questionnaire.Name.ToLower())) - { - return Journey.Questionnaire; - } - - if (page.ToLower().Equals(Page.ChangePassword.Name.ToLower())) - { - return Journey.ChangePassword; - } - - if (page.ToLower().Equals(Page.GetAudioFile.Name.ToLower())) - { - return Journey.GetAudioFile; - } - - if (page.ToLower().Equals(Page.EditParticipantName.Name.ToLower())) - { - return Journey.EditParticipantName; - } - - return Journey.BookingConfirmation; - } - - private void Progression(Journey userJourney, string startPageAsString, string endPageAsString) - { - var startPage = Page.FromString(startPageAsString); - var startPageReached = false; - var endPage = Page.FromString(endPageAsString); - var journeys = new Dictionary - { - {Journey.BookingConfirmation, new BookingsConfirmationJourney()}, - {Journey.BookingDetails, new BookingDetailsJourney()}, - {Journey.BookingsList, new BookingListJourney()}, - {Journey.ChangePassword, new ChangePasswordJourney()}, - {Journey.GetAudioFile, new GetAudioFileJourney()}, - {Journey.Questionnaire, new QuestionnaireJourney()}, - {Journey.EditParticipantName, new EditParticipantNameJourney()} - }; - journeys[userJourney].VerifyUserIsApplicableToJourney(_c.CurrentUser.UserType); - journeys[userJourney].VerifyDestinationIsInThatJourney(endPage); - _c.Route = journeys[userJourney].GetNextPage(GetRouteBasedOn(userJourney)); - var journey = journeys[userJourney].Journey(); - var steps = Steps(); - foreach (var page in journey) - { - if (!startPageReached) - { - if (page.Equals(startPage)) - { - startPageReached = true; - } - else - { - continue; - } - } - if (page != Page.Login) _browsersSteps.ThenTheUserIsOnThePage(page.Name); - if (page.Equals(endPage)) break; - steps[page].ProgressToNextPage(); - } - } - - private static Page GetRouteBasedOn(Journey userJourney) - { - if (userJourney == Journey.BookingDetails || userJourney == Journey.BookingsList) - { - return Page.BookingConfirmation; - } - return Page.Dashboard; - } - - private Dictionary Steps() - { - return new Dictionary - { - {Page.AddParticipants, _addParticipantSteps}, - {Page.AssignJudge, _assignJudgeSteps}, - {Page.BookingConfirmation, _bookingConfirmationSteps}, - {Page.BookingDetails, _bookingDetailsSteps}, - {Page.BookingsList, _bookingsListSteps}, - {Page.Dashboard, _dashboardSteps}, - {Page.HearingDetails, _hearingDetailsSteps}, - {Page.HearingSchedule, _hearingScheduleSteps}, - {Page.Login, _loginSteps}, - {Page.OtherInformation, _otherInformationSteps}, - {Page.Summary, _summarySteps}, - {Page.VideoAccessPoints, _videoAccessPointsSteps} - }; - } - } -} diff --git a/AdminWebsite/AdminWebsite.AcceptanceTests/Steps/SummarySteps.cs b/AdminWebsite/AdminWebsite.AcceptanceTests/Steps/SummarySteps.cs deleted file mode 100644 index 1e1299504..000000000 --- a/AdminWebsite/AdminWebsite.AcceptanceTests/Steps/SummarySteps.cs +++ /dev/null @@ -1,267 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Data; -using System.Linq; -using AcceptanceTests.Common.Configuration.Users; -using AcceptanceTests.Common.Driver.Drivers; -using AcceptanceTests.Common.Driver.Helpers; -using AcceptanceTests.Common.Test.Steps; -using AdminWebsite.AcceptanceTests.Data; -using AdminWebsite.AcceptanceTests.Helpers; -using AdminWebsite.AcceptanceTests.Pages; -using TestApi.Contract.Dtos; -using FluentAssertions; -using TechTalk.SpecFlow; - -namespace AdminWebsite.AcceptanceTests.Steps -{ - [Binding] - public class SummarySteps : ISteps - { - private const int TIMEOUT = 60; - private readonly TestContext _c; - private readonly Dictionary _browsers; - private readonly BookingDetailsSteps _bookingDetailsSteps; - private readonly HearingDetailsSteps _hearingDetailsSteps; - private readonly HearingScheduleSteps _hearingScheduleSteps; - private readonly AssignJudgeSteps _assignJudgeSteps; - private readonly AddParticipantSteps _addParticipantSteps; - private readonly OtherInformationSteps _otherInformationSteps; - private readonly VideoAccessPointsSteps _videoAccessPointsSteps; - private UserAccount _newUserToEdit; - - public SummarySteps( - TestContext testContext, - Dictionary browsers, - BookingDetailsSteps bookingDetailsSteps, - HearingDetailsSteps hearingDetailsSteps, - HearingScheduleSteps hearingScheduleSteps, - AssignJudgeSteps assignJudgeSteps, - AddParticipantSteps addParticipantSteps, - OtherInformationSteps otherInformationSteps, - VideoAccessPointsSteps videoAccessPointsSteps) - { - _c = testContext; - _browsers = browsers; - _bookingDetailsSteps = bookingDetailsSteps; - _hearingDetailsSteps = hearingDetailsSteps; - _hearingScheduleSteps = hearingScheduleSteps; - _assignJudgeSteps = assignJudgeSteps; - _addParticipantSteps = addParticipantSteps; - _otherInformationSteps = otherInformationSteps; - _videoAccessPointsSteps = videoAccessPointsSteps; - } - - [When(@"the user views the information on the summary form")] - public void ProgressToNextPage() - { - VerifyHearingDetails(); - VerifyHearingSchedule(); - VerifyAudioRecording(); - VerifyVideoAccessPoints(); - VerifyOtherInformation(); - ClickBook(); - } - - [Then(@"the user views the information on the summary form")] - public void ThenTheUserViewsTheInformationOnTheSummaryForm() - { - ClickBook(); - } - - private void ClickBook() - { - _browsers[_c.CurrentUser].Click(SummaryPage.BookButton); - _browsers[_c.CurrentUser].Driver.WaitUntilElementNotVisible(SummaryPage.WaitPopUp, TIMEOUT); - _c.Test.CreatedBy = _c.CurrentUser.Username; - } - - [When(@"the user edits the (.*)")] - public void WhenTheUserEditsTheHearing(string screen) - { - _bookingDetailsSteps.ClickEdit(); - _browsers[_c.CurrentUser].Click(SummaryPage.EditScreenLink(screen)); - - if (screen.Equals("hearing details")) - { - _hearingDetailsSteps.EditHearingDetails(); - } - else if (screen.Equals("hearing schedule")) - { - _hearingScheduleSteps.EditHearingSchedule(); - } - else if (screen.Equals("audio recording")) - { - _assignJudgeSteps.EditAudioRecording(); - } - else if (screen.Equals("other information")) - { - _otherInformationSteps.ProgressToNextPage(); - } - } - - [When(@"the user edits a new participant")] - public void WhenTheUserEditsANewParticipant() - { - _bookingDetailsSteps.ClickEdit(); - _newUserToEdit = UserManager.GetUserFromDisplayName(_c.Test.HearingParticipants, _c.Test.AddParticipant.Participant.NewUserPrefix); - _browsers[_c.CurrentUser].Click(SummaryPage.EditParticipantLink(_newUserToEdit.Firstname)); - _addParticipantSteps.EditANewParticipant(_newUserToEdit.AlternativeEmail); - } - - [When(@"the user edits an Interpreter")] - public void WhenTheUserEditsAnInterpreter() - { - var user = GetParticipantBy("Interpreter"); - _browsers[_c.CurrentUser].Click(SummaryPage.EditParticipantLink(user.Firstname)); - _addParticipantSteps.EditAnInterpreter(user.AlternativeEmail,false); - } - - [When(@"the user edits a saved Interpreter")] - public void WhenTheUserEditsASavedInterpreter() - { - var user = GetParticipantBy("Interpreter"); - _browsers[_c.CurrentUser].Click(SummaryPage.EditParticipantLink(user.Firstname)); - _addParticipantSteps.EditAnInterpreter(user.AlternativeEmail); - } - - - [When(@"the user removes Individual")] - public void WhenTheUserRemovesIndividual() - { - var participant = GetParticipantBy("Litigant in person"); - string nameOnDisplay = $"Mrs {participant.DisplayName}"; - _browsers[_c.CurrentUser].Click(SummaryPage.RemoveParticipantLink(participant.Firstname)); - _browsers[_c.CurrentUser].Driver.WaitUntilVisible(SummaryPage.RemoveParticipantMessage(nameOnDisplay)).Displayed.Should().BeTrue(); - _browsers[_c.CurrentUser].Click(SummaryPage.RemoveParticipant); - RemoveParticipant(participant, isParticipantListExpectedToExist: false); - } - - [When(@"the user removes participant")] - public void WhenTheUserRemovesParticipant() - { - var participant = GetParticipantBy("Litigant in person"); - _browsers[_c.CurrentUser].Click(SummaryPage.RemoveParticipantLink(participant.Firstname)); - _browsers[_c.CurrentUser].Driver.WaitUntilVisible(SummaryPage.RemoveInterpreterMessage).Displayed.Should().BeTrue(); - _browsers[_c.CurrentUser].Click(SummaryPage.RemoveInterpreter); - RemoveParticipant(participant); - RemoveParticipant(GetParticipantBy("Interpreter")); - } - - [When(@"the user removes Interpreter")] - public void WhenTheUserRemovesInterpreter() - { - var role = "Interpreter"; - _browsers[_c.CurrentUser].Click(SummaryPage.RemoveParticipantLink(GetParticipantBy(role).Firstname)); - _browsers[_c.CurrentUser].Click(SummaryPage.RemoveParticipant); - RemoveParticipant(GetParticipantBy(role)); - } - - private void RemoveParticipant(UserAccount user, bool isParticipantListExpectedToExist = true) - { - _c.Test.HearingParticipants.Remove(user); - - if (isParticipantListExpectedToExist) - ParticipantListContains(user).Should().BeFalse(); - } - - private bool ParticipantListContains(UserAccount interpreter) - { - var participantDetails = _addParticipantSteps.GetAllParticipantsDetails(); - return participantDetails.Any(p => p.Contains(interpreter.Firstname)); - } - - private UserAccount GetParticipantBy(string role) - { - return _c.Test.HearingParticipants.Where(h => h.HearingRoleName == role).FirstOrDefault(); - } - - [When(@"the user edits an endpoint display name")] - public void WhenTheUserEditsAnEndpointDisplayName() - { - _bookingDetailsSteps.ClickEdit(); - _browsers[_c.CurrentUser].Click(SummaryPage.EditScreenLink("video access points")); - _videoAccessPointsSteps.ProgressToNextPage(); - } - - [Then(@"the details are updated")] - public void ThenTheHearingIsUpdated() - { - VerifyHearingDetails(); - VerifyHearingSchedule(); - VerifyAudioRecording(); - VerifyVideoAccessPoints(); - VerifyOtherInformation(); - ClickBook(); - } - - [Then(@"the participant details are updated")] - public void ThenTheParticipantDetailsAreUpdated() - { - ClickBook(); - } - - [Then(@"the questionnaires have been sent")] - public void ThenTheQuestionnairesHaveBeenSent() - { - ProgressToNextPage(); - } - - [Then(@"audio recording is set to No")] - public void ThenAudioRecordingIsSetToNo() - { - VerifyAudioRecording(false); - } - - - private void VerifyHearingDetails() - { - _browsers[_c.CurrentUser].TextOf(SummaryPage.CaseNumber).Should().Be(_c.Test.HearingDetails.CaseNumber); - _browsers[_c.CurrentUser].TextOf(SummaryPage.CaseName).Should().Be(_c.Test.HearingDetails.CaseName); - _browsers[_c.CurrentUser].TextOf(SummaryPage.CaseType).Should().Be(_c.Test.HearingDetails.CaseType.Name); - _browsers[_c.CurrentUser].TextOf(SummaryPage.HearingType).Should().Be(_c.Test.HearingDetails.HearingType.Name); - } - - private void VerifyHearingSchedule() - { - if (!_c.Test.HearingSchedule.MultiDays) - { - var scheduleDate = _c.Test.HearingSchedule.ScheduledDate.ToString(DateFormats.HearingSummaryDate); - _browsers[_c.CurrentUser].TextOf(SummaryPage.HearingDate).ToLower().Should().Be(scheduleDate.ToLower()); - var listedFor = $"listed for {_c.Test.HearingSchedule.DurationMinutes} minutes"; - _browsers[_c.CurrentUser].TextOf(SummaryPage.HearingDuration).Should().Be(listedFor); - } - else - { - var startDate = _c.Test.HearingSchedule.ScheduledDate.ToString(DateFormats.HearingSummaryDateMultiDays); - var endDate = _c.Test.HearingSchedule.EndHearingDate.ToString(DateFormats.HearingSummaryDateMultiDays); - var startTime = _c.Test.HearingSchedule.ScheduledDate.ToString(DateFormats.HearingSummaryTimeMultiDays); - var textDateStart = $"{startDate.ToLower()} -"; - var textDateEnd = $"{endDate.ToLower()}, {startTime.ToLower()}"; - - _browsers[_c.CurrentUser].TextOf(SummaryPage.HearingStartDateMultiDays).ToLower().Should().Be(textDateStart); - _browsers[_c.CurrentUser].TextOf(SummaryPage.HearingEndDateMultiDays).ToLower().Should().Be(textDateEnd); - } - - var courtAddress = $"{_c.Test.HearingSchedule.HearingVenue}, {_c.Test.HearingSchedule.Room}"; - _browsers[_c.CurrentUser].TextOf(SummaryPage.CourtAddress).Should().Be(courtAddress); - } - - private void VerifyAudioRecording(bool audioFlag=true) - { - _browsers[_c.CurrentUser].TextOf(SummaryPage.AudioRecording).Should().Be(audioFlag ? "Yes":"No"); - } - - private void VerifyOtherInformation() - { - var otherInformation = OtherInformationSteps.GetOtherInfo(_c.Test.TestData.OtherInformationDetails.OtherInformation); - _browsers[_c.CurrentUser].TextOf(SummaryPage.OtherInformation).Should().Be(otherInformation); - } - - private void VerifyVideoAccessPoints() - { - var videoAccessPoints = _c.Test.VideoAccessPoints.DisplayName; - _browsers[_c.CurrentUser].TextOf(SummaryPage.VideoAccessPoints(0)).Should().Be(videoAccessPoints); - } - } -} diff --git a/AdminWebsite/AdminWebsite.AcceptanceTests/Steps/TestHelperSteps.cs b/AdminWebsite/AdminWebsite.AcceptanceTests/Steps/TestHelperSteps.cs deleted file mode 100644 index 9c2eba104..000000000 --- a/AdminWebsite/AdminWebsite.AcceptanceTests/Steps/TestHelperSteps.cs +++ /dev/null @@ -1,17 +0,0 @@ -using AdminWebsite.AcceptanceTests.Helpers; -using FluentAssertions; -using TechTalk.SpecFlow; - -namespace AdminWebsite.AcceptanceTests.Steps -{ - [Binding] - public class TestHelperSteps - { - private readonly TestContext _c; - - public TestHelperSteps(TestContext testContext) - { - _c = testContext; - } - } -} diff --git a/AdminWebsite/AdminWebsite.AcceptanceTests/Steps/VideoAccessPointsSteps.cs b/AdminWebsite/AdminWebsite.AcceptanceTests/Steps/VideoAccessPointsSteps.cs deleted file mode 100644 index e84c2cf89..000000000 --- a/AdminWebsite/AdminWebsite.AcceptanceTests/Steps/VideoAccessPointsSteps.cs +++ /dev/null @@ -1,45 +0,0 @@ -using AcceptanceTests.Common.Driver.Drivers; -using AcceptanceTests.Common.Driver.Helpers; -using AcceptanceTests.Common.Test.Steps; -using AdminWebsite.AcceptanceTests.Helpers; -using AdminWebsite.AcceptanceTests.Pages; -using System.Collections.Generic; -using TestApi.Contract.Dtos; -using TechTalk.SpecFlow; - -namespace AdminWebsite.AcceptanceTests.Steps -{ - [Binding] - public class VideoAccessPointsSteps : ISteps - { - private readonly TestContext _c; - private readonly Dictionary _browsers; - public VideoAccessPointsSteps(TestContext testContext, Dictionary browsers) - { - _c = testContext; - _browsers = browsers; - } - - [When(@"the user completes the Video access points form")] - public void ProgressToNextPage() - { - _browsers[_c.CurrentUser].WaitForPageToLoad(); - SetVideoAccessPoint(); - _browsers[_c.CurrentUser].Driver.WaitUntilVisible(VideoAccessPointsPage.DisplayNameField(0)); - _browsers[_c.CurrentUser].Clear(VideoAccessPointsPage.DisplayNameField(0)); - _browsers[_c.CurrentUser].Driver.WaitUntilVisible(VideoAccessPointsPage.DisplayNameField(0)).SendKeys(_c.Test.VideoAccessPoints.DisplayName); - ClickNext(); - } - - private void SetVideoAccessPoint() - { - _c.Test.VideoAccessPoints.DisplayName = _c.Test.VideoAccessPoints.DisplayName != null ? "Test Endpoint 001" : _c.Test.TestData.VideoAccessPoints.DisplayName; - } - - public void ClickNext() - { - _browsers[_c.CurrentUser].Driver.WaitUntilVisible(AssignJudgePage.NextButton); - _browsers[_c.CurrentUser].Click(AssignJudgePage.NextButton); - } - } -} diff --git a/AdminWebsite/AdminWebsite.AcceptanceTests/TestAudioFiles/TestAudioFile.mp4 b/AdminWebsite/AdminWebsite.AcceptanceTests/TestAudioFiles/TestAudioFile.mp4 deleted file mode 100644 index 0be381e9510b8a977757206af19d440df6d62f33..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 10571 zcmai)1yCK$^5{9ZJHZLTIk>yKyITkcch?Zy-6dFXC%C)2y9IX*79hOCckg|FsaN&7 z_E+6AJKNK{GrO}pI}i{ML}o6Y4wlaLwh$1I5bqictE~e&3j_oNyqS}!DFg&%iY>_4 zWfKxY-q_8AgNu=qosor^1p<=BO6?2phY!(Eh3-NIMUJ~`=Z6vXjoisH=3Y$$l!g{C zJI7r;Ybf`T^uCI+7TtZbLZm`t8mSn7s-XzzQdne$5dBGtx*&H&Vsq;Bi;Ae4a%;v*#y%g~y z5S}$mmHUP>Eo`B)8{L?=#kTPY>az`lOdi6VJtKe14hMT$iHB(^Vh9kA&4r4f@==Z; z%_*>)JeYq&9p#2C1@Z_2Cd~Mo-!ashJt}~RgK=IHH8`-sWc+r=@U`8r)X=@uXJFJz zE9IhjV?ItT{jjr!^-ZHBAiO~uB1id?tPJ-Ov*eY3f3dK0MIY%U5PnZzuf(S*Y#J!-4(5nsSZhV?I@vbV z#JBvjvm*^RK7E{181Okfz0?lB_~8Q-^y5CK{S@zg$gYd_GN817@@L_}#tGTxxxXa zN>DgHWanVDcJDCQkIYj$YGjIh@b(qadE$LbXfa}3;WxJ^7u8b>53F>7Up=hoZpv-@ zO`w@n#uL64+`_2Qy&IR0O!W#A(Y`=bm-0O{(>mYuo)UV>1(60pU0^^sv>`g_pKTRFBzZd8qFD1c(NNm)lzAoW> zg*&L(p+e{q+Z>s9I)^jjoTKvtaHrQ~e%hJW%&?Wx1#kMkT|ViDN+jz(sppeP*4F17 z{I`bG8K=MR_wN$7qM^74u}#=lP%tg1mcsHJal7z*YSdMpu`SzM2QlzJIr&RP?TxQ z2V>;2tLB6rY$rbH?9HPe(QmF$oD>81%_^@$1f|~6xgQoSL_Oy}AlOo1?c-J72dK>J z*0El=v@2UPtRelTxR^FSzrJGdZoLvEgUVDh~RjBgTl}AAU!C=JNXIn~sNOZ*WApqXlIcJ_$EI%?T0B>d?w0 zgRG1s?{*~ud95o4-+5z7L`I)M%D|UvA#V6VV$6yyI)y`+S8-A%qnyLgowo(F z6zt;uE;ojXv(PH?Oi>!cb+QYi5@V3PM3pP{ta4H4G$6d>${A+mW(H&)NPX4Ac$2G* zEXC*FDO(I2YOUokX4Ghf$4)#c>e7R=0lND3H@`9qZxu)&%L>eCVHzC(1RV4(kDMVP zJ<~NV%*3*k`t6<7UF;egvcG;cEE?gff@G)Px)_h`qVFcB|F)JAc18@jS>p*xWGwQ` z+uG`tz1lIW(Qo}`AU@^$EPKa@+1}RX5u>wdZ2_B0%L1sA=;sH)k_?q(Nd;iP2xbnNp71r4J`~X4=F+!;&=2Nlc#!U;XTfR^-*asjZw#gYkEu;{@Rkqg z3Z!&+4QhK}TJjzFGeHrC+M||b%QR#QacYXkip1TBWTjY#05AXrpFh!y`A;GhxF1B~$ z>4)62g^sP$C5arWNmnwgFp_YGc(_gHogTglH-^2R+X*4fZT=>HbhHf{EN`IADU*@C z-DrVKS9~71IA0SIQqh%{SB~;acOgL{+xkp%OH6oCU9im@2Anp6!=OI|U2CnfJ4xfI z54Bo?N`nCiBhy6aFwnekSA8#UXl#NbsbdqPXL zBWnWg*{|ek9c<8uAf8<&8BfO|O@@~8 zDz=Mg6~`#18aA-LJ2DScnJvvS>8NZTYERTKqN1EE>VJ4)5*kZ(_c;7od&MbvaO%p_ z{Nvhk3E=8^M`Y92D3jB1pi7SoD~VlX91k6PHD22uceLHN5`*_4rx_#au?r*-ZV;t* zExT8Kj6D%xT3}gf?$zzwK3INAUV;hGj`|Uqq9LP4r%EIdn7MjH=L98xw-k+*FnCJY zxd|ZQpgr3lL{k0!dbc~OUjGwGQfCEtlwJ{ytW|N$6(Y$!ei4%1vqg;W3V;C~!e&1X z{02>W^qd>YCULB{ETC$$$td#MGdhTW+f%6RuiDkIPqn&3#o0LxHIw@Mu>%B=l6a^#ifD=ituoV@14wWZ+@-$m=>T^IM(R<(=4 zL!x#C?f^7D8ITc!3qK#F@oF^@J>4C0-(5SpQskb^pxDf(XJ|LA3+Y9_jAaY9`=~d` zRPKu1+xvZl&AF2Lqp5R$`$T-!{D8Q2%X+93oybl_$s;|Pq2|oAooUtIdUCK=B!(~- z9ufp8gDF}cV~SCFQw}{El2F|JU5W}eD#1p4!3Th)_e5Pkoj9hS>l{|^183AbN#}5UQs)Q2NtaDsss&vY03HF8@E3;ok zy^c+X74C)^a>?LkuvofZWbZirk*6XFY-UgJ{f>jlErf9+9VefAlOZeyATKN8@`y(` zF;y{t$;jvC@?Q%t)l#B{shkqhRexf}GoT4ZMRmg|Dj8eg8-rpCtN@~a(sx_dRHecC zS=g(>^2wl-0#lMJt|wJu&+J1NepRU!L4XrwZ#EJ`DCf+>lVKyYSUCi$SHe~rR?b)` z_-RQS^;3F4R-GjF8TGC5F>@WH!}C{6y{@owy%!<* zFXJWtAoVYW#PGH3QcaJaM+lIf4>bvXeF7Tm@QXo8kh^dWe6B2rw5rdxSwv}o{tO&g z44AO27(9dQAW2bm-OF7Tm__^>CKKTxuUY~uyBE#k#K*{-h#A*n7I^E#Ch~eL)p<8E zr=Q!70!I{x^}o5Qc8Wj0*7BilY~e0`N$>q7QM%4s9gD*t$J5R8OEnaH(=tSrAR+_> z&Y(A-u`fEFR=sTTY8YJXm6SBOevwT^x6A6Fj?LpEJaPZbGf{+n(k&`uF^MwjD~?}q zE^dxmeesdzwf{p|LtSFu8@*uZVW(I2DnxNS%5=~fCo7$uF#j0eQf%Vl0*5VC@yv0O zdhRflA&EpgZ8zet-jhr>GT1T%BQ|rC36RgtGKelZesb?VuyBPXRAcWu0jPGV6pn@= zWzGRW0Un#&7{i0YrgL3r1d#3yzg3^}wwC6(v*{=ng|h&G@+tIaK4LuWpOU`|Q;?>q z3;!hzlB0n6`gHirBvLnoojw$^>u6%fWF1BQRNt7cuRl);kSVZ0fHs+nb|)~cs%51a z<~K(wLOQ9&=T(z`Dp=!^{bCowdGiFpaFlz=T-Ym;`%7v0UP)>71lljpN-57h=_kx} zJ9=(&!qG*vJZD1?os1&`^dT=BvELfH*;a?(gfK7vl@J(_#Gk{ zcnqhoKhIj{cafM*ZYu2TcCq(8w&iQnP0L_s9Jsy>4Uz$$TUt=Oj*A-kN&pDkUZyIXfQqo zVfz&&5i1AZO{WE*1uTiTE=4puNbU+_5CPaZ7~+aP1PA{RK8n)?p$2o^+m15-54vClh)S`j-gMoNc@M!e5!IO@e5llXF4_~FmiQ{21O4YC{9@4u?GrkFx z-6e*iO*$?lI^OQ7o54Q!l(kVng_#qk0Y2fa;V3q+a0w(E2#vp<6)+;%0XCjM&rLNs z0RHzV5#dAwW^x;VOM}R4(C&)RJ1%C54pGcZh3*Ac^-!eom@~<$2 zHop<G@U=|4J1y$BLYQt1D! z9BRG6qVHWUJ{4Sz@Q8K&oB73A@!LIZo&31x2&dm=Y!xqWYdsKvN(7Hyuucx8_~J~r zxOmCmRRG0|Dd{YB6wJ)0*!^Jv=*R`rw;JdN;N@UQ>Oh7Q?_oYt=56x%`k>({*uMC^ zAYnJ=Kw*SVOT(22_JWB%_?aQH{-WP9Mlrg99J*1if;HEjV#6|UAU}Fko+=kk7mEJS zDSVL7a4YI1s@l3n`dA^#SpPUSA4V;x*NpocTJPJg>g2ejVa;p8b)i$2Prq}u+C?-4 z&Z=_&X1cO4aH#^_)!NTVt{th|TSpT=y8Bf%gzZ^0^J}&#`!5`GcF#yHv~B>q2163K z=Z5BgKFKZ*%^~r8{BEH8qtb_Ot&^v*dGW$@Gs8G%lBkdL2I^#Qu*CsCfAh+9-uPTl zE(?j$>ymQ!W?8_0LEE+S3#27fMleMy14?{7wMNIGVa+X7Go4q<0krU1kz@pG-B*T2 zxra_EJQB4aH?+6J;02WPmI$EQ3IUUb_t!I|KZ$8RpsE#f>p{ z1@ZHcqInEPC=+94$r&tcxivK-Q?(rctm&NNoL-VTQ6(v96)K5!ILnRSigQSY z$jk2Ep40#0K9V>;ygjSEp2mdYR=+juzLx#nxr5V%y%VToi&5dUCCxr)HHH*n+2FA0 zk&s}9L30BYqU=5X;;QM1q=I*EAb;%mAv**+0lY>a|E_Ks{IvsK3rnqSP4ToF?T^@@ zzTBVum+=EGO4K8ByF#}5y7Sr`5pMJ+(Bmy>C2}opJ*F7*pc>;x6@cs+IlQr)WUVBr11xWH&~k7hCdC+aIITTPaXy zF(*_|ZWf_kgWL2I>*z(BJ7eib69Rhww1-x*FFPvCRb%o;0D_v@aX<2W%t zoaSRyL(8cV@u{Kry}j0y=7u?sv(}K7h9`w(h?GhXDyCoF3;a7hc+o(B)Uf@)!Og1}wG_ypeoQ{jW-)B?@zJtfrGIO9laV z8SAUryRmys&`H~iQZ;D>UoP6C-d0^(K9sDtIHAN4kA^b+-aIX)lmUegDdJ1QYVBW} z9&rQk(lf@{$z8%*r?Zx$6bvjBo?f`Fe)Z+YPW}1&^mxSncD1{9`B~_EsL45O@2p(byu~ z&0Pj-SkMz^6KwPB;6=>VF&WwOrcA&j)9hU3Q(T}vM$qf?E)<87PxoWG^qEU>bbjeL z=SK<(@n2FqoE8TN_~dTa>Z%Tv2+VeFDzsRXY-F?wiLeOadBVRne^qiE3-#?EWL99% z+o3JjYtM(Y0Ubrv(jd^r2JA+?955lab$JdEyf1i(JSMb_eY1v;!UwIU0&8$8`K^m& zLM-{M@(VkzFt)$>e4lUh;|B2F(IW+PQ3Z4i@fT7T{H8`|NZg;2Nq*$k{D8shL8OV{rRk@ZIRRXiSQAi?7ez0mLwS#l! z+SQTM;*(vswPQ0U_c_&?_~h`Bf)GI zRrGklFXH1fk3C4#AorBCyj-uLpirKU)HDS z*X1DiuYY7H<U8#xu(|atg>wyS}QGiCBDc!gP zOYp8C_8=(rnpsCD>+ubLsEM0YAbl6Rk@@2s@Ci+GE$*%`Wxv3_S`%H?P!w|E@R z&|jX}<}9&)pjbFyy7z4+&O*Qd4SgO&jZ6As0Wq`HXc7)H^~~x|jI+V{M&%fp&V(l-}s> z8eyPz3i&>r*)GCT91wMx4Vz^KJ#v!ptgpELhf>SQ?{TuWLM8!y%YC<4s;;F~3fkE^ z1B@U|n+w;*y*VEMJ$TaL-ZvPk$h_{dt!xQ8ZNVHqk+Gn}S!0x*wMhh+g3oLYdU8G) zlksd6n$l`sXpPpe7|Qw08cf}x(Km7CGNB-KMxkf4Wgy6d(@V|=JsyQMx`;8Q#ic;8 zMfLL4Dh5~^Z|e4)2lbCpo9fZ$JL7yBZP_$>C<|RIF-w7jH0)3=pUFT2IGX_I3G0^*?dm*Hv*SiJDacdDb*-ed?^Xt9fDdBbwwW_)Plxo|;SZ z-A{B2PedmuJxS^@Wxo3$w|vv?+R~eg zK2KwEr(W$tY`PDCHq@*2^dYIAd_?;ci!PU|bv`-8_v5wBB!iLNq)!&%%b%RH`iF*W z#+HAkM3H|J!k~fQy_LOi9IKKxzpLq=m?qQdWdMnlRZ;lL-dvgpL>Yv6iE8<>(-YP+ zyiY%Vd=O~=_R*etopbs|AxtO0DAljQPpz;@#*-y(DVY$I$e1^b8Kd^AiV-Dd+HQp3fbBK(8JN@I3W z>ucnMWJ-Edcy^^FI?w6e*AoR}(@rigS{OK$x7qxFl^%i=M+|dat`(ZePViJ5ZB#uW z3`#!fku)#+ylS}t>kXa4k)dv(RDcHAklg)dU?Z2-IlZyMGCp1yT|xh-A*JI9yqu|> zo%ZQhd;a-&^+hh2xJvgR?1+%&5c9}Wc0Xwr${(8zM3AQ zSgO;OcEtk~?Vxx?+)`TN#zu&x{XVS;-aVg{qxrx;?G{Rm?3YFjFp3n3v~krRaa5oK zipQk=9Ny!c5FmgP^`B02Vf<#KZ)kdmB3r(dwIcJ~bU$mK$}B{0uif>7yp3{IXU&q)$!V zczsl)bk@x<(fA|&-$S}NDPnNi=ZTKTwh=oL_Y>N}`zWi-1^l3CsJiW33SIdcSjXcL zL&(vg72^tqBQ2oXPwt~xCz2-MUse5p`>qbx_w|$COBDOChQ0mw^`{afTlEdrY?{Fn zGPJ{C2;eXL>D+!^Y}BB@eEUhgEV{A=`^md099l{=U_yOwh0nbjDOIw74>O}4kO6DJ z>_Yqm$5x!Sj=8T@c1A@3*~i*cH1IBo>_+O^Y-W4K54irPbTjA(xgRUf@uVD;CZt1) zKL9c)k0CEwoY~#@=?@FXQqUaI7}NLRGqHpU1&f?0-b^1h8JTMbUy$9*tACZmu2NEz zNlpX7c-*~qUXG$;0sp7p2WVH|DG3@|Y`1urAD+W)mlG0J_Pz^MwulLKL)K)4kpe?+ zEIC+i31_>{uht~gOq!OnZ`rTQYv+FeSdT7eS%w+VFx?1>Pr|6)pIC1u40H<9xyYcE zxD=$Ol*MtI47fT*xZ3SUix9WY-cWLW>CP+72(qN<#Cnx!d$8rwxEdBPqmwpme{(PG zoMCXP7J<>Q4Hodg*q>g+{P?O0?}4OjJBQ9|oxm8(b-6P)-a7{P{PW9h%{F*Ch$h;_ zEx1zu;HIH}tRfZo$)?p1K{h7u_+G({$(t8;5=>sxJTk(|S=r+4XG z@N5J8r1HZ&4x8@MbV#VbpSF5XbDw`rElwHdeqO&0a)34ro-w&vVH^%qg`s+*J9DoX zYG*|Ri}4TClrHOEYYj&iyo@IwmCjxQ*AEXcb{4+o4@#1KuJ#C@Y7f*vp5hLCNj+Sg zkJw=zyEik9TC7p5*3}{P0X=As4UgrY#K1!6TKmC)tHF$=t^r?wVBfsW=C2` z@r@NE5!@oK8nLKt*-tvzFCS^rCx{#Q%sIhpQm`&{BQJRpo9v-qta<&d{o8m2wmf5l zk#L58A>0oi?h+2Y4xqw|lw{Y#&+jz^f9X*mcsMrXk%X8qW}Y7Nuedf{!6+Rf4#N7!OoC^58OGV^ z5n!3V$__SqmKTy$4j8M@n&}VvZ+53(o>So@TAMj#dAS{N-EsDso+?P`G%`DS2}VTN zjFfG3d$INJxhIQLU`s6hrjwPCo}flB$oiN~!~XHw&(#CdRt)pGW3$acLH`QfBwU0O zk}}_V-_-GxDz}ryi{7nRM*@ZUX~J2GsIzR$hMGUq$LC=Nc|rbI2RyWdI3(?E%Ar-_%A{A0wNBx`5)b*v&`D;u%jV)jS_6NHzrpSvIxdgP$)Bb3;)5 za#vUN0FhPQkNV>=zIp1F^PSOq$>osR&fu>%BJj{ZD2pUIG~dw4h?`+mdyz4MebGEd z(cVt_Rv&p^a=)h-m(?mw^DLo-pg=C!IyCm1do-H(kF8Jdl97$|alVcM1C1mN}V`!udU&-nzxU zZgm>je(Gd2guc1IE*uEdPE^s z`xAz?^aqxt^3|AsP7wUmqi0@p3PB+vOoVIc;k;O(8-s)%?NQioL=pWPF_;T1K2L*!XVxjvY2KbX3RRY?EZM`)QVFuJ58@23u*W-oj>s>lI}#d@6Ek}aWhKlds9{c=X`AHM)?syK|U z2gf6MTD$#MWNraE5|@tjS5EJ(|9-h}Vd?{0viQrx@TiaR6s{rSHUOK0Ub)`{29?I! zJ-NJmf-d^Ph1F16LIgZJxGuDOJ>t+03pJk}6sg76VrRb7tz>C+6=;Nm2!pE(iKA96 z<}qD~ze&$Im9dR+7A|ex03dtp=CfB!0SZd}DLSJZW8SsBt+=5=3;6r? z0Q~9aWmm=@s=HWkY_yY7U+6t=5zbhv+GGk!+)h0x($KmVLxbLE)4t+E0>;EQDM-ULuLJ$Cm_wB#reSROuFB|Z~+2xB3*tT+ZasE$ZyqD1hFQt1A^j+T5 z{}MvI)g>l}q0N9@Iz<_gLFv2wVAz;B40NfN1 zq|Pq?T&DL@?`hV5F3&%;Ky`!DMBqqF!1`U@Ykr6A-+CLo&kJn-N8a - - - - - - - - - - - diff --git a/AdminWebsite/AdminWebsite.UnitTests/Controllers/HearingsController/EditHearingTests.cs b/AdminWebsite/AdminWebsite.UnitTests/Controllers/HearingsController/EditHearingTests.cs index d1234c549..bcb7e63a1 100644 --- a/AdminWebsite/AdminWebsite.UnitTests/Controllers/HearingsController/EditHearingTests.cs +++ b/AdminWebsite/AdminWebsite.UnitTests/Controllers/HearingsController/EditHearingTests.cs @@ -42,12 +42,9 @@ namespace AdminWebsite.UnitTests.Controllers.HearingsController public class EditHearingTests { private EditHearingRequest _addEndpointToHearingRequest; - private EditHearingRequest _addEndpointToHearingRequestWithJudge; private EditHearingRequest _editEndpointOnHearingRequestWithJudge; private EditHearingRequest _removeEndpointOnHearingRequest; private EditHearingRequest _addNewParticipantRequest; - private EditHearingRequest _switchJudgeRequest; - private EditHearingRequest _updateJudgeOtherInformationRequest; private Mock _bookingsApiClient; private AdminWebsite.Controllers.HearingsController _controller; @@ -220,37 +217,6 @@ public void Setup() } }; - _addEndpointToHearingRequestWithJudge = new EditHearingRequest - { - Case = new EditCaseRequest { Name = "Case", Number = "123" }, - Participants = new List() - { - new EditParticipantRequest() { - Id = participantId1, - CaseRoleName = "judge", - HearingRoleName = HearingRoleName.Judge, - FirstName = "FirstName", - LastName = "LastName", - ContactEmail = "judge@domain.com", - DisplayName = "FirstName LastName", - LinkedParticipants = new List(), - OrganisationName = "Org1", - Representee = "Rep1", - TelephoneNumber = "+44 123 1234", - Title = "Mr", - MiddleNames = "MiddleNames" - } - }, - Endpoints = new List - { - new EditEndpointRequest { Id = null, DisplayName = "New Endpoint", DefenceAdvocateContactEmail = "username@domain.net" }, - new EditEndpointRequest { Id = endpointGuid1, DisplayName = "data1", DefenceAdvocateContactEmail = defenceAdvocate1 }, - new EditEndpointRequest { Id = endpointGuid2, DisplayName = "data2", DefenceAdvocateContactEmail = defenceAdvocate2 }, - new EditEndpointRequest { Id = endpointGuid3, DisplayName = "data3", DefenceAdvocateContactEmail = defenceAdvocate3 }, - new EditEndpointRequest { Id = endpointGuid4, DisplayName = "data4", DefenceAdvocateContactEmail = defenceAdvocate4 } - } - }; - _editEndpointOnHearingRequestWithJudge = new EditHearingRequest { Case = new EditCaseRequest @@ -343,43 +309,6 @@ public void Setup() CaseTypeName = "Unit Test", ScheduledDateTime = DateTime.UtcNow.AddHours(3) }; - - _switchJudgeRequest = new EditHearingRequest - { - Case = new EditCaseRequest - { - Name = "Case", - Number = "123" - }, - Participants = new List - { - new EditParticipantRequest - { - ContactEmail = "new@domain.net", - FirstName = "Test_FirstName", - LastName = "Test_LastName", - HearingRoleName = HearingRoleName.Judge - } - } - }; - - _updateJudgeOtherInformationRequest = new EditHearingRequest - { - Case = new EditCaseRequest - { - Name = "Case", - Number = "123" - }, - Participants = new List - { - new EditParticipantRequest - { - Id = participantId1, CaseRoleName = "judge", HearingRoleName = HearingRoleName.Judge, - ContactEmail = "judge.user@email.com", FirstName = "Judge" - } - }, - OtherInformation = new OtherInformationDetails { JudgeEmail = "judge@gmail.com", JudgePhone = "0845"}.ToOtherInformationString() // "|JudgeEmail|judge@gmail.com|JudgePhone|0845" - }; _bookingsApiClient.Setup(x => x.GetHearingDetailsByIdAsync(It.IsAny())) .ReturnsAsync(_updatedExistingParticipantHearingOriginal); @@ -442,10 +371,16 @@ public void Setup() public async Task Should_return_bad_request_if_invalid_hearing_id() { var invalidId = Guid.Empty; + var key = "hearingId"; + var errorMessage = "Please provide a valid hearingId"; var result = await _controller.EditHearing(invalidId, _addNewParticipantRequest); - var badRequestResult = (BadRequestObjectResult)result.Result; - var errors = (SerializableError)badRequestResult.Value; - errors["hearingId"].Should().BeEquivalentTo(new[] { "Please provide a valid hearingId" }); + + result.Result.Should().NotBeNull(); + var objectResult = (ObjectResult)result.Result; + var validationProblems = (ValidationProblemDetails)objectResult.Value; + validationProblems.Should().NotBeNull(); + validationProblems!.Errors.ContainsKey(key).Should().BeTrue(); + validationProblems.Errors[key][0].Should().Be(errorMessage); } [Test] @@ -460,9 +395,11 @@ public async Task Should_return_bad_request_if_case_is_not_given() _addNewParticipantRequest.Case = null; var result = await _controller.EditHearing(_validId, _addNewParticipantRequest); - var badRequestResult = (BadRequestObjectResult)result.Result; - var errors = (SerializableError)badRequestResult.Value; - errors["case"].Should().BeEquivalentTo(new[] { "Please provide valid case details" }); + var objectResult = (ObjectResult)result.Result; + var validationProblems = (ValidationProblemDetails)objectResult.Value; + + var errors = validationProblems.Errors; + errors["case"].Should().BeEquivalentTo("Please provide valid case details"); } [Test] @@ -476,132 +413,13 @@ public async Task Should_return_bad_request_if_no_participants_are_given() _addNewParticipantRequest.Participants.Clear(); var result = await _controller.EditHearing(_validId, _addNewParticipantRequest); - var badRequestResult = (BadRequestObjectResult)result.Result; - var errors = (SerializableError)badRequestResult.Value; - errors["participants"].Should().BeEquivalentTo(new[] { "Please provide at least one participant" }); - } - - [Test] - public async Task - Should_return_bad_request_if_edit_confirmed_hearing_except_only_adding_participant_prior_30_minutes_of_it_starting() - { - _updatedExistingParticipantHearingOriginal.ScheduledDateTime = DateTime.UtcNow.AddHours(-1); - _updatedExistingParticipantHearingOriginal.Status = BookingStatus.Created; - _bookingsApiClient.SetupSequence(x => x.GetHearingDetailsByIdAsync(It.IsAny())) - .ReturnsAsync(_updatedExistingParticipantHearingOriginal); - var result = await _controller.EditHearing(_validId, _addNewParticipantRequest); - var badRequestResult = (BadRequestObjectResult)result.Result; - var errors = (SerializableError)badRequestResult.Value; - errors["hearingId"] - .Should() - .BeEquivalentTo(new[] - { - $"You can't edit a confirmed hearing [{_updatedExistingParticipantHearingOriginal.Id}] within 30 minutes of it starting" - }); - } - - [Test] - public async Task Should_allow_switching_judge_prior_30_minutes_of_hearing_starting() - { - _existingHearingWithJudge.ScheduledDateTime = DateTime.UtcNow.AddMinutes(20); - _existingHearingWithJudge.Status = BookingStatus.Created; - _bookingsApiClient.SetupSequence(x => x.GetHearingDetailsByIdAsync(It.IsAny())) - .ReturnsAsync(_existingHearingWithJudge) - .ReturnsAsync(_existingHearingWithJudge); - var result = await _controller.EditHearing(_validId, _switchJudgeRequest); - - ((ObjectResult)result.Result).StatusCode.Should().Be(200); - _bookingsApiClient.Verify( - x => x.UpdateHearingParticipantsAsync(It.IsAny(), It.IsAny()), - Times.Once); - _bookingsApiClient.Verify(x => x.UpdateHearingDetailsAsync(It.IsAny(), - It.Is(u => - !u.Cases.IsNullOrEmpty())), - Times.Once); - } - - [Test] - public async Task Should_allow_updating_judge_other_information_prior_30_minutes_of_hearing_starting() - { - _existingHearingWithJudge.ScheduledDateTime = DateTime.UtcNow.AddMinutes(20); - _existingHearingWithJudge.Status = BookingStatus.Created; - _bookingsApiClient.SetupSequence(x => x.GetHearingDetailsByIdAsync(It.IsAny())) - .ReturnsAsync(_existingHearingWithJudge) - .ReturnsAsync(_existingHearingWithJudge); - var result = await _controller.EditHearing(_validId, _updateJudgeOtherInformationRequest); + var objectResult = (ObjectResult)result.Result; + var validationProblems = (ValidationProblemDetails)objectResult.Value; - ((ObjectResult)result.Result).StatusCode.Should().Be(200); - _bookingsApiClient.Verify(x => x.UpdateHearingParticipantsAsync(It.IsAny(), - It.IsAny()), Times.Once); - _bookingsApiClient.Verify(x => x.UpdateHearingDetailsAsync(It.IsAny(), - It.Is(u => !u.Cases.IsNullOrEmpty())), Times.Once); + var errors = validationProblems.Errors; + errors["participants"].Should().Contain( "Please provide at least one participant"); } - - [Test] - public async Task Should_allow_edit_confirmed_hearing_up_until_30_minutes_before_starting() - { - _updatedExistingParticipantHearingOriginal.ScheduledDateTime = DateTime.UtcNow.AddHours(1); - _addNewParticipantRequest.ScheduledDateTime = _updatedExistingParticipantHearingOriginal.ScheduledDateTime; - _updatedExistingParticipantHearingOriginal.Status = BookingStatus.Booked; - _bookingsApiClient.SetupSequence(x => x.GetHearingDetailsByIdAsync(It.IsAny())) - .ReturnsAsync(_updatedExistingParticipantHearingOriginal) - .ReturnsAsync(_updatedExistingParticipantHearingOriginal) - .ReturnsAsync(_updatedExistingParticipantHearingOriginal); - - var result = await _controller.EditHearing(_validId, _addNewParticipantRequest); - - ((OkObjectResult)result.Result).StatusCode.Should().Be(200); - _bookingsApiClient.Verify( - x - => x.UpdateHearingParticipantsAsync(It.IsAny(), - It.IsAny()), Times.Once); - _bookingsApiClient.Verify(x => x.UpdateHearingDetailsAsync(It.IsAny(), - It.Is(u => !u.Cases.IsNullOrEmpty())), Times.Once); - } - - [Test] - public async Task Should_allow_only_participant_changes_if_hearing_starts_in_less_than_thirty_minutes() - { - _updatedExistingParticipantHearingOriginal.ScheduledDateTime = DateTime.UtcNow.AddHours(-1); - _addNewParticipantRequest = new EditHearingRequest - { - HearingRoomName = _updatedExistingParticipantHearingOriginal.HearingRoomName, - HearingVenueName = _updatedExistingParticipantHearingOriginal.HearingVenueName, - OtherInformation = _updatedExistingParticipantHearingOriginal.OtherInformation, - ScheduledDateTime = _updatedExistingParticipantHearingOriginal.ScheduledDateTime, - ScheduledDuration = _updatedExistingParticipantHearingOriginal.ScheduledDuration, - AudioRecordingRequired = _updatedExistingParticipantHearingOriginal.AudioRecordingRequired, - Case = new EditCaseRequest - { - Name = _updatedExistingParticipantHearingOriginal.Cases[0].Name, - Number = _updatedExistingParticipantHearingOriginal.Cases[0].Number, - }, - Participants = _updatedExistingParticipantHearingOriginal.Participants.Select(EditParticipantRequestMapper.MapFrom).ToList() - }; - - _addNewParticipantRequest.Participants.Add(new EditParticipantRequest - { - ContactEmail = "new2@domain.net", - FirstName = "Test2_FirstName", - LastName = "Test2_LastName" - }); - _bookingsApiClient.SetupSequence(x => x.GetHearingDetailsByIdAsync(It.IsAny())) - .ReturnsAsync(_updatedExistingParticipantHearingOriginal) - .ReturnsAsync(_updatedExistingParticipantHearingOriginal) - .ReturnsAsync(_updatedExistingParticipantHearingOriginal); - - var result = await _controller.EditHearing(_validId, _addNewParticipantRequest); - - ((OkObjectResult)result.Result).StatusCode.Should().Be(200); - _bookingsApiClient.Verify( - x => x.UpdateHearingParticipantsAsync(It.IsAny(), It.IsAny()), - Times.Once); - _bookingsApiClient.Verify(x => x.UpdateHearingDetailsAsync(It.IsAny(), - It.Is(u => - !u.Cases.IsNullOrEmpty())), - Times.Once); - } - + [Test] public async Task Should_return_not_found_if_hearing_is_missing() { @@ -630,8 +448,13 @@ public async Task Should_return_bad_request_if_editing_hearing_fails_with_bad_re _bookingsApiClient.Setup(x => x.GetHearingDetailsByIdAsync(It.IsAny())) .ReturnsAsync(_existingHearingWithLinkedParticipants); + var validationProblemDetails = new ValidationProblemDetails(new Dictionary + { + {"Hearing", new[] {"Cannot remove a participant from hearing that is close to start time"}}, + }); + _bookingsApiClient.Setup(x => x.UpdateHearingParticipantsAsync(It.IsAny(), It.IsAny())) - .Throws(ClientException.ForBookingsAPI(HttpStatusCode.BadRequest)); + .Throws(ClientException.ForBookingsAPIValidation(validationProblemDetails)); //Act var response = await _controller.EditHearing(_validId, _addNewParticipantRequest); @@ -801,7 +624,14 @@ public async Task Should_return_updated_hearingV2() [Test] public async Task Should_pass_on_bad_request_from_bookings_api() { - GivenApiThrowsExceptionOnUpdate(HttpStatusCode.BadRequest); + var validationProblemDetails = new ValidationProblemDetails(new Dictionary + { + {"Hearing", new[] {"Cannot remove a participant from hearing that is close to start time"}}, + }); + + _bookingsApiClient.Setup(x => + x.UpdateHearingDetailsAsync(It.IsAny(), It.IsAny())) + .ThrowsAsync(ClientException.ForBookingsAPIValidation(validationProblemDetails)); var response = await _controller.EditHearing(_validId, _addNewParticipantRequest); response.Result.Should().BeOfType(); @@ -907,32 +737,6 @@ public async Task Should_add_endpoint_if_new_endpoint_is_added_to_endpoint_list( x => x.RemoveEndPointFromHearingAsync(It.IsAny(), It.IsAny()), Times.Never); } - [Test] - public async Task Should_add_endpoint_if_new_endpoint_is_added_to_endpoint_list_prior_30_minutes_of_hearing_starting() - { - _existingHearingWithEndpointsOriginal.ScheduledDateTime = DateTime.UtcNow.AddMinutes(20); - _existingHearingWithEndpointsOriginal.Status = BookingStatus.Created; - - _bookingsApiClient.Setup(x => x.GetHearingDetailsByIdAsync(It.IsAny())) - .ReturnsAsync(_existingHearingWithEndpointsOriginal); - - var result = await _controller.EditHearing(_validId, _addEndpointToHearingRequestWithJudge); - - ((OkObjectResult)result.Result).StatusCode.Should().Be(200); - - _bookingsApiClient.Verify( - x => x.AddEndPointToHearingAsync(It.IsAny(), It.IsAny()), Times.Once); - - _bookingsApiClient.Verify(x => x.UpdateHearingDetailsAsync(It.IsAny(), - It.Is(u => - !u.Cases.IsNullOrEmpty())), Times.Once); - - _bookingsApiClient.Verify(x => x.UpdateDisplayNameForEndpointAsync( - It.IsAny(), It.IsAny(), It.IsAny()), Times.Never); - - _bookingsApiClient.Verify(x => x.RemoveEndPointFromHearingAsync(It.IsAny(), It.IsAny()), Times.Never); - } - [Test] public async Task Should_update_endpoint_if_an_endpoint_is_updates_in_endpoint_list() { @@ -952,34 +756,6 @@ public async Task Should_update_endpoint_if_an_endpoint_is_updates_in_endpoint_l } - [Test] - public async Task Should_update_endpoint_if_an_endpoint_is_updates_in_endpoint_list_prior_30_minutes_of_hearing_starting() - { - _existingHearingWithEndpointsOriginal.ScheduledDateTime = DateTime.UtcNow.AddMinutes(20); - _existingHearingWithEndpointsOriginal.Status = BookingStatus.Created; - - _bookingsApiClient.Setup(x => x.GetHearingDetailsByIdAsync(It.IsAny())) - .ReturnsAsync(_existingHearingWithEndpointsOriginal); - - var result = await _controller.EditHearing(_validId, _editEndpointOnHearingRequestWithJudge); - - ((OkObjectResult)result.Result).StatusCode.Should().Be(200); - - _bookingsApiClient.Verify( - x => x.AddEndPointToHearingAsync(It.IsAny(), It.IsAny()), Times.Never); - - _bookingsApiClient.Verify(x => x.UpdateHearingDetailsAsync(It.IsAny(), - It.Is(u => - !u.Cases.IsNullOrEmpty())), Times.Once); - - _bookingsApiClient.Verify( - x => x.UpdateDisplayNameForEndpointAsync(It.IsAny(), It.IsAny(), - It.IsAny()), Times.Exactly(1)); - - _bookingsApiClient.Verify( - x => x.RemoveEndPointFromHearingAsync(It.IsAny(), It.IsAny()), Times.Never); - } - [Test] public async Task Should_remove_endpoint_if_endpoint_is_removed_from_the_endpoint_list() { @@ -1284,7 +1060,6 @@ public async Task Should_add_a_new_participant_and_link_to_existing_interpreter_ _bookingsApiClient.Verify(x => x.UpdateHearingDetailsAsync(It.IsAny(), It.Is(u => !u.Cases.IsNullOrEmpty())), Times.Once); } - [Test] public async Task Should_create_a_new_judge_and_set_username_to_contact_email() @@ -1503,25 +1278,6 @@ public async Task ((OkObjectResult)result.Result).StatusCode.Should().Be(200); } - [Test] - public async Task Should_not_be_able_to_remove_judge_from_confirmed_hearing() - { - // arrange - var hearingId = _updatedExistingParticipantHearingOriginal.Id; - var updatedHearing = _updatedExistingParticipantHearingOriginal.Duplicate(); - updatedHearing.Status = BookingStatus.Created; - _bookingsApiClient.SetupSequence(x => x.GetHearingDetailsByIdAsync(hearingId)) - .ReturnsAsync(updatedHearing); - _bookingsApiClient.Setup(x => x.GetHearingsByGroupIdAsync(updatedHearing.GroupId.Value)) - .ReturnsAsync(new List { updatedHearing }); - - // act - var result = await _controller.EditHearing(hearingId, It.IsAny()); - - // assert - result.Result.Should().BeOfType(); - } - [Test] public async Task Should_handle_failed_booking_request_on_retry() { @@ -1569,11 +1325,5 @@ private EditHearingRequest FailedHearingRequest() }; } - private void GivenApiThrowsExceptionOnUpdate(HttpStatusCode code) - { - _bookingsApiClient.Setup(x => - x.UpdateHearingDetailsAsync(It.IsAny(), It.IsAny())) - .ThrowsAsync(ClientException.ForBookingsAPI(code)); - } } } \ No newline at end of file diff --git a/AdminWebsite/AdminWebsite.UnitTests/Helper/ClientException.cs b/AdminWebsite/AdminWebsite.UnitTests/Helper/ClientException.cs index 4b4712f8f..38d93c2e4 100644 --- a/AdminWebsite/AdminWebsite.UnitTests/Helper/ClientException.cs +++ b/AdminWebsite/AdminWebsite.UnitTests/Helper/ClientException.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Net; using BookingsApi.Client; +using Microsoft.AspNetCore.Mvc; using UserApi.Client; namespace AdminWebsite.UnitTests.Helper @@ -21,6 +22,13 @@ public static BookingsApiException ForBookingsAPI(HttpStatusCode statusCode) null ); } + + public static BookingsApiException ForBookingsAPIValidation(ValidationProblemDetails validationProblemDetails) + { + return new BookingsApiException("BadRequest", + (int) HttpStatusCode.BadRequest, + "There were errors", null, validationProblemDetails, null); + } public static Exception ForUserService(HttpStatusCode statusCode) { diff --git a/AdminWebsite/AdminWebsite.UnitTests/Services/HearingServiceTests.cs b/AdminWebsite/AdminWebsite.UnitTests/Services/HearingServiceTests.cs index 17f589d42..73dc24b15 100644 --- a/AdminWebsite/AdminWebsite.UnitTests/Services/HearingServiceTests.cs +++ b/AdminWebsite/AdminWebsite.UnitTests/Services/HearingServiceTests.cs @@ -31,12 +31,7 @@ public class HearingServiceTests private HearingDetailsResponse _hearing; private const string ExpectedTeleConferencePhoneNumber = "expected_conference_phone_number"; private const string ExpectedTeleConferenceId = "expected_conference_phone_id"; - - private HearingDetailsResponse _updatedExistingParticipantHearingOriginal; - private Guid _validId; - private EditHearingRequest _editHearingRequest; - List _cases; - + [SetUp] public void Setup() { @@ -69,146 +64,6 @@ public void Setup() .Setup(x => x.BookAndConfirmToggle()).Returns(true); _service = _mocker.Create(); _hearing = InitHearing(); - _validId = Guid.NewGuid(); - - _cases = new List { new CaseResponse { Name = "Case", Number = "123" } }; - - _updatedExistingParticipantHearingOriginal = new HearingDetailsResponse - { - Id = _validId, - GroupId = _validId, - Participants = - new List - { - new ParticipantResponse - { - Id = Guid.NewGuid(), - UserRoleName = "Individual", - ContactEmail = "old@hmcts.net", - Username = "old@hmcts.net" - } - }, - Cases = _cases, - CaseTypeName = "Unit Test", - ScheduledDateTime = DateTime.UtcNow.AddHours(3), - Endpoints = new List - { - new EndpointResponse - { - Id = Guid.NewGuid(), DisplayName = "test", DefenceAdvocateId = Guid.NewGuid(), - } - } - }; - - _editHearingRequest = new EditHearingRequest - { - HearingRoomName = _updatedExistingParticipantHearingOriginal.HearingRoomName, - HearingVenueName = _updatedExistingParticipantHearingOriginal.HearingVenueName, - OtherInformation = _updatedExistingParticipantHearingOriginal.OtherInformation, - ScheduledDateTime = _updatedExistingParticipantHearingOriginal.ScheduledDateTime, - ScheduledDuration = _updatedExistingParticipantHearingOriginal.ScheduledDuration, - AudioRecordingRequired = _updatedExistingParticipantHearingOriginal.AudioRecordingRequired, - Case = new EditCaseRequest - { - Name = _updatedExistingParticipantHearingOriginal.Cases.First().Name, - Number = _updatedExistingParticipantHearingOriginal.Cases.First().Number, - }, - Endpoints = _updatedExistingParticipantHearingOriginal.Endpoints - .Select(EditEndpointRequestMapper.MapFrom) - .ToList(), - Participants = _updatedExistingParticipantHearingOriginal.Participants - .Select(EditParticipantRequestMapper.MapFrom) - .ToList() - }; - } - - [Test] - public void Should_return_false_if_HearingRoomName_is_not_changed() - { - _editHearingRequest.HearingRoomName = "Updated HearingRoomName"; - _editHearingRequest.Participants.Add(new EditParticipantRequest { Id = Guid.NewGuid() }); - Assert.False(_service.IsAddingParticipantOnly(_editHearingRequest, _updatedExistingParticipantHearingOriginal.Map())); - } - - [Test] - public void Should_return_false_if_HearingVenueName_is_changed() - { - _editHearingRequest.HearingRoomName = "Updated HearingVenueName"; - _editHearingRequest.Participants.Add(new EditParticipantRequest { Id = Guid.NewGuid() }); - Assert.False(_service.IsAddingParticipantOnly(_editHearingRequest, _updatedExistingParticipantHearingOriginal.Map())); - } - - [Test] - public void Should_return_false_if_OtherInformation_is_changed() - { - _editHearingRequest.OtherInformation = "Updated OtherInformation"; - _editHearingRequest.Participants.Add(new EditParticipantRequest { Id = Guid.NewGuid() }); - Assert.False(_service.IsAddingParticipantOnly(_editHearingRequest, _updatedExistingParticipantHearingOriginal.Map())); - } - - [Test] - public void Should_return_false_if_ScheduledDuration_is_changed() - { - _editHearingRequest.ScheduledDuration = - _updatedExistingParticipantHearingOriginal.ScheduledDuration + 1; - _editHearingRequest.Participants.Add(new EditParticipantRequest { Id = Guid.NewGuid() }); - Assert.False(_service.IsAddingParticipantOnly(_editHearingRequest, _updatedExistingParticipantHearingOriginal.Map())); - } - - [Test] - public void Should_return_true_when_endpoint_count_is_changed() - { - _editHearingRequest.Endpoints.Add(new EditEndpointRequest - { - Id = Guid.NewGuid(), - DisplayName = "test", - DefenceAdvocateContactEmail = Guid.NewGuid().ToString(), - }); - _editHearingRequest.Participants.Add(new EditParticipantRequest { Id = Guid.NewGuid() }); - - Assert.True(_service.HasEndpointsBeenChanged(_editHearingRequest, _updatedExistingParticipantHearingOriginal.Map())); - } - - [Test] - public void Should_return_true_when_endpoint_displayName_is_changed() - { - _editHearingRequest.Endpoints.First().DisplayName = "test1"; - Assert.True(_service.HasEndpointsBeenChanged(_editHearingRequest, _updatedExistingParticipantHearingOriginal.Map())); - } - - [Test] - public void Should_return_true_when_endpoint_removed() - { - _updatedExistingParticipantHearingOriginal.Endpoints.Add(new EndpointResponse - { - Id = Guid.NewGuid(), - DisplayName = "test", - DefenceAdvocateId = Guid.NewGuid(), - }); - _editHearingRequest.Participants.Add(new EditParticipantRequest { Id = Guid.NewGuid() }); - - Assert.True(_service.HasEndpointsBeenChanged(_editHearingRequest, _updatedExistingParticipantHearingOriginal.Map())); - } - - [Test] - public void Should_return_true_when_endpoint_defenceAdvocateUsername_is_changed() - { - _updatedExistingParticipantHearingOriginal.Endpoints.First().DefenceAdvocateId = Guid.NewGuid(); - Assert.True(_service.HasEndpointsBeenChanged(_editHearingRequest, _updatedExistingParticipantHearingOriginal.Map())); - } - - [Test] - public void Should_return_false_when_participant_removed() - { - _updatedExistingParticipantHearingOriginal.Participants.Add(new ParticipantResponse { Id = Guid.NewGuid() }); - Assert.False(_service.IsAddingParticipantOnly(_editHearingRequest, _updatedExistingParticipantHearingOriginal.Map())); - } - - [Test] - public void Should_return_true_when_participant_added() - { - _editHearingRequest.Participants.Add(new EditParticipantRequest { Id = Guid.NewGuid() }); - Assert.True(_service.IsAddingParticipantOnly(_editHearingRequest, _updatedExistingParticipantHearingOriginal.Map())); } [Test] @@ -250,50 +105,7 @@ public void Should_have_one_added_participant() Assert.AreEqual(1, _service.GetAddedParticipant(originalParticipants, editParticipantRequest).Count); } - - [Test] - public void Should_return_false_if_participant_displayName_changed() - { - _editHearingRequest.Participants.First().DisplayName = "DisplayName changed"; - Assert.False(_service.IsAddingParticipantOnly(_editHearingRequest, _updatedExistingParticipantHearingOriginal.Map())); - } - - [Test] - public void Should_return_false_if_participant_lastName_changed() - { - _editHearingRequest.Participants.First().LastName = "LastName changed"; - Assert.False(_service.IsAddingParticipantOnly(_editHearingRequest, _updatedExistingParticipantHearingOriginal.Map())); - } - - [Test] - public void Should_return_throws_InvalidOperationException() - { - _updatedExistingParticipantHearingOriginal.Cases = new List(); - Assert.Throws(() => _service.IsAddingParticipantOnly(_editHearingRequest, _updatedExistingParticipantHearingOriginal.Map())); - } - - [Test] - public void Should_return_false_if_case_name_is_different() - { - _editHearingRequest.Case.Name = "Updated Case Name"; - Assert.False(_service.IsAddingParticipantOnly(_editHearingRequest, _updatedExistingParticipantHearingOriginal.Map())); - } - - [Test] - public void Should_return_false_if_case_number_is_different() - { - _editHearingRequest.Case.Number = "Updated Number"; - Assert.False(_service.IsAddingParticipantOnly(_editHearingRequest, _updatedExistingParticipantHearingOriginal.Map())); - } - - [Test] - public void Should_return_false_if_ScheduledDateTime_is_different() - { - _editHearingRequest.ScheduledDateTime = DateTime.Now; - - Assert.False(_service.IsAddingParticipantOnly(_editHearingRequest, _updatedExistingParticipantHearingOriginal.Map())); - } - + [Test] public async Task Should_process_participants() { @@ -461,90 +273,6 @@ public async Task Should_process_non_joh_participant() newParticipant.Should().NotBeNull(); newParticipant.Username.Should().NotBe(participant.ContactEmail); } - - [TestCase(false)] - [TestCase(true)] - public void IsUpdatingJudge_Should_return_correct_assertion(bool shouldUpdateJudge) - { - // Arrange - var editHearing = _editHearingRequest; - editHearing.Participants.Add(new EditParticipantRequest - { - ContactEmail = "Judge@court.com", - HearingRoleName = "Judge" - }); - var hearing = InitHearing(); - if(shouldUpdateJudge) - hearing.Participants - .First(x => x.UserRoleName == "Judge") - .ContactEmail = "Different.Judge@court.com"; - //Act - var response = _service.IsUpdatingJudge(editHearing, hearing.Map()); - //Assert - response.Should().Be(shouldUpdateJudge); - } - - [TestCase(false)] - [TestCase(true)] - public void IsUpdatingJudge_should_be_correct_when_comparing_optional_contact_details(bool shouldUpdateJudge) - { - // Arrange - var editHearing = _editHearingRequest; - editHearing.Participants.Add(new EditParticipantRequest - { - ContactEmail = "Judge@court.com", - HearingRoleName = "Judge" - }); - editHearing.OtherInformation = "JudgePhone|loremIpsum"; - var hearing = InitHearing(); - hearing.OtherInformation = "JudgePhone|loremIpsum"; - if(shouldUpdateJudge) - hearing.OtherInformation = "JudgePhone|loremIpsum2"; - //Act - var response = _service.IsUpdatingJudge(editHearing, hearing.Map()); - //Assert - response.Should().Be(shouldUpdateJudge); - } - - [Test] - public void IsUpdatingJudge_should_be_false_when_judge_isempty() - { - // Arrange - var editHearing = _editHearingRequest; - editHearing.Participants.Add(new EditParticipantRequest - { - ContactEmail = "Judge@court.com", - HearingRoleName = "xyz" - }); - editHearing.OtherInformation = "JudgePhone|loremIpsum"; - var hearing = InitHearing(); - hearing.Participants.Remove(hearing.Participants.Single(x => x.HearingRoleName == "Judge")); - hearing.OtherInformation = "JudgePhone|loremIpsum"; - //Act - var response = _service.IsUpdatingJudge(editHearing, hearing.Map()); - //Assert - response.Should().Be(false); - } - - [Test] - public void IsUpdatingJudge_should_be_false_when_other_info_empty() - { - // Arrange - var editHearing = _editHearingRequest; - editHearing.Participants.Add(new EditParticipantRequest - { - ContactEmail = "Judge@court.com", - HearingRoleName = "xyz" - }); - editHearing.OtherInformation = string.Empty; - var hearing = InitHearing(); - hearing.Participants.Remove(hearing.Participants.Single(x => x.HearingRoleName == "Judge")); - hearing.OtherInformation = string.Empty; - //Act - var response = _service.IsUpdatingJudge(editHearing, hearing.Map()); - //Assert - response.Should().Be(false); - } private HearingDetailsResponse InitHearing() { diff --git a/AdminWebsite/AdminWebsite.sln b/AdminWebsite/AdminWebsite.sln index 51c95969e..9392a7503 100644 --- a/AdminWebsite/AdminWebsite.sln +++ b/AdminWebsite/AdminWebsite.sln @@ -19,8 +19,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution", "Solution", "{36 ..\README.md = ..\README.md EndProjectSection EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AdminWebsite.AcceptanceTests", "AdminWebsite.AcceptanceTests\AdminWebsite.AcceptanceTests.csproj", "{B0F83938-CBCF-4059-9B42-8961B4D075A1}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AdminWebsite.Testing.Common", "AdminWebsite.Testing.Common\AdminWebsite.Testing.Common.csproj", "{44DA56ED-92B9-4A84-8B13-7B8B66A7717E}" EndProject Global @@ -41,10 +39,6 @@ Global {F1B76C25-C9A2-4A2E-B946-514C44ECF4CD}.Debug|Any CPU.Build.0 = Debug|Any CPU {F1B76C25-C9A2-4A2E-B946-514C44ECF4CD}.Release|Any CPU.ActiveCfg = Release|Any CPU {F1B76C25-C9A2-4A2E-B946-514C44ECF4CD}.Release|Any CPU.Build.0 = Release|Any CPU - {B0F83938-CBCF-4059-9B42-8961B4D075A1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {B0F83938-CBCF-4059-9B42-8961B4D075A1}.Debug|Any CPU.Build.0 = Debug|Any CPU - {B0F83938-CBCF-4059-9B42-8961B4D075A1}.Release|Any CPU.ActiveCfg = Release|Any CPU - {B0F83938-CBCF-4059-9B42-8961B4D075A1}.Release|Any CPU.Build.0 = Release|Any CPU {44DA56ED-92B9-4A84-8B13-7B8B66A7717E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {44DA56ED-92B9-4A84-8B13-7B8B66A7717E}.Debug|Any CPU.Build.0 = Debug|Any CPU {44DA56ED-92B9-4A84-8B13-7B8B66A7717E}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -56,7 +50,6 @@ Global GlobalSection(NestedProjects) = preSolution {938CA652-20EC-413A-8D82-7318DBAAB771} = {B1E4EC16-6651-4638-A259-206EECE90BFE} {F1B76C25-C9A2-4A2E-B946-514C44ECF4CD} = {B1E4EC16-6651-4638-A259-206EECE90BFE} - {B0F83938-CBCF-4059-9B42-8961B4D075A1} = {B1E4EC16-6651-4638-A259-206EECE90BFE} {44DA56ED-92B9-4A84-8B13-7B8B66A7717E} = {B1E4EC16-6651-4638-A259-206EECE90BFE} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution diff --git a/AdminWebsite/AdminWebsite/ClientApp/src/app/booking/summary/summary.component.html b/AdminWebsite/AdminWebsite/ClientApp/src/app/booking/summary/summary.component.html index 68399ecba..4497c0a22 100644 --- a/AdminWebsite/AdminWebsite/ClientApp/src/app/booking/summary/summary.component.html +++ b/AdminWebsite/AdminWebsite/ClientApp/src/app/booking/summary/summary.component.html @@ -153,7 +153,8 @@

- + +
{ const existingRequest = initBadHearingRequest(); videoHearingsServiceSpy.getCurrentRequest.and.returnValue(existingRequest); videoHearingsServiceSpy.getHearingTypes.and.returnValue(of(MockValues.HearingTypesList)); - videoHearingsServiceSpy.saveHearing.and.throwError('Fake error'); + + const validationProblem = new ValidationProblemDetails({ + errors: { + FirstName: ['First name is required'], + LastName: ['Last Name is required'], + ContactEmail: ['Contact Email is required'] + }, + type: 'https://tools.ietf.org/html/rfc7231#section-6.5.1', + title: 'One or more validation errors occurred.', + status: 400 + }); + + videoHearingsServiceSpy.saveHearing.and.throwError( + new BookHearingException('Bad Request', 400, 'One or more validation errors occurred.', null, validationProblem) + ); TestBed.configureTestingModule({ providers: [ diff --git a/AdminWebsite/AdminWebsite/ClientApp/src/app/booking/summary/summary.component.ts b/AdminWebsite/AdminWebsite/ClientApp/src/app/booking/summary/summary.component.ts index 2fc4bea99..f5837ff57 100644 --- a/AdminWebsite/AdminWebsite/ClientApp/src/app/booking/summary/summary.component.ts +++ b/AdminWebsite/AdminWebsite/ClientApp/src/app/booking/summary/summary.component.ts @@ -10,7 +10,13 @@ import { FormatShortDuration } from '../../common/formatters/format-short-durati import { HearingModel } from '../../common/model/hearing.model'; import { RemovePopupComponent } from '../../popups/remove-popup/remove-popup.component'; import { BookingService } from '../../services/booking.service'; -import { BookHearingException, BookingStatus, HearingDetailsResponse, MultiHearingRequest } from '../../services/clients/api-client'; +import { + BookHearingException, + BookingStatus, + HearingDetailsResponse, + MultiHearingRequest, + ValidationProblemDetails +} from '../../services/clients/api-client'; import { Logger } from '../../services/logger'; import { RecordingGuardService } from '../../services/recording-guard.service'; import { VideoHearingsService } from '../../services/video-hearings.service'; @@ -67,6 +73,7 @@ export class SummaryComponent implements OnInit, OnDestroy { @ViewChild(RemoveInterpreterPopupComponent) removeInterpreterPopupComponent: RemoveInterpreterPopupComponent; judgeAssigned: boolean; ejudFeatureFlag = false; + saveFailedMessages: string[]; constructor( private hearingService: VideoHearingsService, @@ -346,6 +353,7 @@ export class SummaryComponent implements OnInit, OnDestroy { } updateHearing() { + this.saveFailedMessages = null; this.$subscriptions.push( this.hearingService.updateHearing(this.hearing).subscribe({ next: (hearingDetailsResponse: HearingDetailsResponse) => { @@ -375,12 +383,25 @@ export class SummaryComponent implements OnInit, OnDestroy { } private setError(error: BookHearingException | Error) { + if (BookHearingException.isBookHearingException(error) && error.result instanceof ValidationProblemDetails) { + this.handleValidationProblem(error.result); + } this.showWaitSaving = false; this.showErrorSaving = true; } + private handleValidationProblem(validationErrors: ValidationProblemDetails) { + this.saveFailedMessages = []; + Object.keys(validationErrors.errors).forEach(key => { + const messages = validationErrors.errors[key]; + this.saveFailedMessages.push(...messages); + }); + } + cancel(): void { this.showErrorSaving = false; + this.bookingsSaving = false; + this.saveFailedMessages = null; } tryAgain(): void { diff --git a/AdminWebsite/AdminWebsite/ClientApp/src/app/manage-team/justice-user-form/justice-user-form.component.spec.ts b/AdminWebsite/AdminWebsite/ClientApp/src/app/manage-team/justice-user-form/justice-user-form.component.spec.ts index d9fe61d53..543930a0b 100644 --- a/AdminWebsite/AdminWebsite/ClientApp/src/app/manage-team/justice-user-form/justice-user-form.component.spec.ts +++ b/AdminWebsite/AdminWebsite/ClientApp/src/app/manage-team/justice-user-form/justice-user-form.component.spec.ts @@ -201,7 +201,9 @@ describe('JusticeUserFormComponent', () => { }); justiceUsersServiceSpy.addNewJusticeUser.and.returnValue( - throwError(new BookHearingException('Bad Request', 400, 'One or more validation errors occurred.', null, validationProblem)) + throwError( + () => new BookHearingException('Bad Request', 400, 'One or more validation errors occurred.', null, validationProblem) + ) ); // act diff --git a/AdminWebsite/AdminWebsite/ClientApp/src/app/popups/save-failed-popup/save-failed-popup.component.html b/AdminWebsite/AdminWebsite/ClientApp/src/app/popups/save-failed-popup/save-failed-popup.component.html index a4ecf2953..5fce4c75b 100644 --- a/AdminWebsite/AdminWebsite/ClientApp/src/app/popups/save-failed-popup/save-failed-popup.component.html +++ b/AdminWebsite/AdminWebsite/ClientApp/src/app/popups/save-failed-popup/save-failed-popup.component.html @@ -1,6 +1,7 @@

Your booking could not be saved. Please try again.

+

{{ message }}

diff --git a/AdminWebsite/AdminWebsite/ClientApp/src/app/popups/save-failed-popup/save-failed-popup.component.ts b/AdminWebsite/AdminWebsite/ClientApp/src/app/popups/save-failed-popup/save-failed-popup.component.ts index f15004be4..a3a5370fe 100644 --- a/AdminWebsite/AdminWebsite/ClientApp/src/app/popups/save-failed-popup/save-failed-popup.component.ts +++ b/AdminWebsite/AdminWebsite/ClientApp/src/app/popups/save-failed-popup/save-failed-popup.component.ts @@ -1,4 +1,4 @@ -import { Component, EventEmitter, OnInit, Output } from '@angular/core'; +import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core'; @Component({ selector: 'app-save-failed-popup', @@ -8,7 +8,8 @@ export class SaveFailedPopupComponent implements OnInit { @Output() tryAgain: EventEmitter = new EventEmitter(); @Output() cancel: EventEmitter = new EventEmitter(); - constructor() {} + @Input() errorMessages: string[]; + ngOnInit() {} trySaveAgain(): void { diff --git a/AdminWebsite/AdminWebsite/ClientApp/src/app/services/clients/api-client.ts b/AdminWebsite/AdminWebsite/ClientApp/src/app/services/clients/api-client.ts index 4234042a9..b4847ee65 100644 --- a/AdminWebsite/AdminWebsite/ClientApp/src/app/services/clients/api-client.ts +++ b/AdminWebsite/AdminWebsite/ClientApp/src/app/services/clients/api-client.ts @@ -778,184 +778,6 @@ export class BHClient extends ApiClientBase { return _observableOf(null as any); } - /** - * Check Service Health - * @return Success - */ - checkServiceHealth(): Observable { - let url_ = this.baseUrl + '/HealthCheck/health'; - url_ = url_.replace(/[?&]$/, ''); - - let options_: any = { - observe: 'response', - responseType: 'blob', - headers: new HttpHeaders({ - Accept: 'application/json' - }) - }; - - return _observableFrom(this.transformOptions(options_)) - .pipe( - _observableMergeMap(transformedOptions_ => { - return this.http.request('get', url_, transformedOptions_); - }) - ) - .pipe( - _observableMergeMap((response_: any) => { - return this.processCheckServiceHealth(response_); - }) - ) - .pipe( - _observableCatch((response_: any) => { - if (response_ instanceof HttpResponseBase) { - try { - return this.processCheckServiceHealth(response_ as any); - } catch (e) { - return _observableThrow(e) as any as Observable; - } - } else return _observableThrow(response_) as any as Observable; - }) - ); - } - - protected processCheckServiceHealth(response: HttpResponseBase): Observable { - const status = response.status; - const responseBlob = - response instanceof HttpResponse - ? response.body - : (response as any).error instanceof Blob - ? (response as any).error - : undefined; - - let _headers: any = {}; - if (response.headers) { - for (let key of response.headers.keys()) { - _headers[key] = response.headers.get(key); - } - } - if (status === 500) { - return blobToText(responseBlob).pipe( - _observableMergeMap((_responseText: string) => { - let result500: any = null; - let resultData500 = _responseText === '' ? null : JSON.parse(_responseText, this.jsonParseReviver); - result500 = HealthCheckResponse.fromJS(resultData500); - return throwException('Server Error', status, _responseText, _headers, result500); - }) - ); - } else if (status === 200) { - return blobToText(responseBlob).pipe( - _observableMergeMap((_responseText: string) => { - let result200: any = null; - let resultData200 = _responseText === '' ? null : JSON.parse(_responseText, this.jsonParseReviver); - result200 = HealthCheckResponse.fromJS(resultData200); - return _observableOf(result200); - }) - ); - } else if (status === 401) { - return blobToText(responseBlob).pipe( - _observableMergeMap((_responseText: string) => { - return throwException('Unauthorized', status, _responseText, _headers); - }) - ); - } else if (status !== 200 && status !== 204) { - return blobToText(responseBlob).pipe( - _observableMergeMap((_responseText: string) => { - return throwException('An unexpected server error occurred.', status, _responseText, _headers); - }) - ); - } - return _observableOf(null as any); - } - - /** - * Check Service Health - * @return Success - */ - checkServiceHealth2(): Observable { - let url_ = this.baseUrl + '/health/liveness'; - url_ = url_.replace(/[?&]$/, ''); - - let options_: any = { - observe: 'response', - responseType: 'blob', - headers: new HttpHeaders({ - Accept: 'application/json' - }) - }; - - return _observableFrom(this.transformOptions(options_)) - .pipe( - _observableMergeMap(transformedOptions_ => { - return this.http.request('get', url_, transformedOptions_); - }) - ) - .pipe( - _observableMergeMap((response_: any) => { - return this.processCheckServiceHealth2(response_); - }) - ) - .pipe( - _observableCatch((response_: any) => { - if (response_ instanceof HttpResponseBase) { - try { - return this.processCheckServiceHealth2(response_ as any); - } catch (e) { - return _observableThrow(e) as any as Observable; - } - } else return _observableThrow(response_) as any as Observable; - }) - ); - } - - protected processCheckServiceHealth2(response: HttpResponseBase): Observable { - const status = response.status; - const responseBlob = - response instanceof HttpResponse - ? response.body - : (response as any).error instanceof Blob - ? (response as any).error - : undefined; - - let _headers: any = {}; - if (response.headers) { - for (let key of response.headers.keys()) { - _headers[key] = response.headers.get(key); - } - } - if (status === 500) { - return blobToText(responseBlob).pipe( - _observableMergeMap((_responseText: string) => { - let result500: any = null; - let resultData500 = _responseText === '' ? null : JSON.parse(_responseText, this.jsonParseReviver); - result500 = HealthCheckResponse.fromJS(resultData500); - return throwException('Server Error', status, _responseText, _headers, result500); - }) - ); - } else if (status === 200) { - return blobToText(responseBlob).pipe( - _observableMergeMap((_responseText: string) => { - let result200: any = null; - let resultData200 = _responseText === '' ? null : JSON.parse(_responseText, this.jsonParseReviver); - result200 = HealthCheckResponse.fromJS(resultData200); - return _observableOf(result200); - }) - ); - } else if (status === 401) { - return blobToText(responseBlob).pipe( - _observableMergeMap((_responseText: string) => { - return throwException('Unauthorized', status, _responseText, _headers); - }) - ); - } else if (status !== 200 && status !== 204) { - return blobToText(responseBlob).pipe( - _observableMergeMap((_responseText: string) => { - return throwException('An unexpected server error occurred.', status, _responseText, _headers); - }) - ); - } - return _observableOf(null as any); - } - /** * @return Success */ @@ -1454,7 +1276,7 @@ export class BHClient extends ApiClientBase { _observableMergeMap((_responseText: string) => { let result400: any = null; let resultData400 = _responseText === '' ? null : JSON.parse(_responseText, this.jsonParseReviver); - result400 = ProblemDetails.fromJS(resultData400); + result400 = ValidationProblemDetails.fromJS(resultData400); return throwException('Bad Request', status, _responseText, _headers, result400); }) ); @@ -7265,45 +7087,6 @@ export interface IUserProfileResponse { is_case_administrator?: boolean; } -export class ApplicationVersion implements IApplicationVersion { - file_version?: string | undefined; - information_version?: string | undefined; - - constructor(data?: IApplicationVersion) { - if (data) { - for (var property in data) { - if (data.hasOwnProperty(property)) (this)[property] = (data)[property]; - } - } - } - - init(_data?: any) { - if (_data) { - this.file_version = _data['file_version']; - this.information_version = _data['information_version']; - } - } - - static fromJS(data: any): ApplicationVersion { - data = typeof data === 'object' ? data : {}; - let result = new ApplicationVersion(); - result.init(data); - return result; - } - - toJSON(data?: any) { - data = typeof data === 'object' ? data : {}; - data['file_version'] = this.file_version; - data['information_version'] = this.information_version; - return data; - } -} - -export interface IApplicationVersion { - file_version?: string | undefined; - information_version?: string | undefined; -} - export class CaseAndHearingRolesResponse implements ICaseAndHearingRolesResponse { name?: string | undefined; hearing_roles?: HearingRole[] | undefined; @@ -7821,112 +7604,6 @@ export interface IEditTelephoneParticipantRequest { linked_participants?: LinkedParticipant[] | undefined; } -export class HealthCheck implements IHealthCheck { - successful?: boolean; - error_message?: string | undefined; - data?: { [key: string]: any } | undefined; - - constructor(data?: IHealthCheck) { - if (data) { - for (var property in data) { - if (data.hasOwnProperty(property)) (this)[property] = (data)[property]; - } - } - } - - init(_data?: any) { - if (_data) { - this.successful = _data['successful']; - this.error_message = _data['error_message']; - if (_data['data']) { - this.data = {} as any; - for (let key in _data['data']) { - if (_data['data'].hasOwnProperty(key)) (this.data)![key] = _data['data'][key]; - } - } - } - } - - static fromJS(data: any): HealthCheck { - data = typeof data === 'object' ? data : {}; - let result = new HealthCheck(); - result.init(data); - return result; - } - - toJSON(data?: any) { - data = typeof data === 'object' ? data : {}; - data['successful'] = this.successful; - data['error_message'] = this.error_message; - if (this.data) { - data['data'] = {}; - for (let key in this.data) { - if (this.data.hasOwnProperty(key)) (data['data'])[key] = (this.data)[key]; - } - } - return data; - } -} - -export interface IHealthCheck { - successful?: boolean; - error_message?: string | undefined; - data?: { [key: string]: any } | undefined; -} - -export class HealthCheckResponse implements IHealthCheckResponse { - bookings_api_health?: HealthCheck; - user_api_health?: HealthCheck; - video_api_health?: HealthCheck; - notification_api_health?: HealthCheck; - app_version?: ApplicationVersion; - - constructor(data?: IHealthCheckResponse) { - if (data) { - for (var property in data) { - if (data.hasOwnProperty(property)) (this)[property] = (data)[property]; - } - } - } - - init(_data?: any) { - if (_data) { - this.bookings_api_health = _data['bookings_api_health'] ? HealthCheck.fromJS(_data['bookings_api_health']) : undefined; - this.user_api_health = _data['user_api_health'] ? HealthCheck.fromJS(_data['user_api_health']) : undefined; - this.video_api_health = _data['video_api_health'] ? HealthCheck.fromJS(_data['video_api_health']) : undefined; - this.notification_api_health = _data['notification_api_health'] - ? HealthCheck.fromJS(_data['notification_api_health']) - : undefined; - this.app_version = _data['app_version'] ? ApplicationVersion.fromJS(_data['app_version']) : undefined; - } - } - - static fromJS(data: any): HealthCheckResponse { - data = typeof data === 'object' ? data : {}; - let result = new HealthCheckResponse(); - result.init(data); - return result; - } - - toJSON(data?: any) { - data = typeof data === 'object' ? data : {}; - data['bookings_api_health'] = this.bookings_api_health ? this.bookings_api_health.toJSON() : undefined; - data['user_api_health'] = this.user_api_health ? this.user_api_health.toJSON() : undefined; - data['video_api_health'] = this.video_api_health ? this.video_api_health.toJSON() : undefined; - data['notification_api_health'] = this.notification_api_health ? this.notification_api_health.toJSON() : undefined; - data['app_version'] = this.app_version ? this.app_version.toJSON() : undefined; - return data; - } -} - -export interface IHealthCheckResponse { - bookings_api_health?: HealthCheck; - user_api_health?: HealthCheck; - video_api_health?: HealthCheck; - notification_api_health?: HealthCheck; - app_version?: ApplicationVersion; -} - export class HearingAudioRecordingResponse implements IHearingAudioRecordingResponse { audio_file_links?: string[] | undefined; diff --git a/AdminWebsite/AdminWebsite/ClientApp/src/assets/images/favicons/manifest.json b/AdminWebsite/AdminWebsite/ClientApp/src/assets/images/favicons/manifest.json index 3b557aab8..987686db1 100644 --- a/AdminWebsite/AdminWebsite/ClientApp/src/assets/images/favicons/manifest.json +++ b/AdminWebsite/AdminWebsite/ClientApp/src/assets/images/favicons/manifest.json @@ -2,37 +2,37 @@ "name": "App", "icons": [ { - "src": "/android-icon-36x36.png", + "src": "/assets/images/favicons/android-icon-36x36.png", "sizes": "36x36", "type": "image/png", "density": "0.75" }, { - "src": "/android-icon-48x48.png", + "src": "/assets/images/favicons/android-icon-48x48.png", "sizes": "48x48", "type": "image/png", "density": "1.0" }, { - "src": "/android-icon-72x72.png", + "src": "/assets/images/favicons/android-icon-72x72.png", "sizes": "72x72", "type": "image/png", "density": "1.5" }, { - "src": "/android-icon-96x96.png", + "src": "/assets/images/favicons/android-icon-96x96.png", "sizes": "96x96", "type": "image/png", "density": "2.0" }, { - "src": "/android-icon-144x144.png", + "src": "/assets/images/favicons/android-icon-144x144.png", "sizes": "144x144", "type": "image/png", "density": "3.0" }, { - "src": "/android-icon-192x192.png", + "src": "/assets/images/favicons/android-icon-192x192.png", "sizes": "192x192", "type": "image/png", "density": "4.0" diff --git a/AdminWebsite/AdminWebsite/Controllers/HearingsController.cs b/AdminWebsite/AdminWebsite/Controllers/HearingsController.cs index c74d3c276..cd5dda99e 100644 --- a/AdminWebsite/AdminWebsite/Controllers/HearingsController.cs +++ b/AdminWebsite/AdminWebsite/Controllers/HearingsController.cs @@ -25,7 +25,6 @@ using VideoApi.Client; using HearingDetailsResponse = AdminWebsite.Contracts.Responses.HearingDetailsResponse; using LinkedParticipantRequest = AdminWebsite.Contracts.Requests.LinkedParticipantRequest; -using LinkedParticipantType = BookingsApi.Contract.V1.Enums.LinkedParticipantType; using ParticipantRequest = BookingsApi.Contract.V1.Requests.ParticipantRequest; namespace AdminWebsite.Controllers @@ -45,7 +44,6 @@ public class HearingsController : ControllerBase private readonly IFeatureToggles _featureToggles; private readonly ILogger _logger; private readonly IUserIdentity _userIdentity; - private const int StartingSoonMinutesThreshold = 30; /// /// Instantiates the controller @@ -208,7 +206,8 @@ public async Task CloneHearing(Guid hearingId, MultiHearingReques var groupedHearings = await _bookingsApiClient.GetHearingsByGroupIdAsync(hearingId); - var conferenceStatusToGet = groupedHearings.Where(x => x.Participants?.Any(x => x.HearingRoleName == RoleNames.Judge) ?? false); + var conferenceStatusToGet = groupedHearings.Where(x => x.Participants? + .Exists(x => x.HearingRoleName == RoleNames.Judge) ?? false); var tasks = conferenceStatusToGet.Select(x => GetHearingConferenceStatus(x.Id)).ToList(); await Task.WhenAll(tasks); @@ -249,7 +248,7 @@ private static List GetDatesForClonedHearings(MultiHearingRequest hear [SwaggerOperation(OperationId = "EditHearing")] [ProducesResponseType(typeof(HearingDetailsResponse), (int)HttpStatusCode.OK)] [ProducesResponseType((int)HttpStatusCode.NotFound)] - [ProducesResponseType((int)HttpStatusCode.BadRequest)] + [ProducesResponseType(typeof(ValidationProblemDetails),(int)HttpStatusCode.BadRequest)] [ProducesResponseType((int)HttpStatusCode.NoContent)] [HearingInputSanitizer] public async Task> EditHearing(Guid hearingId, [FromBody] EditHearingRequest request) @@ -258,7 +257,7 @@ public async Task> EditHearing(Guid hearing { _logger.LogWarning("No hearing id found to edit"); ModelState.AddModelError(nameof(hearingId), $"Please provide a valid {nameof(hearingId)}"); - return BadRequest(ModelState); + return ValidationProblem(ModelState); } _logger.LogDebug("Attempting to edit hearing {Hearing}", hearingId); @@ -267,7 +266,7 @@ public async Task> EditHearing(Guid hearing { _logger.LogWarning("Failed edit hearing validation"); ModelState.AddFluentValidationErrors(result.Errors); - return BadRequest(ModelState); + return ValidationProblem(ModelState); } HearingDetailsResponse originalHearing; @@ -284,26 +283,6 @@ public async Task> EditHearing(Guid hearing } try { - if (IsHearingStartingSoon(originalHearing) && originalHearing.Status == BookingStatus.Created && - !_hearingsService.IsAddingParticipantOnly(request, originalHearing) && - !_hearingsService.IsUpdatingJudge(request, originalHearing) && - !_hearingsService.HasEndpointsBeenChanged(request, originalHearing)) - { - var errorMessage = - $"You can't edit a confirmed hearing [{hearingId}] within {StartingSoonMinutesThreshold} minutes of it starting"; - _logger.LogWarning(errorMessage); - ModelState.AddModelError(nameof(hearingId), errorMessage); - return BadRequest(ModelState); - } - - var judgeExistsInRequest = request?.Participants?.Any(p => p.HearingRoleName == RoleNames.Judge) ?? false; - if (originalHearing.Status == BookingStatus.Created && !judgeExistsInRequest) - { - const string errorMessage = "You can't edit a confirmed hearing if the update removes the judge"; - _logger.LogWarning(errorMessage); - ModelState.AddModelError(nameof(hearingId), errorMessage); - return BadRequest(ModelState); - } var updatedHearing = await MapHearingToUpdate(hearingId); await UpdateHearing(request, hearingId, updatedHearing); @@ -316,7 +295,13 @@ public async Task> EditHearing(Guid hearing { _logger.LogError(e, "Failed to edit hearing {Hearing}. Status Code {StatusCode} - Message {Message}", hearingId, e.StatusCode, e.Response); - if (e.StatusCode == (int)HttpStatusCode.BadRequest) return BadRequest(e.Response); + + if (e.StatusCode is (int)HttpStatusCode.BadRequest) + { + var typedException = e as BookingsApiException; + return ValidationProblem(typedException!.Result); + } + throw; } } @@ -408,7 +393,7 @@ private async Task UpdateParticipantsV2(Guid hearingId, EditHearingRequest reque private static List GetRemovedParticipantIds(EditHearingRequest request, HearingDetailsResponse originalHearing) { - return originalHearing.Participants.Where(p => request.Participants.All(rp => rp.Id != p.Id)) + return originalHearing.Participants.Where(p => request.Participants.TrueForAll(rp => rp.Id != p.Id)) .Select(x => x.Id).ToList(); } @@ -429,11 +414,11 @@ private static List ExtractLinkedParticipants( for (int i = 0; i < participantsWithLinks.Count; i++) { var participantWithLinks = participantsWithLinks[i]; - var linkedParticipantRequest = new LinkedParticipantRequest() + var linkedParticipantRequest = new LinkedParticipantRequest { LinkedParticipantContactEmail = participantWithLinks.LinkedParticipants[0].LinkedParticipantContactEmail, ParticipantContactEmail = participantWithLinks.LinkedParticipants[0].ParticipantContactEmail ?? participantWithLinks.ContactEmail, - Type = (Contracts.Enums.LinkedParticipantType) participantWithLinks.LinkedParticipants[0].Type + Type = participantWithLinks.LinkedParticipants[0].Type }; // If the participant link is not new and already existed, then the ParticipantContactEmail will be null. We find it here and populate it. @@ -469,7 +454,7 @@ private static void ExtractExistingParticipants( EditParticipantRequest participant, List existingParticipants) { - var existingParticipant = originalHearing.Participants.FirstOrDefault(p => p.Id.Equals(participant.Id)); + var existingParticipant = originalHearing.Participants.Find(p => p.Id.Equals(participant.Id)); if (existingParticipant == null || string.IsNullOrEmpty(existingParticipant.UserRoleName)) return; @@ -482,7 +467,7 @@ private static void ExtractExistingParticipantsV2( EditParticipantRequest participant, List existingParticipants) { - var existingParticipant = originalHearing.Participants.FirstOrDefault(p => p.Id.Equals(participant.Id)); + var existingParticipant = originalHearing.Participants.Find(p => p.Id.Equals(participant.Id)); if (existingParticipant == null || string.IsNullOrEmpty(existingParticipant.UserRoleName)) return; @@ -490,12 +475,6 @@ private static void ExtractExistingParticipantsV2( existingParticipants.Add(updateParticipantRequest); } - private static bool IsHearingStartingSoon(HearingDetailsResponse originalHearing) - { - var timeToCheckHearingAgainst = DateTime.UtcNow.AddMinutes(StartingSoonMinutesThreshold); - return originalHearing.ScheduledDateTime < timeToCheckHearingAgainst; - } - /// /// Gets bookings hearing by Id. /// @@ -632,7 +611,7 @@ public async Task UpdateBookingStatus(Guid hearingId, UpdateBooki try { var hearing = await _bookingsApiClient.GetHearingDetailsByIdAsync(hearingId); - var judgeExists = hearing?.Participants?.Any(p => p.HearingRoleName == RoleNames.Judge) ?? false; + var judgeExists = hearing?.Participants?.Exists(p => p.HearingRoleName == RoleNames.Judge) ?? false; if (!judgeExists && updateBookingStatusRequest.Status == BookingsApi.Contract.V1.Requests.Enums.UpdateBookingStatus.Created) return BadRequest("This hearing has no judge"); diff --git a/AdminWebsite/AdminWebsite/Services/HearingsService.cs b/AdminWebsite/AdminWebsite/Services/HearingsService.cs index f7da8d4de..eee57384c 100644 --- a/AdminWebsite/AdminWebsite/Services/HearingsService.cs +++ b/AdminWebsite/AdminWebsite/Services/HearingsService.cs @@ -1,5 +1,4 @@ using AdminWebsite.Contracts.Enums; -using AdminWebsite.Extensions; using AdminWebsite.Mappers; using AdminWebsite.Models; using BookingsApi.Client; @@ -14,7 +13,6 @@ using BookingsApi.Contract.V1.Configuration; using BookingsApi.Contract.V1.Requests; using BookingsApi.Contract.V2.Requests; -using VideoApi.Contract.Consts; namespace AdminWebsite.Services { @@ -26,10 +24,7 @@ public interface IHearingsService Task ProcessNewParticipant(Guid hearingId, EditParticipantRequest participant, List removedParticipantIds, HearingDetailsResponse hearing); Task ProcessNewParticipant(Guid hearingId, EditParticipantRequest participant, IParticipantRequest newParticipant, List removedParticipantIds, HearingDetailsResponse hearing); Task ProcessEndpoints(Guid hearingId, EditHearingRequest request, HearingDetailsResponse hearing, List newParticipantList); - bool IsAddingParticipantOnly(EditHearingRequest editHearingRequest, HearingDetailsResponse hearingDetailsResponse); - bool IsUpdatingJudge(EditHearingRequest editHearingRequest, HearingDetailsResponse hearingDetailsResponse); Task UpdateFailedBookingStatus(Guid hearingId); - bool HasEndpointsBeenChanged(EditHearingRequest editHearingRequest, HearingDetailsResponse hearingDetailsResponse); } public class HearingsService : IHearingsService @@ -55,53 +50,6 @@ public void AssignEndpointDefenceAdvocates(Listx.HearingRoleName != HearingRoleName.StaffMember) - .Select(EditParticipantRequestMapper.MapFrom) - .ToList(); - var requestParticipants = editHearingRequest.Participants.FindAll(x=>x.HearingRoleName != HearingRoleName.StaffMember); - var hearingCase = hearingDetailsResponse.Cases[0]; - - var addedParticipant = GetAddedParticipant(originalParticipants, requestParticipants); - - return addedParticipant.Any() && - editHearingRequest.HearingRoomName == hearingDetailsResponse.HearingRoomName && - editHearingRequest.HearingVenueName == hearingDetailsResponse.HearingVenueName && - editHearingRequest.OtherInformation == hearingDetailsResponse.OtherInformation && - editHearingRequest.ScheduledDateTime == hearingDetailsResponse.ScheduledDateTime && - editHearingRequest.ScheduledDuration == hearingDetailsResponse.ScheduledDuration && - hearingCase.Number == editHearingRequest.Case.Number; - } - - public bool IsUpdatingJudge(EditHearingRequest editHearingRequest, - HearingDetailsResponse hearingDetailsResponse) - { - var existingJudge = - hearingDetailsResponse.Participants.Find( - x => x.HearingRoleName == HearingRoleName.Judge); - var newJudge = - editHearingRequest.Participants.Find(x => x.HearingRoleName == HearingRoleName.Judge); - var existingJudgeOtherInformation = HearingDetailsResponseExtensions.GetJudgeOtherInformationString(hearingDetailsResponse.OtherInformation); - var newJudgeOtherInformation = HearingDetailsResponseExtensions.GetJudgeOtherInformationString(editHearingRequest.OtherInformation); - - return (newJudge?.ContactEmail != existingJudge?.ContactEmail) || - newJudgeOtherInformation != existingJudgeOtherInformation; - } - - public bool HasEndpointsBeenChanged(EditHearingRequest editHearingRequest, HearingDetailsResponse hearingDetailsResponse) - { - var originalEndpoints = hearingDetailsResponse.Endpoints == null - ? new List() - : hearingDetailsResponse.Endpoints.Select(EditEndpointRequestMapper.MapFrom).ToList(); - var requestEndpoints = editHearingRequest.Endpoints ?? new List(); - - var ogEndpoints = originalEndpoints.Except(requestEndpoints, EditEndpointRequest.EditEndpointRequestComparer).ToList(); - var newEndpoints = requestEndpoints.Except(originalEndpoints, EditEndpointRequest.EditEndpointRequestComparer).ToList(); - - return ogEndpoints.Count != 0 || newEndpoints.Count != 0; - } public List GetAddedParticipant(List originalParticipants, List requestParticipants) {