mirror of
https://github.com/tiddly-gittly/TidGi-Desktop.git
synced 2026-03-07 14:30:42 -08:00
* 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
138 lines
12 KiB
Gherkin
138 lines
12 KiB
Gherkin
Feature: Create New Agent Workflow
|
||
As a user
|
||
I want to create a new agent definition using a multi-step wizard
|
||
So that I can customize agents for specific tasks and use them immediately
|
||
|
||
Background:
|
||
Given I add test ai settings
|
||
|
||
@newAgent @mockOpenAI
|
||
Scenario: Create new agent definition and edit prompt and check server request
|
||
# Setup mock OpenAI server first
|
||
Given I have started the mock OpenAI server
|
||
| response | stream |
|
||
| 作为代码助手,我可以帮您解决编程问题。请问需要什么帮助? | false |
|
||
# Launch application after mock server is ready
|
||
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"
|
||
# Ensure we are in the correct workspace before each scenario
|
||
When I click on an "agent workspace button" element with selector "[data-testid='workspace-agent']"
|
||
And I should see a "new tab button" element with selector "[data-tab-id='new-tab-button']"
|
||
# Step 1: Open new tab and navigate to CreateNewAgent
|
||
When I click on "new tab button and create new agent button" elements with selectors:
|
||
| element description | selector |
|
||
| new tab button | [data-tab-id='new-tab-button'] |
|
||
| create new agent button | [data-testid='create-new-agent-button'] |
|
||
# Step 2: Verify first step content (Setup Agent: Name + Template)
|
||
Then I should see "step title and search input and agent name input field" elements with selectors:
|
||
| element description | selector |
|
||
| step title | *:has-text('设置智能体') |
|
||
| search input | .aa-Input |
|
||
| agent name input field | [data-testid='agent-name-input-field'] |
|
||
# Step 3: Select template to advance to step 2
|
||
When I click on a "search input" element with selector ".aa-Input"
|
||
# Wait for autocomplete panel to load with templates (async operation in CI)
|
||
And I should see an "autocomplete panel" element with selector ".aa-Panel"
|
||
# Using description text to select specific agent, more precise than just name
|
||
When I click on a "Example Agent template" element with selector '.aa-Item[role="option"]:has-text("Example agent with prompt processing")'
|
||
# Fill in agent name while still in step 1
|
||
When I clear text in "agent name input" element with selector "[data-testid='agent-name-input-field']"
|
||
When I type "我的代码助手" in "agent name input" element with selector "[data-testid='agent-name-input-field']"
|
||
# Advance to step 2 (Edit Prompt)
|
||
When I click on a "next button" element with selector "[data-testid='next-button']"
|
||
# Step 4: Verify second step content (Edit Prompt) - using text selector as a diagnostic
|
||
And I should see a "edit prompt title" element with selector "h6:has-text('编辑提示词')"
|
||
# Step 4.1: Wait for PromptConfigForm to load
|
||
# Verify the PromptConfigForm is present with our new test id
|
||
And I should see a "prompt config form" element with selector "[data-testid='prompt-config-form']"
|
||
# Step 4.2: Navigate to the correct tab and expand array items to edit prompt
|
||
# Look for tabs in the PromptConfigForm
|
||
And I should see a "config tabs" element with selector "[data-testid='prompt-config-form'] .MuiTabs-root"
|
||
# Click on the first tab, expand array item, and click on the system prompt text field
|
||
When I click on "first config tab and expand array item button and system prompt text field" elements with selectors:
|
||
| element description | selector |
|
||
| first config tab | [data-testid='prompt-config-form'] .MuiTab-root:first-of-type |
|
||
| expand array item button | [data-testid='prompt-config-form'] [role='tabpanel']:not([hidden]) button[title*='展开'], [data-testid='prompt-config-form'] [role='tabpanel']:not([hidden]) button svg[data-testid='ExpandMoreIcon'] |
|
||
| system prompt text field | [data-testid='prompt-config-form'] [role='tabpanel']:not([hidden]) textarea[id*='_text']:not([readonly]) |
|
||
When I clear text in "system prompt text field" element with selector "[data-testid='prompt-config-form'] [role='tabpanel']:not([hidden]) textarea[id*='_text']:not([readonly])"
|
||
When I type "你是一个专业的代码助手,请用中文回答编程问题。" in "system prompt text field" element with selector "[data-testid='prompt-config-form'] [role='tabpanel']:not([hidden]) textarea[id*='_text']:not([readonly])"
|
||
# Step 5: Advance to step 3 (Immediate Use)
|
||
When I click on a "next button" element with selector "[data-testid='next-button']"
|
||
# Step 6: Verify third step content (Immediate Use with chat interface)
|
||
And I should see a "immediate use title" element with selector "*:has-text('测试并使用')"
|
||
# Step 7: Test in the preview chat interface (part of step 3)
|
||
When I click on a "message input textarea" element with selector "[data-testid='agent-message-input']"
|
||
When I type "帮我写个 Hello World" in "chat input" element with selector "[data-testid='agent-message-input']"
|
||
And I press "Enter" key
|
||
# Verify the agent responds in the preview interface
|
||
Then I should see "user message and assistant message" elements with selectors:
|
||
| element description | selector |
|
||
| user message | *:has-text('帮我写个 Hello World') |
|
||
| assistant message | *:has-text('作为代码助手') |
|
||
And the last AI request should contain system prompt "你是一个专业的代码助手,请用中文回答编程问题。"
|
||
# Step 8: Save and start using (after testing in step 3)
|
||
When I click on a "save and use button" element with selector "button:has-text('保存并使用智能体')"
|
||
# Verify agent was created and separate chat tab opened
|
||
Then I should see a "message input box" element with selector "[data-testid='agent-message-input']"
|
||
|
||
@editAgentDefinition @mockOpenAI
|
||
Scenario: Edit existing agent definition workflow
|
||
# Setup mock OpenAI server first
|
||
Given I have started the mock OpenAI server
|
||
| response | stream |
|
||
| 作为已编辑的代码助手,我可以帮您解决编程问题。请问需要什么帮助? | false |
|
||
# Launch application after mock server is ready
|
||
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"
|
||
# Ensure we are in the correct workspace before each scenario
|
||
When I click on an "agent workspace button" element with selector "[data-testid='workspace-agent']"
|
||
And I should see a "new tab button" element with selector "[data-tab-id='new-tab-button']"
|
||
# Step 1: Open new tab to access create default agent card
|
||
When I click on a "new tab button" element with selector "[data-tab-id='new-tab-button']"
|
||
# Step 2: Right-click on create default agent card to open context menu
|
||
When I right-click on a "create default agent card" element with selector "[data-testid='create-default-agent-button']"
|
||
# Step 3: Click on edit definition option in context menu
|
||
When I click on a "edit definition menu item" element with selector "[data-testid='edit-definition-menu-item']"
|
||
# Step 4: Verify direct edit interface (no steps - all content visible)
|
||
And I should see "edit agent title and basic info section and edit prompt section and immediate use section" elements with selectors:
|
||
| element description | selector |
|
||
| edit agent title | *:has-text('编辑智能体定义') |
|
||
| basic info section | *:has-text('编辑基本信息') |
|
||
| edit prompt section | *:has-text('编辑提示词') |
|
||
| immediate use section | *:has-text('测试并使用') |
|
||
# Step 5: Edit agent name in the basic info section
|
||
And I should see a "agent name input" element with selector "[data-testid='edit-agent-name-input']"
|
||
When I clear text in "agent name input" element with selector "[data-testid='edit-agent-name-input-field']"
|
||
When I type "编辑后的示例智能体" in "agent name input" element with selector "[data-testid='edit-agent-name-input-field']"
|
||
# Step 6: Edit the prompt configuration - Wait for PromptConfigForm to load
|
||
# Verify the PromptConfigForm is present
|
||
And I should see a "prompt config form" element with selector "[data-testid='edit-agent-prompt-form']"
|
||
# Step 6.1: Navigate to the correct tab and expand array items to edit prompt
|
||
# Look for tabs in the PromptConfigForm
|
||
And I should see a "config tabs" element with selector "[data-testid='edit-agent-prompt-form'] .MuiTabs-root"
|
||
# Click on the first tab, expand array item, and click on the system prompt text field
|
||
When I click on "first config tab and expand array item button and system prompt text field" elements with selectors:
|
||
| element description | selector |
|
||
| first config tab | [data-testid='edit-agent-prompt-form'] .MuiTab-root:first-of-type |
|
||
| expand array item button | [data-testid='edit-agent-prompt-form'] [role='tabpanel']:not([hidden]) button[title*='展开'], [data-testid='edit-agent-prompt-form'] [role='tabpanel']:not([hidden]) button svg[data-testid='ExpandMoreIcon'] |
|
||
| system prompt text field | [data-testid='edit-agent-prompt-form'] [role='tabpanel']:not([hidden]) textarea[id*='_text']:not([readonly]) |
|
||
When I clear text in "system prompt text field" element with selector "[data-testid='edit-agent-prompt-form'] [role='tabpanel']:not([hidden]) textarea[id*='_text']:not([readonly])"
|
||
When I type "你是一个经过编辑的专业代码助手,请用中文详细回答编程问题。" in "system prompt text field" element with selector "[data-testid='edit-agent-prompt-form'] [role='tabpanel']:not([hidden]) textarea[id*='_text']:not([readonly])"
|
||
# Step 7: Test in the immediate use section (embedded chat)
|
||
# The immediate use section should show an embedded chat interface
|
||
# Find a message input in the immediate use section and test the agent
|
||
When I click on a "message input textarea" element with selector "[data-testid='agent-message-input']"
|
||
When I type "你好,请介绍一下自己" in "chat input" element with selector "[data-testid='agent-message-input']"
|
||
And I press "Enter" key
|
||
# Verify the agent responds in the embedded chat
|
||
Then I should see "user message and assistant message" elements with selectors:
|
||
| element description | selector |
|
||
| user message | *:has-text('你好,请介绍一下自己') |
|
||
| assistant message | *:has-text('已编辑的代码助手') |
|
||
# Verify that the server received the request with the modified system prompt
|
||
And the last AI request should contain system prompt "你是一个经过编辑的专业代码助手,请用中文详细回答编程问题。"
|
||
# Step 8: Save the edited agent definition
|
||
And I should see a "save button" element with selector "[data-testid='edit-agent-save-button']"
|
||
When I click on a "save button" element with selector "[data-testid='edit-agent-save-button']"
|