mirror of
https://github.com/tiddly-gittly/TidGi-Desktop.git
synced 2026-01-18 23:31:31 -08:00
Introduces a 'Create Default Agent' quick access button in the Agent New Tab page, with localization support. Adds utility to close all tabs and create a default agent tab for fallback scenarios, improves test selectors for tab and close actions, and refactors agent chat tab creation logic for consistency and testability.
103 lines
6.3 KiB
Gherkin
103 lines
6.3 KiB
Gherkin
Feature: Agent Workflow - Tool Usage and Multi-Round Conversation
|
|
As a user
|
|
I want to use an intelligent agent to search wiki content
|
|
So that I can get AI-powered explanations of wiki entries
|
|
|
|
Background:
|
|
Given I have started the mock OpenAI server
|
|
Given 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 to avoid wrong starting state
|
|
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']"
|
|
|
|
@agent
|
|
Scenario: Complete agent workflow with tool usage and multi-round conversation
|
|
# Step 1: Configure AI settings first - Open preferences window, wait a second so its URL settle down.
|
|
When I click on a "settings button" element with selector "#open-preferences-button"
|
|
And I wait for 0.5 seconds
|
|
When I switch to "preferences" window
|
|
|
|
# Step 2: Navigate to External Services section (wait for sidebar animation)
|
|
When I click on an "external services section" element with selector "[data-testid='preference-section-externalAPI']"
|
|
|
|
# Step 3: Add new provider
|
|
When I click on an "add provider button" element with selector "[data-testid='add-new-provider-button']"
|
|
|
|
# Step 4: Fill provider form with mock server details (interface type already selected as openAICompatible)
|
|
When I type "TestProvider" in "provider name input" element with selector "[data-testid='new-provider-name-input']"
|
|
And I type "MOCK_SERVER_URL" in "API endpoint input" element with selector "[data-testid='new-provider-base-url-input']"
|
|
When I click on an "add provider submit" element with selector "[data-testid='add-provider-submit-button']"
|
|
And I wait for 0.2 seconds
|
|
|
|
# Step 5: Select the new provider and add a model
|
|
When I click on a "provider tab" element with selector "button[role='tab']:has-text('TestProvider')"
|
|
When I click on an "add model button" element with selector "[data-testid='add-new-model-button']"
|
|
And I wait for 0.2 seconds
|
|
|
|
# Step 6: Fill model form (simple - just model name)
|
|
When I type "test-model" in "model name input" element with selector "[data-testid='new-model-name-input']"
|
|
When I click on a "save model button" element with selector "[data-testid='save-model-button']"
|
|
And I wait for 0.2 seconds
|
|
|
|
# Step 7: Set default model
|
|
When I type "test-model" in "default model autocomplete" element with selector ".MuiAutocomplete-input"
|
|
And I press "Enter" key
|
|
And I wait for 0.5 seconds
|
|
|
|
# Step 8: Close preferences window
|
|
When I close "preferences" window
|
|
And I switch to "main" window
|
|
And I wait for 0.5 seconds
|
|
|
|
# Step 9: Now proceed with agent workflow in main window
|
|
|
|
# Step 10: Click new tab button
|
|
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"
|
|
|
|
# Step 11: Click search box and wait for 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"
|
|
|
|
# Step 12: Select agent from autocomplete (not new tab)
|
|
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']"
|
|
|
|
# Step 13: Send message to agent - using generic steps combination
|
|
When I click on a "message input textarea" element with selector "[data-testid='agent-message-input']"
|
|
When I type "搜索 wiki 中的 index 条目并解释" in "chat input" element with selector "[data-testid='agent-message-input']"
|
|
And I press "Enter" key
|
|
And I should see a "user message" element with selector "*:has-text('搜索 wiki 中的 index 条目并解释')"
|
|
And I should see a "tool use indicator" element with selector "*:has-text('tool_use')"
|
|
And I should see a "wiki search tool" element with selector "*:has-text('wiki-search')"
|
|
And I should see a "workspace name" element with selector "*:has-text('workspaceName')"
|
|
And I should see a "function result" element with selector "*:has-text('functions_result')"
|
|
And I should see a "tool indicator" element with selector "*:has-text('Tool: wiki-search')"
|
|
Then I should see 4 messages in chat history
|
|
|
|
@agent
|
|
Scenario: Create default agent from New Tab quick access
|
|
# NOTE: Tests must ensure the correct workspace is active before clicking new tab.
|
|
# In CI the app may start in a different workspace; switch to the agent workspace first.
|
|
# This prevents flaky assumptions that the app already opened the desired workspace.
|
|
# Ensure we are in the correct workspace: switch to Agent workspace explicitly to avoid CI flakiness
|
|
When I click on a "new tab button" element with selector "[data-tab-id='new-tab-button']"
|
|
And I wait for 0.2 seconds
|
|
And I should see a "Create Default Agent" element with selector "[data-testid='create-default-agent-button']"
|
|
When I click on a "create default agent button" element with selector "[data-testid='create-default-agent-button']"
|
|
And I should see a "message input box" element with selector "[data-testid='agent-message-input']"
|
|
|
|
@agent
|
|
Scenario: Close all tabs then create default agent from fallback page
|
|
# Ensure starting from black/fallback page with no open tabs
|
|
When I click all "tab" elements matching selector "[data-testid='tab']"
|
|
When I click all "close tab button" elements matching selector "[data-testid='tab-close-button']"
|
|
And I should see a "new tab button" element with selector "[data-tab-id='new-tab-button']"
|
|
# Click the new tab button (fallback UI) and wait briefly for the quick access buttons to render
|
|
When I click on a "new tab button" element with selector "[data-tab-id='new-tab-button']"
|
|
And I wait for 0.2 seconds
|
|
And I should see a "Create Default Agent" element with selector "[data-testid='create-default-agent-button']"
|
|
When I click on a "create default agent button" element with selector "[data-testid='create-default-agent-button']"
|
|
And I should see a "message input box" element with selector "[data-testid='agent-message-input']"
|