TidGi-Desktop/features/streamingStatus.feature
lin onetwo a712b2ff51
Fix/misc bug (#679)
* Create ErrorDuringRelease.md

* Enforce test timeouts and add root tiddler scenario

Set global and step timeouts to 5s (local) and 10s (CI) across cucumber config and step definitions to standardize test execution times. Add a new scenario to verify root tiddler configuration and content loading after restart. Enhance start-e2e-app script to accept or auto-detect test scenario names and pass them to the app.

* Improve error handling for window and view initialization

Enhanced error reporting and handling when browser windows are not ready or fail to register in windowService. Updated focus logic to dynamically retrieve the current browser window, improving reliability during workspace hibernation and wake-up scenarios.

* Remove AfterAll hook and add --exit to e2e tests

Eliminates the AfterAll hook that forced process exit in cleanup.ts to prevent hanging after tests. Adds the --exit flag to the cucumber-js command in the e2e test script to ensure proper test process termination.

* Add step to restart workspace in wiki tests

Introduces a new step definition 'I restart workspace {string}' to programmatically restart a wiki workspace during tests. Updates the root tiddler scenario to use this step for verifying lazy-load behavior after workspace restart, improving test reliability and clarity.

* Centralize and standardize E2E test timeouts

Extracted timeout values into features/supports/timeouts.ts and replaced hardcoded timeouts in step definitions with named constants. This ensures consistent timeout handling across local and CI environments, reduces duplication, and clarifies intent. Also improved workspace update logic to check watch-fs state before restart and cleaned up related log marker handling.

* Improve i18n coverage and add Windows installer log access

Expanded and unified i18n keys for error messages and UI labels across multiple languages. Refactored code to remove hardcoded default values from translation calls. Added a Developer Tools option to open the Windows installer log folder (SquirrelTemp) when running on Windows. Introduced a placeholder file to preserve dynamic i18n keys for error messages.

* Initialize Tidgi mini window before workspace views

Moved the initialization of the Tidgi mini window to occur before initializing all workspace views in main.ts to ensure correct view creation. Added a clarifying comment in DeveloperTools.tsx regarding the SquirrelSetup.log path.

* Refactor Tidgi mini window initialization logic

Tidgi mini window creation now only creates the window; view creation is deferred to initializeAllWorkspaceView. Updated related comments and logging for clarity. Also fixed formatting in French translations and improved documentation for error handling during release.

* Add model feature chips to model selection UI

Introduces a ModelFeatureChip component to visually display model features in the model selector and new model dialog. Updates defaultProviders to include new models with features, and enhances the UI to show feature chips for each model, improving clarity for users selecting models.

* Add image attachment support to chat messages

This update enables users to attach image files to chat messages, including UI changes for file selection and preview, backend persistence of attachments, and prompt concatenation logic to include images in AI requests. It also adds error handling and i18n for model vision support, updates message rendering to display images, and improves logging and API validation for vision-capable models.

* Improve streaming status handling for agent messages

Adds a failsafe to clear streaming status when an agent reaches a terminal state and refines logic to prevent marking completed messages as streaming. Also updates message stream completion in AgentInstanceService to ensure proper cleanup and delivery of IPC messages. Includes new feature tests for message streaming status and image upload scenarios.

* Add cross-window sync feature and test steps

Introduces a new feature file for cross-window synchronization scenarios. Adds step definitions to open workspaces in new windows and execute TiddlyWiki code programmatically. Removes obsolete wiki.ts.backup file and updates agentActions for related actions.

* feat(sync): fix cross-window synchronization via SSE

- Remove overly aggressive echo prevention in backend that blocked all SSE updates
- Backend now forwards all wiki change events to subscribers
- Add comprehensive cross-window sync tests verifying bidirectional updates
- Test main->new window sync and new->main window sync scenarios
- Version bump to 0.13.0-prerelease19

* Improve file attachment handling in chat and tests

Refactors file input handling in chat tests to use Playwright's setInputFiles, updates message sending types to support optional file attachments, and enhances file metadata persistence and logging. Adjusts test expectations and UI logic to better handle and display image attachments, and clarifies combobox value assertions in ExternalAPI tests.

* Add file input validation and improve i18n messages

Added image type and size validation (10MB limit) to file input in InputContainer. Improved image preview logic. Updated French, Japanese, and Russian translations with new error messages for missing/default model and vision support. Enhanced type safety in promptConcatWithImage tests and messagePersistence logging. Fixed race condition in ExternalAPIService lazy initialization. Updated CommitDetailsPanel to use common cancel translation key.

* review

* Update browserView.ts

* Update timeouts.ts

* Update cucumber.config.js

* Update cucumber.config.js

* Move global timeout config to separate module

Extracted global timeout setup from cucumber.config.js to features/supports/timeout-config.ts using setDefaultTimeout. This ensures the timeout is set via code rather than config, improving clarity and maintainability.

* Update newAgent.feature
2026-01-26 02:43:27 +08:00

105 lines
5.6 KiB
Gherkin

Feature: Message Streaming Status
As a user
I want the send button to return to normal state after AI completes
So that I can send multiple messages consecutively
Background:
Given I add test ai settings
And I have started the mock OpenAI server without rules
Then I launch the TidGi application
And I wait for the page to load completely
And I should see a "page body" element with selector "body"
# Navigate to agent workspace
And I click on "agent workspace button and new tab button" elements with selectors:
| element description | selector |
| agent workspace | [data-testid='workspace-agent'] |
| new tab button | [data-tab-id='new-tab-button'] |
@agent @mockOpenAI @streamingStatus
Scenario: Send button returns to normal state after AI response completes
# Add mock response
Given I add mock OpenAI responses:
| response | stream |
| First reply | false |
| Second reply | false |
| Third reply | false |
# Open agent chat
When I click on a "new tab button" element with selector "[data-tab-id='new-tab-button']"
And I should see a "search interface" element with selector ".aa-Autocomplete"
When I click on a "search input box" element with selector ".aa-Input"
And I should see an "autocomplete panel" element with selector ".aa-Panel"
When I click on an "agent suggestion" element with selector '[data-autocomplete-source-id="agentsSource"] .aa-ItemWrapper'
And I should see a "message input box" element with selector "[data-testid='agent-message-input']"
# Send first message
When I click on a "message input textarea" element with selector "[data-testid='agent-message-input']"
When I type "First message" in "chat input" element with selector "[data-testid='agent-message-input']"
And I press "Enter" key
Then I should see 2 messages in chat history
# Verify send button is in normal state (not streaming)
# The send icon should be visible and cancel icon should not be visible
And I should see a "send button icon" element with selector "[data-testid='send-icon']"
And I should not see a "cancel button icon" element with selector "[data-testid='cancel-icon']"
# Send second message to confirm button works
When I type "Second message" in "chat input" element with selector "[data-testid='agent-message-input']"
And I press "Enter" key
Then I should see 4 messages in chat history
# Verify send button is still in normal state
And I should see a "send button icon" element with selector "[data-testid='send-icon']"
And I should not see a "cancel button icon" element with selector "[data-testid='cancel-icon']"
# Send third message to triple confirm
When I type "Third message" in "chat input" element with selector "[data-testid='agent-message-input']"
And I press "Enter" key
Then I should see 6 messages in chat history
# Final verification
And I should see a "send button icon" element with selector "[data-testid='send-icon']"
And I should not see a "cancel button icon" element with selector "[data-testid='cancel-icon']"
@agent @mockOpenAI @streamingStatus @imageUpload
Scenario: Image upload streaming status and history verification
# Add mock responses
Given I add mock OpenAI responses:
| response | stream |
| Received image and text | false |
| Received second message | false |
# Open agent chat
When I click on a "new tab button" element with selector "[data-tab-id='new-tab-button']"
And I should see a "search interface" element with selector ".aa-Autocomplete"
When I click on a "search input box" element with selector ".aa-Input"
And I should see an "autocomplete panel" element with selector ".aa-Panel"
When I click on an "agent suggestion" element with selector '[data-autocomplete-source-id="agentsSource"] .aa-ItemWrapper'
And I should see a "message input box" element with selector "[data-testid='agent-message-input']"
# Set file directly to the hidden file input using Playwright
When I set file "template/wiki/files/TiddlyWikiIconBlack.png" to file input with selector "input[type='file']"
# Verify image preview appears
Then I should see an "attachment preview" element with selector "[data-testid='attachment-preview']"
# Send message with image
When I click on a "message input textarea" element with selector "[data-testid='agent-message-input']"
When I type "Describe this image" in "chat input" element with selector "[data-testid='agent-message-input']"
And I press "Enter" key
Then I should see 2 messages in chat history
# Verify image appears in chat history
And I should see a "message image attachment" element with selector "[data-testid='message-image-attachment']"
# Verify send button returned to normal after first message
And I should see a "send button icon" element with selector "[data-testid='send-icon']"
And I should not see a "cancel button icon" element with selector "[data-testid='cancel-icon']"
# Send second message to check history includes image
When I type "Continue" in "chat input" element with selector "[data-testid='agent-message-input']"
And I press "Enter" key
Then I should see 4 messages in chat history
# Verify send button is still normal after second message
And I should see a "send button icon" element with selector "[data-testid='send-icon']"
And I should not see a "cancel button icon" element with selector "[data-testid='cancel-icon']"