Skip to content

Commit cc50fd2

Browse files
Update IndexTest.cs
1 parent ef3e631 commit cc50fd2

1 file changed

Lines changed: 26 additions & 19 deletions

File tree

AudioCuesheetEditor.End2EndTests/Pages/IndexTest.cs

Lines changed: 26 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -82,27 +82,34 @@ public async Task ChangeLanguage()
8282
//TODO: Doesn't work in CI and using a new context conflicts tracing the default one
8383
// We need to use a new context because the default one doesn't work with changing a language
8484
var context = await Browser.NewContextAsync();
85-
await context.Tracing.StartAsync(new()
85+
try
8686
{
87-
Title = $"{TestContext.FullyQualifiedTestClassName}.{TestContext.TestName}",
88-
Screenshots = true,
89-
Snapshots = true,
90-
Sources = true
91-
});
92-
var page = await context.NewPageAsync();
93-
await page.GotoAsync("http://localhost:5132/");
94-
await page.GetByRole(AriaRole.Button, new() { Name = "Change language" }).ClickAsync();
95-
await page.Locator("div").Filter(new() { HasTextRegex = new Regex("^German \\(Germany\\)$") }).ClickAsync();
96-
await Expect(page.Locator("#app")).ToContainTextAsync("Allgemeine Informationen");
97-
await context.Tracing.StopAsync(new()
87+
await context.Tracing.StartAsync(new()
88+
{
89+
Title = $"{TestContext.FullyQualifiedTestClassName}.{TestContext.TestName}",
90+
Screenshots = true,
91+
Snapshots = true,
92+
Sources = true
93+
});
94+
var page = await context.NewPageAsync();
95+
await page.GotoAsync("http://localhost:5132/");
96+
await page.GetByRole(AriaRole.Button, new() { Name = "Change language" }).ClickAsync();
97+
await page.Locator("div").Filter(new() { HasTextRegex = new Regex("^German \\(Germany\\)$") }).ClickAsync();
98+
await Expect(page.Locator("#app")).ToContainTextAsync("Allgemeine Informationen");
99+
100+
}
101+
finally
98102
{
99-
Path = Path.Combine(
100-
Environment.CurrentDirectory,
101-
"playwright-traces",
102-
$"{TestContext.FullyQualifiedTestClassName}.{TestContext.TestName}-{Guid.NewGuid()}.zip"
103-
)
104-
});
105-
await context.CloseAsync();
103+
await context.Tracing.StopAsync(new()
104+
{
105+
Path = Path.Combine(
106+
Environment.CurrentDirectory,
107+
"playwright-traces",
108+
$"{TestContext.FullyQualifiedTestClassName}.{TestContext.TestName}-{Guid.NewGuid()}.zip"
109+
)
110+
});
111+
await context.CloseAsync();
112+
}
106113
}
107114

108115
[TestMethod]

0 commit comments

Comments
 (0)