test(playwright): seed inside try in Notification stuck/pagination tests for guaranteed cleanup (review fix)
This commit is contained in:
+18
-16
@@ -310,17 +310,18 @@ public class NotificationActionTests
|
||||
var runId = Guid.NewGuid().ToString("N");
|
||||
var marker = $"zztest-notif-wave4-{runId}";
|
||||
|
||||
// Genuinely-stuck row: Retrying + back-dated 15 min (> the 10-min StuckAgeThreshold).
|
||||
await NotificationDataSeeder.InsertNotificationAsync(
|
||||
Guid.NewGuid(), marker, "wave4-stuck",
|
||||
status: "Retrying", createdAt: DateTimeOffset.UtcNow.AddMinutes(-15),
|
||||
sourceSite: "site-a");
|
||||
// Non-stuck row: Parked @ now (terminal-ish status + fresh timestamp → not stuck).
|
||||
await NotificationDataSeeder.InsertParkedNotificationAsync(
|
||||
Guid.NewGuid(), marker, "wave4-fresh", "site-a");
|
||||
|
||||
try
|
||||
{
|
||||
// Genuinely-stuck row: Retrying + back-dated 15 min (> the 10-min StuckAgeThreshold).
|
||||
// Seeded inside the try so a mid-seed failure is still cleaned up by the finally.
|
||||
await NotificationDataSeeder.InsertNotificationAsync(
|
||||
Guid.NewGuid(), marker, "wave4-stuck",
|
||||
status: "Retrying", createdAt: DateTimeOffset.UtcNow.AddMinutes(-15),
|
||||
sourceSite: "site-a");
|
||||
// Non-stuck row: Parked @ now (Parked is a terminal status → never stuck, regardless of age).
|
||||
await NotificationDataSeeder.InsertParkedNotificationAsync(
|
||||
Guid.NewGuid(), marker, "wave4-fresh", "site-a");
|
||||
|
||||
var page = await _fixture.NewAuthenticatedPageAsync();
|
||||
await page.GotoAsync($"{PlaywrightFixture.BaseUrl}{NotificationReportUrl}");
|
||||
await page.WaitForLoadStateAsync(LoadState.NetworkIdle);
|
||||
@@ -385,15 +386,16 @@ public class NotificationActionTests
|
||||
var runId = Guid.NewGuid().ToString("N");
|
||||
var marker = $"zztest-notif-wave4-{runId}";
|
||||
|
||||
// 51 Parked rows under one marker → 2 pages (50 + 1); the pager renders (> 50).
|
||||
for (int i = 0; i < 51; i++)
|
||||
{
|
||||
await NotificationDataSeeder.InsertParkedNotificationAsync(
|
||||
Guid.NewGuid(), marker, $"wave4-page-{i:D2}", "site-a");
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
// 51 Parked rows under one marker → 2 pages (50 + 1); the pager renders (> 50).
|
||||
// Seeded inside the try so a mid-seed failure is still cleaned up by the finally.
|
||||
for (int i = 0; i < 51; i++)
|
||||
{
|
||||
await NotificationDataSeeder.InsertParkedNotificationAsync(
|
||||
Guid.NewGuid(), marker, $"wave4-page-{i:D2}", "site-a");
|
||||
}
|
||||
|
||||
var page = await _fixture.NewAuthenticatedPageAsync();
|
||||
await page.GotoAsync($"{PlaywrightFixture.BaseUrl}{NotificationReportUrl}");
|
||||
await page.WaitForLoadStateAsync(LoadState.NetworkIdle);
|
||||
|
||||
Reference in New Issue
Block a user