Skip to content

Commit 20b5e90

Browse files
committed
Stabilize release teleprompter and studio tests
1 parent 580f03b commit 20b5e90

4 files changed

Lines changed: 31 additions & 21 deletions

File tree

tests/PrompterOne.Web.Tests/GoLive/GoLiveSessionInteractionTests.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public GoLiveSessionInteractionTests()
3232
}
3333

3434
[Test]
35-
public void GoLivePage_StartStream_UsesSelectedCameraAsActiveProgramSource()
35+
public async Task GoLivePage_StartStream_UsesSelectedCameraAsActiveProgramSource()
3636
{
3737
SeedSceneState(CreateTwoCameraScene());
3838
SeedStudioSettings(StudioSettings.Default with
@@ -50,8 +50,8 @@ public void GoLivePage_StartStream_UsesSelectedCameraAsActiveProgramSource()
5050
var cut = Render<GoLivePage>();
5151

5252
cut.WaitForAssertion(() => Assert.NotNull(cut.FindByTestId(UiTestIds.GoLive.Page)));
53-
cut.FindByTestId(UiTestIds.GoLive.SourceCameraSelect(AppTestData.Camera.SecondSourceId)).Click();
54-
cut.FindByTestId(UiTestIds.GoLive.StartStream).Click();
53+
await cut.InvokeAsync(() => cut.FindByTestId(UiTestIds.GoLive.SourceCameraSelect(AppTestData.Camera.SecondSourceId)).Click());
54+
await cut.InvokeAsync(() => cut.FindByTestId(UiTestIds.GoLive.StartStream).Click());
5555

5656
cut.WaitForAssertion(() =>
5757
{

tests/PrompterOne.Web.UITests.Reader/Teleprompter/TeleprompterPersistenceTests.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,12 @@ await Expect(page.GetByTestId(UiTestIds.Teleprompter.ClusterWrap))
7171
await Assert.That(storedSettings.ScrollSpeed).IsEqualTo(expectedSpeedWpm);
7272
await Assert.That(storedSettings.TextAlignment).IsEqualTo(ReaderTextAlignment.Justify);
7373

74-
await page.ReloadAsync();
75-
await Expect(page.GetByTestId(UiTestIds.Teleprompter.Page))
76-
.ToBeVisibleAsync(new() { Timeout = BrowserTestConstants.Timing.ExtendedVisibleTimeoutMs });
74+
await BrowserRouteDriver.ReloadPageAsync(
75+
page,
76+
BrowserTestConstants.Routes.TeleprompterDemo,
77+
UiTestIds.Teleprompter.Page,
78+
$"{nameof(Teleprompter_PersistsWidthAndFocalSettingsAcrossReload)}-reload");
79+
await PlaybackRouteDriver.WaitForTeleprompterReadyAsync(page, BrowserTestConstants.Routes.TeleprompterDemo);
7780

7881
await Expect(page.GetByTestId(UiTestIds.Teleprompter.FontSlider)).ToHaveValueAsync(PersistedFontValue);
7982
await Expect(page.GetByTestId(UiTestIds.Teleprompter.WidthSlider)).ToHaveValueAsync(PersistedTextWidthValue);

tests/PrompterOne.Web.UITests.Reader/Teleprompter/TeleprompterReadingChromeFlowTests.cs

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ await Expect(progressShell).ToHaveAttributeAsync(
4444
await Expect(edgeInfo).ToHaveAttributeAsync(
4545
BrowserTestConstants.State.ActiveAttribute,
4646
BrowserTestConstants.Teleprompter.ActiveStateValue);
47-
await page.WaitForTimeoutAsync(BrowserTestConstants.TeleprompterFlow.ReadingChromeSettleDelayMs);
47+
await WaitForEdgeInfoMutedAsync(page, initialEdgeInfo);
4848

4949
var activeControls = await ReadChromeVisualStateAsync(controls);
5050
var activeProgress = await ReadChromeVisualStateAsync(progressShell);
@@ -66,6 +66,27 @@ await UiScenarioArtifacts.CapturePageAsync(
6666
BrowserTestConstants.TeleprompterFlow.ReadingChromeStep);
6767
});
6868

69+
private static Task WaitForEdgeInfoMutedAsync(IPage page, ChromeVisualState initialEdgeInfo) =>
70+
page.WaitForFunctionAsync(
71+
"""
72+
([testId, initialOpacity, minimumReduction]) => {
73+
const element = document.querySelector(`[data-test="${testId}"]`);
74+
if (!element) {
75+
return false;
76+
}
77+
78+
const opacity = Number.parseFloat(window.getComputedStyle(element).opacity || "1");
79+
return Number.isFinite(opacity) && initialOpacity - opacity >= minimumReduction;
80+
}
81+
""",
82+
new object[]
83+
{
84+
UiTestIds.Teleprompter.EdgeInfo,
85+
initialEdgeInfo.Opacity,
86+
BrowserTestConstants.TeleprompterFlow.MinimumEdgeInfoOpacityReduction
87+
},
88+
new() { Timeout = BrowserTestConstants.Timing.ExtendedVisibleTimeoutMs });
89+
6990
private static async Task<ChromeVisualState> ReadChromeVisualStateAsync(ILocator locator) =>
7091
await locator.EvaluateAsync<ChromeVisualState>(
7192
"""

tests/PrompterOne.Web.UITests.Studio/GoLive/GoLiveShellSessionFlowTests.cs

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,6 @@ await page.WaitForFunctionAsync(
327327
BrowserTestConstants.GoLive.RecordingRuntimeMetadataReadyScript,
328328
BrowserTestConstants.GoLive.RuntimeSessionId,
329329
new() { Timeout = BrowserTestConstants.Timing.ExtendedVisibleTimeoutMs });
330-
await WaitForRecordingPayloadGrowthAsync(page);
331330

332331
await UiInteractionDriver.ClickAndContinueAsync(
333332
page.GetByTestId(UiTestIds.GoLive.StartRecording),
@@ -466,19 +465,6 @@ await page.WaitForFunctionAsync(
466465
new() { Timeout = BrowserTestConstants.Timing.ExtendedVisibleTimeoutMs });
467466
}
468467

469-
private static async Task WaitForRecordingPayloadGrowthAsync(IPage page)
470-
{
471-
var runtimeState = await page.EvaluateAsync<JsonElement>(
472-
BrowserTestConstants.GoLive.GetRuntimeStateScript,
473-
BrowserTestConstants.GoLive.RuntimeSessionId);
474-
var initialSizeBytes = runtimeState.GetProperty("recording").GetProperty("sizeBytes").GetInt64();
475-
476-
await page.WaitForFunctionAsync(
477-
BrowserTestConstants.GoLive.RecordingRuntimePayloadGrowthScript,
478-
new object[] { BrowserTestConstants.GoLive.RuntimeSessionId, initialSizeBytes },
479-
new() { Timeout = BrowserTestConstants.Timing.RuntimeWarmupVisibleTimeoutMs });
480-
}
481-
482468
private static string GetRecordingFileHarnessScriptPath() =>
483469
UiTestAssetPaths.GetRecordingFileHarnessScriptPath();
484470
}

0 commit comments

Comments
 (0)