diff options
author | Grail Finder (aider) <wohilas@gmail.com> | 2025-04-05 14:37:59 +0300 |
---|---|---|
committer | Grail Finder (aider) <wohilas@gmail.com> | 2025-04-05 14:37:59 +0300 |
commit | 9318da8d804848c327ff0a76dc044fd2106fe566 (patch) | |
tree | 3b379c9c617a6db6d48adf3ad093a14aa7c2c8ff | |
parent | 5673577dd44026093aab623c3faf10adfca94879 (diff) |
perf: reduce test timeouts for lightweight site
-rw-r--r-- | internal/handlers/handlers_test.go | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/internal/handlers/handlers_test.go b/internal/handlers/handlers_test.go index 3258cd8..eef9f85 100644 --- a/internal/handlers/handlers_test.go +++ b/internal/handlers/handlers_test.go @@ -29,8 +29,8 @@ func TestQuestionFlow(t *testing.T) { // Test 1: Load page and verify question _, err = page.Goto(serverURL, playwright.PageGotoOptions{ - WaitUntil: playwright.WaitUntilStateNetworkidle, - Timeout: playwright.Float(3000), + WaitUntil: playwright.WaitUntilStateDomcontentloaded, + Timeout: playwright.Float(2000), }) assert.NoError(err, "Failed to load page") @@ -45,15 +45,17 @@ func TestQuestionFlow(t *testing.T) { assert.NoError(err, "Failed to get question text") assert.Contains(questionText, "Zweifel", "Question text mismatch") - // Set longer timeout for CI environments - page.SetDefaultTimeout(10000) + // Set reasonable timeout for light site + page.SetDefaultTimeout(2000) // Verify options using test IDs for i := 1; i <= 4; i++ { testID := fmt.Sprintf("option%d", i) locator := page.Locator(fmt.Sprintf("[data-testid='%s']", testID)) visible, err := locator.IsVisible() - assert.NoError(err, "Failed to check visibility for option %d", i) + if err != nil { + assert.FailNowf("Option check failed", "Option %d: %v", i, err) + } assert.True(visible, "Option %d not visible", i) } |