This commit is contained in:
2026-07-18 15:21:20 -04:00
parent 6062d5b60c
commit 74f065e0f5
51 changed files with 634 additions and 285 deletions
+4 -3
View File
@@ -15,7 +15,7 @@ public abstract class AuthenticatedPageTest : PageTest
public async Task SignIn()
{
// Use a browser with a UI as requested
await Context.Tracing.StartAsync(new()
await Context.Tracing.StartAsync(new TracingStartOptions
{
Title = TestContext.CurrentContext.Test.ClassName + "." + TestContext.CurrentContext.Test.Name,
Screenshots = true,
@@ -36,9 +36,10 @@ public abstract class AuthenticatedPageTest : PageTest
[TearDown]
public async Task TearDown()
{
await Context.Tracing.StopAsync(new()
await Context.Tracing.StopAsync(new TracingStopOptions
{
Path = Path.Combine(TestContext.CurrentContext.WorkDirectory, "playwright-traces", $"{TestContext.CurrentContext.Test.ClassName}.{TestContext.CurrentContext.Test.Name}.zip")
Path = Path.Combine(TestContext.CurrentContext.WorkDirectory, "playwright-traces",
$"{TestContext.CurrentContext.Test.ClassName}.{TestContext.CurrentContext.Test.Name}.zip")
});
}
}
+12 -7
View File
@@ -20,18 +20,23 @@ public class AgentsPage : BasePage
public async Task WaitForInteractiveAsync()
{
await Page.WaitForLoadStateAsync(LoadState.DOMContentLoaded);
try {
try
{
// Wait for the grid container with a much longer timeout for Telerik initialization
await Page.WaitForSelectorAsync(".agents-page", new PageWaitForSelectorOptions { Timeout = 30_000, State = WaitForSelectorState.Visible });
await Page.WaitForSelectorAsync(".agents-page",
new PageWaitForSelectorOptions { Timeout = 30_000, State = WaitForSelectorState.Visible });
// Wait for the actual Telerik Grid to be rendered and populated
await Page.WaitForSelectorAsync(".k-grid", new PageWaitForSelectorOptions { Timeout = 30_000, State = WaitForSelectorState.Visible });
} catch (System.Exception ex) {
await Page.WaitForSelectorAsync(".k-grid",
new PageWaitForSelectorOptions { Timeout = 30_000, State = WaitForSelectorState.Visible });
}
catch (Exception ex)
{
var content = await Page.ContentAsync();
var title = await Page.TitleAsync();
var url = Page.Url;
System.Console.WriteLine($"[DEBUG_LOG] FAILED to find Agents Grid. Error: {ex.Message}");
System.Console.WriteLine($"[DEBUG_LOG] URL: {url}, Title: {title}");
System.Console.WriteLine("[DEBUG_LOG] Page Content length: " + content.Length);
Console.WriteLine($"[DEBUG_LOG] FAILED to find Agents Grid. Error: {ex.Message}");
Console.WriteLine($"[DEBUG_LOG] URL: {url}, Title: {title}");
Console.WriteLine("[DEBUG_LOG] Page Content length: " + content.Length);
throw;
}
}
+3 -3
View File
@@ -8,14 +8,14 @@ public class DecksPage : BasePage
{
}
public ILocator DeckCards => Page.Locator(".deck-card");
public ILocator CreateDeckButton => Page.Locator(".btn-create-deck");
public async Task GotoAsync()
{
await NavigateToAsync("/decks");
}
public ILocator DeckCards => Page.Locator(".deck-card");
public ILocator CreateDeckButton => Page.Locator(".btn-create-deck");
public async Task WaitForInteractiveAsync()
{
await Page.WaitForLoadStateAsync(LoadState.DOMContentLoaded);
+11 -6
View File
@@ -21,14 +21,18 @@ public class SyndicatesPage : BasePage
public async Task WaitForInteractiveAsync()
{
await Page.WaitForLoadStateAsync(LoadState.DOMContentLoaded);
try {
try
{
await Page.WaitForSelectorAsync(".pairing-card", new PageWaitForSelectorOptions { Timeout = 15_000 });
} catch (System.Exception) {
}
catch (Exception)
{
var content = await Page.ContentAsync();
var title = await Page.TitleAsync();
var url = Page.Url;
System.Console.WriteLine($"[DEBUG_LOG] FAILED to find .pairing-card. URL: {url}, Title: {title}");
System.Console.WriteLine("[DEBUG_LOG] Page Content snippet: " + (content.Length > 2000 ? content.Substring(0, 2000) : content));
Console.WriteLine($"[DEBUG_LOG] FAILED to find .pairing-card. URL: {url}, Title: {title}");
Console.WriteLine("[DEBUG_LOG] Page Content snippet: " +
(content.Length > 2000 ? content.Substring(0, 2000) : content));
throw;
}
}
@@ -41,6 +45,7 @@ public class SyndicatesPage : BasePage
public async Task CloseDialogAsync()
{
await DialogCloseButton.ClickAsync();
await Page.WaitForSelectorAsync(".card-detail", new PageWaitForSelectorOptions { State = WaitForSelectorState.Hidden });
await Page.WaitForSelectorAsync(".card-detail",
new PageWaitForSelectorOptions { State = WaitForSelectorState.Hidden });
}
}
}
+3 -5
View File
@@ -1,6 +1,4 @@
using System.Text.RegularExpressions;
using Microsoft.Playwright;
using Microsoft.Playwright.NUnit;
using Tests.PageObjects;
namespace Tests;
@@ -9,14 +7,14 @@ namespace Tests;
[TestFixture]
public class SyndicateTests : AuthenticatedPageTest
{
private SyndicatesPage _syndicatesPage;
[SetUp]
public void Setup()
{
_syndicatesPage = new SyndicatesPage(Page);
}
private SyndicatesPage _syndicatesPage;
[Test]
public async Task SyndicatesPage_ShouldOpenDialogOnPairingClick()
{
@@ -62,4 +60,4 @@ public class SyndicateTests : AuthenticatedPageTest
await _syndicatesPage.CloseDialogAsync();
await Expect(_syndicatesPage.SyndicateDialog).ToBeHiddenAsync();
}
}
}