Skip to content

Commit c3625dc

Browse files
authored
Record har and video to helix upload dir (#30637)
* Record har and video to helix upload dir * Update ContextInformation.cs * Update ContextInformation.cs * Update ContextInformation.cs * Update BlazorWasmTemplateTest.cs
1 parent e1a9848 commit c3625dc

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

src/Shared/BrowserTesting/src/ContextInformation.cs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,24 @@ internal BrowserContextOptions ConfigureUniqueHarPath(BrowserContextOptions brow
5555
if (browserContextOptions?.RecordHar?.Path != null)
5656
{
5757
var identifier = Guid.NewGuid().ToString("N");
58-
browserContextOptions.RecordHar.Path = Path.Combine(browserContextOptions.RecordHar.Path, $"{identifier}.har");
58+
var harDirectory = Environment.GetEnvironmentVariable("HELIX_WORKITEM_UPLOAD_ROOT");
59+
if (string.IsNullOrEmpty(harDirectory))
60+
{
61+
harDirectory = browserContextOptions.RecordHar.Path;
62+
}
63+
browserContextOptions.RecordHar.Path = Path.Combine(harDirectory, $"{identifier}.har");
5964
_harPath = browserContextOptions.RecordHar.Path;
6065
}
6166

67+
if (browserContextOptions?.RecordVideo?.Dir != null)
68+
{
69+
var uploadDir = Environment.GetEnvironmentVariable("HELIX_WORKITEM_UPLOAD_ROOT");
70+
if (!string.IsNullOrEmpty(uploadDir))
71+
{
72+
browserContextOptions.RecordVideo.Dir = uploadDir;
73+
}
74+
}
75+
6276
return browserContextOptions;
6377
}
6478
}

0 commit comments

Comments
 (0)