From 81b72c85f5c21434057d22986b939a0960089d61 Mon Sep 17 00:00:00 2001 From: Hao Kung Date: Wed, 3 Mar 2021 17:52:42 -0800 Subject: [PATCH 1/5] Record har and video to helix upload dir --- .../BlazorWasmTemplateTest.cs | 2 ++ .../BrowserTesting/src/ContextInformation.cs | 18 ++++++++++++++++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/ProjectTemplates/BlazorTemplates.Tests/BlazorWasmTemplateTest.cs b/src/ProjectTemplates/BlazorTemplates.Tests/BlazorWasmTemplateTest.cs index d917e71ca32a..ef170da017d0 100644 --- a/src/ProjectTemplates/BlazorTemplates.Tests/BlazorWasmTemplateTest.cs +++ b/src/ProjectTemplates/BlazorTemplates.Tests/BlazorWasmTemplateTest.cs @@ -79,6 +79,8 @@ public async Task BlazorWasmStandaloneTemplate_Works(BrowserKind browserKind) EnsureBrowserAvailable(browserKind); } } + + Assert.True(0 == 1); } private async Task NavigateToPage(IBrowserContext browser, string listeningUri) diff --git a/src/Shared/BrowserTesting/src/ContextInformation.cs b/src/Shared/BrowserTesting/src/ContextInformation.cs index 07cadc4bf0f5..a9486aa7966d 100644 --- a/src/Shared/BrowserTesting/src/ContextInformation.cs +++ b/src/Shared/BrowserTesting/src/ContextInformation.cs @@ -55,8 +55,22 @@ internal BrowserContextOptions ConfigureUniqueHarPath(BrowserContextOptions brow if (browserContextOptions?.RecordHar?.Path != null) { var identifier = Guid.NewGuid().ToString("N"); - browserContextOptions.RecordHar.Path = Path.Combine(browserContextOptions.RecordHar.Path, $"{identifier}.har"); - _harPath = browserContextOptions.RecordHar.Path; + var harDir = Environment.GetEnvironmentVariable("HELIX_WORKITEM_UPLOAD_ROOT"); + if (string.IsNullOrEmpty(harDir)) + { + harDirectory = browserContextOptions.RecordHar.Path; + } + browserContextOptions.RecordHar.Path = Path.Combine(harDirectory, $"{identifier}.har"); + _harPath = browserContextOptions.RecordHar.Path + } + + if (browserContextOptions?.RecordVideo?.Dir != null) + { + var uploadDir = Environment.GetEnvironmentVariable("HELIX_WORKITEM_UPLOAD_ROOT"); + if (!string.IsNullOrEmpty(uploadDir)) + { + browserContextOptions.RecordVideo.Dir = uploadDir; + } } return browserContextOptions; From 603d24d2016dc6931ce9e9cab2a304a982c2224f Mon Sep 17 00:00:00 2001 From: Hao Kung Date: Wed, 3 Mar 2021 21:58:21 -0800 Subject: [PATCH 2/5] Update ContextInformation.cs --- src/Shared/BrowserTesting/src/ContextInformation.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Shared/BrowserTesting/src/ContextInformation.cs b/src/Shared/BrowserTesting/src/ContextInformation.cs index a9486aa7966d..33d8bebec413 100644 --- a/src/Shared/BrowserTesting/src/ContextInformation.cs +++ b/src/Shared/BrowserTesting/src/ContextInformation.cs @@ -61,7 +61,7 @@ internal BrowserContextOptions ConfigureUniqueHarPath(BrowserContextOptions brow harDirectory = browserContextOptions.RecordHar.Path; } browserContextOptions.RecordHar.Path = Path.Combine(harDirectory, $"{identifier}.har"); - _harPath = browserContextOptions.RecordHar.Path + _harPath = browserContextOptions.RecordHar.Path; } if (browserContextOptions?.RecordVideo?.Dir != null) From 8c9a1f2a3336b8a31d5a05d2f9c2f70b3195121d Mon Sep 17 00:00:00 2001 From: Hao Kung Date: Thu, 4 Mar 2021 09:12:49 -0800 Subject: [PATCH 3/5] Update ContextInformation.cs --- src/Shared/BrowserTesting/src/ContextInformation.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Shared/BrowserTesting/src/ContextInformation.cs b/src/Shared/BrowserTesting/src/ContextInformation.cs index 33d8bebec413..828b6221770f 100644 --- a/src/Shared/BrowserTesting/src/ContextInformation.cs +++ b/src/Shared/BrowserTesting/src/ContextInformation.cs @@ -55,7 +55,7 @@ internal BrowserContextOptions ConfigureUniqueHarPath(BrowserContextOptions brow if (browserContextOptions?.RecordHar?.Path != null) { var identifier = Guid.NewGuid().ToString("N"); - var harDir = Environment.GetEnvironmentVariable("HELIX_WORKITEM_UPLOAD_ROOT"); + var harDirectory = Environment.GetEnvironmentVariable("HELIX_WORKITEM_UPLOAD_ROOT"); if (string.IsNullOrEmpty(harDir)) { harDirectory = browserContextOptions.RecordHar.Path; From 30b019dad1bc062d2274188b36dd3604328d441a Mon Sep 17 00:00:00 2001 From: Hao Kung Date: Thu, 4 Mar 2021 09:24:12 -0800 Subject: [PATCH 4/5] Update ContextInformation.cs --- src/Shared/BrowserTesting/src/ContextInformation.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Shared/BrowserTesting/src/ContextInformation.cs b/src/Shared/BrowserTesting/src/ContextInformation.cs index 828b6221770f..f197dff80c7c 100644 --- a/src/Shared/BrowserTesting/src/ContextInformation.cs +++ b/src/Shared/BrowserTesting/src/ContextInformation.cs @@ -56,7 +56,7 @@ internal BrowserContextOptions ConfigureUniqueHarPath(BrowserContextOptions brow { var identifier = Guid.NewGuid().ToString("N"); var harDirectory = Environment.GetEnvironmentVariable("HELIX_WORKITEM_UPLOAD_ROOT"); - if (string.IsNullOrEmpty(harDir)) + if (string.IsNullOrEmpty(harDirectory)) { harDirectory = browserContextOptions.RecordHar.Path; } From d3bfc8e034584719c14f969e6be989fb8cd5ade2 Mon Sep 17 00:00:00 2001 From: Hao Kung Date: Thu, 4 Mar 2021 12:30:59 -0800 Subject: [PATCH 5/5] Update BlazorWasmTemplateTest.cs --- .../BlazorTemplates.Tests/BlazorWasmTemplateTest.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/ProjectTemplates/BlazorTemplates.Tests/BlazorWasmTemplateTest.cs b/src/ProjectTemplates/BlazorTemplates.Tests/BlazorWasmTemplateTest.cs index ef170da017d0..d917e71ca32a 100644 --- a/src/ProjectTemplates/BlazorTemplates.Tests/BlazorWasmTemplateTest.cs +++ b/src/ProjectTemplates/BlazorTemplates.Tests/BlazorWasmTemplateTest.cs @@ -79,8 +79,6 @@ public async Task BlazorWasmStandaloneTemplate_Works(BrowserKind browserKind) EnsureBrowserAvailable(browserKind); } } - - Assert.True(0 == 1); } private async Task NavigateToPage(IBrowserContext browser, string listeningUri)