Skip to content

Commit

Permalink
fix: simplify test examples
Browse files Browse the repository at this point in the history
  • Loading branch information
egil committed Feb 7, 2024
1 parent fff7209 commit 8f32887
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
4 changes: 2 additions & 2 deletions BlazorTestingAZ.Tests/End2EndTesting/CounterPageManualTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public async Task Count_Increments_WhenButtonIsClicked()
// Arrange
// Runs Blazor App referenced by Program, making it
// available on 127.0.0.1 on a random free port.
using BlazorApplicationFactory<Program> host = new BlazorApplicationFactory<Program>();
using BlazorApplicationFactory<Program> host = new();

using IPlaywright playwright = await Playwright.CreateAsync();
await using IBrowser? browser = await playwright.Chromium.LaunchAsync();
Expand All @@ -26,7 +26,7 @@ public async Task Count_Increments_WhenButtonIsClicked()
// that tests will continue working.
IgnoreHTTPSErrors = true,
};

IBrowserContext context = await browser.NewContextAsync(contextOptions);
IPage page = await context.NewPageAsync();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,10 @@ public async Task WeatherForecastTable_LoadsAndDisplaysData_OnPageInitialization
await Page.GotoAsync("weather");

// Act
await Page.WaitForSelectorAsync("h1 >> text=Weather");
await Page.WaitForSelectorAsync("table>tbody>tr");

// Assert
var rows = await Page.Locator("p+table>tbody>tr").CountAsync();
var rows = await Page.Locator("table>tbody>tr").CountAsync();
Assert.That(rows, Is.EqualTo(1));
}
}
3 changes: 1 addition & 2 deletions BlazorTestingAZ.Tests/End2EndTesting/WeatherPageTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,10 @@ public async Task WeatherForecastTable_LoadsAndDisplaysData_OnPageInitialization
await Page.GotoAsync("weather");

// Act
await Page.WaitForSelectorAsync("h1 >> text=Weather");
await Page.WaitForSelectorAsync("table>tbody>tr");

// Assert
var rows = await Page.Locator("p+table>tbody>tr").CountAsync();
var rows = await Page.Locator("table>tbody>tr").CountAsync();
Assert.That(rows, Is.EqualTo(5));
}
}

0 comments on commit 8f32887

Please sign in to comment.