Skip to content

Commit

Permalink
fix add participant to hearing
Browse files Browse the repository at this point in the history
  • Loading branch information
shaed-parkar committed Jan 9, 2025
1 parent 56d559d commit be7bb7f
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 9 deletions.
2 changes: 1 addition & 1 deletion UI.AutomationTests/CommonUiTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
12 changes: 11 additions & 1 deletion UI.AutomationTests/Drivers/RemoteChromeVhDriver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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()
Expand Down
8 changes: 4 additions & 4 deletions UI.AutomationTests/Video/QuickLinkUserTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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()
Expand Down
4 changes: 2 additions & 2 deletions UI.AutomationTests/Video/VideoWebUiTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion UI.PageModels/Pages/Admin/Booking/BookingDetailsPage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public BookingConfirmationPage AddParticipantsToBooking(List<BookingParticipantD
var videoAccessPointsPage = participantsPage.GoToVideoAccessPointsPage();
// use existing booking flow (i.e. next on vap goes screening (if enabled) and then to summary page)
var summaryPage = FeatureToggle.Instance().SpecialMeasuresEnabled() ?
videoAccessPointsPage.GoToSpecialMeasuresPage().GoToSummaryPage()
videoAccessPointsPage.GoToSpecialMeasuresPage().GoToOtherInformationPage().GoToSummaryPage()
: videoAccessPointsPage.GoToSummaryPage();
return summaryPage.ClickBookButton();
}
Expand Down

0 comments on commit be7bb7f

Please sign in to comment.