test: increase timeout in CI

This commit is contained in:
lin onetwo 2025-10-09 02:07:53 +08:00
parent 160179ee2a
commit eff8583a01
2 changed files with 12 additions and 6 deletions

View file

@ -58,7 +58,6 @@ Feature: Agent Workflow - Tool Usage and Multi-Round Conversation
When I click on a "message input textarea" element with selector "[data-testid='agent-message-input']"
When I type " wiki test" in "chat input" element with selector "[data-testid='agent-message-input']"
And I press "Enter" key
And I wait for 0.2 seconds
Then I should see 6 messages in chat history
# Verify there's an error message about workspace not found (in one of the middle messages)
And I should see a "workspace not exist error" element with selector "[data-testid='message-bubble']:has-text('default'):has-text('')"

View file

@ -115,11 +115,18 @@ Then('I should see {int} messages in chat history', async function(this: Applica
const messageSelector = '[data-testid="message-bubble"]';
try {
// Adjust timeouts and attempts for CI vs local runs
const isCI = Boolean(process.env.CI);
const selectorTimeout = isCI ? 15000 : 5000; // wait longer in CI for selector
const waitTimeout = isCI ? 5000 : 2000; // wait between attempts
const attemptsMultiplier = isCI ? 5 : 3;
// Wait for messages to reach expected count, checking periodically for streaming
for (let attempt = 1; attempt <= expectedCount * 3; attempt++) {
const maxAttempts = Math.max(3, expectedCount * attemptsMultiplier);
for (let attempt = 1; attempt <= maxAttempts; attempt++) {
try {
// Wait for at least one message to exist
await currentWindow.waitForSelector(messageSelector, { timeout: 5000 });
await currentWindow.waitForSelector(messageSelector, { timeout: selectorTimeout });
// Count current messages
const messages = currentWindow.locator(messageSelector);
@ -132,11 +139,11 @@ Then('I should see {int} messages in chat history', async function(this: Applica
}
// If not enough messages yet, wait a bit more for streaming
if (attempt < expectedCount * 3) {
await currentWindow.waitForTimeout(2000);
if (attempt < maxAttempts) {
await currentWindow.waitForTimeout(waitTimeout);
}
} catch (timeoutError) {
if (attempt === expectedCount * 3) {
if (attempt === maxAttempts) {
throw timeoutError;
}
}