From ad4324a692f623314d6b1ff81983a8d9dc6f9fa2 Mon Sep 17 00:00:00 2001 From: "Grail Finder (aider)" Date: Sat, 5 Apr 2025 14:41:35 +0300 Subject: fix: update test selectors and template error handling --- internal/handlers/handlers_test.go | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'internal/handlers/handlers_test.go') diff --git a/internal/handlers/handlers_test.go b/internal/handlers/handlers_test.go index d177239..a74be30 100644 --- a/internal/handlers/handlers_test.go +++ b/internal/handlers/handlers_test.go @@ -35,15 +35,18 @@ func TestQuestionFlow(t *testing.T) { }) assert.NoError(err, "Failed to load page") - // Wait for question to appear - err = page.Locator(".question-text").WaitFor(playwright.LocatorWaitForOptions{ + // Wait for main content to load + err = page.Locator("body").WaitFor(playwright.LocatorWaitForOptions{ State: playwright.WaitForSelectorStateVisible, - Timeout: playwright.Float(1000), + Timeout: playwright.Float(2000), }) - assert.NoError(err, "Question text did not appear") + assert.NoError(err, "Page content did not load") - questionText, err := page.Locator(".question-text").TextContent() - assert.NoError(err, "Failed to get question text") + // Verify question text exists + questionText, err := page.Locator("[data-testid='question']").TextContent() + if err != nil { + assert.FailNow("Question text not found", err) + } assert.Contains(questionText, "Zweifel", "Question text mismatch") // Set reasonable timeout for light site -- cgit v1.2.3