Skip to content

Commit

Permalink
write traces to artifacts
Browse files Browse the repository at this point in the history
  • Loading branch information
Erwinvandervalk committed Feb 13, 2025
1 parent d35ab1a commit 3e66ceb
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 4 deletions.
17 changes: 17 additions & 0 deletions .github/workflow-gen/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,8 @@ void GenerateBffWorkflow(Product product)

job.StepTest(product.Solution);

job.StepUploadPlaywrightTestTraces(product.Name);

job.StepToolRestore();

job.StepPack(product.Solution);
Expand Down Expand Up @@ -476,6 +478,21 @@ public static Step StepPush(this Job job, string destination, string sourceUrl,
.Run($"dotnet nuget push artifacts/*.nupkg --source {sourceUrl} --api-key {apiKey} --skip-duplicate");
}

public static Step StepUploadPlaywrightTestTraces(this Job job, string componentName)
{
var path = $"{componentName}/tests/**/playwright-traces/*.zip";
return job.Step()
.Name("Upload playwright traces")
.If("success() || failure()")
.Uses("actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882") // 4.4.3
.With(
("name", "playwright-traces"),
("path", path),
("overwrite", "true"),
("retention-days", "15"));
}


public static Step StepUploadArtifacts(this Job job, string componentName)
{
var path = $"{componentName}/artifacts/*.nupkg";
Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/bff-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,14 @@ jobs:
reporter: dotnet-trx
fail-on-error: true
fail-on-empty: true
- name: Upload playwright traces
if: success() || failure()
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882
with:
name: playwright-traces
path: bff/tests/**/playwright-traces/*.zip
overwrite: true
retention-days: 15
- name: Tool restore
run: dotnet tool restore
- name: Pack bff.slnf
Expand Down
4 changes: 1 addition & 3 deletions bff/test/Hosts.Tests/PageModels/PerComponentPageModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@ public class CallApiPageModel : PerComponentPageModel
{
protected override async Task Verify()
{
await Page.WaitForLoadStateAsync();

(await Page.TitleAsync()).ShouldBe("Call API");
await Expect(Page.GetByText("InteractiveServer")).ToBeVisibleAsync();
}

public async Task InvokeCallApi(string headingName)
Expand Down
2 changes: 1 addition & 1 deletion bff/test/Hosts.Tests/PlaywrightTestBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public PlaywrightTestBase(ITestOutputHelper output, AppHostFixture fixture)
public override async Task InitializeAsync()
{
await base.InitializeAsync();
Context.SetDefaultTimeout(10_000);
await Context.Tracing.StartAsync(new()
{
Title = $"{WithTestNameAttribute.CurrentClassName}.{WithTestNameAttribute.CurrentTestName}",
Expand Down Expand Up @@ -81,7 +82,6 @@ public override BrowserNewContextOptions ContextOptions()
// Even though we use dotnet dev-certs https --trust on the build agent,
// it still claims the certs are invalid.
IgnoreHTTPSErrors = true,

};
}

Expand Down

0 comments on commit 3e66ceb

Please sign in to comment.