diff --git a/UI.AutomationTests/CommonUiTest.cs b/UI.AutomationTests/CommonUiTest.cs index df07994f..5af5992a 100644 --- a/UI.AutomationTests/CommonUiTest.cs +++ b/UI.AutomationTests/CommonUiTest.cs @@ -90,7 +90,7 @@ protected IVhDriver CreateDriver(string username, string videoFileName = null) } else { - driver = new RemoteChromeVhDriver(username: username); + driver = new RemoteChromeVhDriver(username: username, videoFileName:videoFileName); } driver.GetDriver().StoreUsername(username); diff --git a/UI.AutomationTests/Drivers/RemoteChromeVhDriver.cs b/UI.AutomationTests/Drivers/RemoteChromeVhDriver.cs index a97ac3eb..23a1d0aa 100644 --- a/UI.AutomationTests/Drivers/RemoteChromeVhDriver.cs +++ b/UI.AutomationTests/Drivers/RemoteChromeVhDriver.cs @@ -9,7 +9,7 @@ public class RemoteChromeVhDriver : IVhDriver private RemoteWebDriver _driver; public RemoteChromeVhDriver(string platform = "Windows 11", string browserVersion = "latest", - string username = null) + string username = null, string videoFileName = null) { var envConfigSettings = ConfigRootBuilder.EnvConfigInstance(); var chromeOptions = new ChromeOptions @@ -23,6 +23,16 @@ public RemoteChromeVhDriver(string platform = "Windows 11", string browserVersio chromeOptions.AddArguments("--use-fake-ui-for-media-stream"); chromeOptions.AddArguments("--use-fake-device-for-media-stream"); + if (videoFileName != null) + { + var videoFilePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "MockVideos", videoFileName); + if (!File.Exists(videoFilePath)) + { + throw new FileNotFoundException($"Video file not found: {videoFilePath}"); + } + chromeOptions.AddArgument($"--use-file-for-fake-video-capture={videoFilePath}"); + } + // this is the name for a build in SauceLabs var buildName = Environment.GetEnvironmentVariable("TF_BUILD") == null ? BuildName.GetBuildNameForLocal().Trim() diff --git a/UI.AutomationTests/Video/QuickLinkUserTests.cs b/UI.AutomationTests/Video/QuickLinkUserTests.cs index 2b229983..7383f90e 100644 --- a/UI.AutomationTests/Video/QuickLinkUserTests.cs +++ b/UI.AutomationTests/Video/QuickLinkUserTests.cs @@ -25,8 +25,8 @@ await TestContext.Out.WriteLineAsync( var quickLinkName1 = $"QL Auto Join 1 {Guid.NewGuid():N}"; var quickLinkName2 = $"QL Auto Join 2 {Guid.NewGuid():N}"; - var qlWaitingRoomPage1 = LoginInAsQlAndNavigateToWaitingRoom(quickLinkName1, conference.Id.ToString()); - var qlWaitingRoomPage2 = LoginInAsQlAndNavigateToWaitingRoom(quickLinkName2, conference.Id.ToString()); + var qlWaitingRoomPage1 = LoginInAsQlAndNavigateToWaitingRoom(quickLinkName1, conference.Id.ToString(), HearingTestData.Individual01FileName); + var qlWaitingRoomPage2 = LoginInAsQlAndNavigateToWaitingRoom(quickLinkName2, conference.Id.ToString(), HearingTestData.Individual02FileName); var particiantsFromConference = await VideoApiClient.GetParticipantsByConferenceIdAsync(conference.Id); var quicklink1 = particiantsFromConference.First(x => x.DisplayName == quickLinkName1); @@ -109,9 +109,9 @@ private async Task GetQuicklinkJoinUri(HearingDetailsResponseV2 hearing) await TestContext.Out.WriteLineAsync(_quickLinkJoinUrl); } - private ParticipantWaitingRoomPage LoginInAsQlAndNavigateToWaitingRoom(string qlName, string conferenceId) + private ParticipantWaitingRoomPage LoginInAsQlAndNavigateToWaitingRoom(string qlName, string conferenceId, string videoFileName = null) { - var quickLinkJoinHearingPage = LoginAsQuickLinkUser(_quickLinkJoinUrl, qlName); + var quickLinkJoinHearingPage = LoginAsQuickLinkUser(_quickLinkJoinUrl, qlName, videoFileName); quickLinkJoinHearingPage.EnterQuickLinkUserDetails(qlName, true); var quickLinkHearingListPage = quickLinkJoinHearingPage.Continue(); var page = quickLinkHearingListPage.SelectHearing(conferenceId).GoToEquipmentCheck() diff --git a/UI.AutomationTests/Video/VideoWebUiTest.cs b/UI.AutomationTests/Video/VideoWebUiTest.cs index 69a3ee91..8593ac45 100644 --- a/UI.AutomationTests/Video/VideoWebUiTest.cs +++ b/UI.AutomationTests/Video/VideoWebUiTest.cs @@ -143,9 +143,9 @@ protected ParticipantHearingListPage LoginAsParticipant(string username, string : loginPage.LogInAsParticipant(username, password); } - protected QuickLinkJoinYourHearingPage LoginAsQuickLinkUser(string quickLinkJoinUrl, string displayName) + protected QuickLinkJoinYourHearingPage LoginAsQuickLinkUser(string quickLinkJoinUrl, string displayName, string videoFileName = null) { - var participant = InitVideoWebParticipant(displayName, JourneyType.QuickLinkParticipant, null); + var participant = InitVideoWebParticipant(displayName, JourneyType.QuickLinkParticipant, videoFileName); var driver = participant.Driver.GetDriver(); driver.Navigate().GoToUrl(quickLinkJoinUrl); return new QuickLinkJoinYourHearingPage(driver, EnvConfigSettings.DefaultElementWait); diff --git a/UI.PageModels/Pages/Admin/Booking/BookingDetailsPage.cs b/UI.PageModels/Pages/Admin/Booking/BookingDetailsPage.cs index 1d25a9bc..0f8c7edc 100644 --- a/UI.PageModels/Pages/Admin/Booking/BookingDetailsPage.cs +++ b/UI.PageModels/Pages/Admin/Booking/BookingDetailsPage.cs @@ -94,7 +94,7 @@ public BookingConfirmationPage AddParticipantsToBooking(List