TidGi-Desktop/features/defaultWiki.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

140 lines
9 KiB
Gherkin

Feature: TidGi Default Wiki
As a user
I want app auto create a default wiki workspace for me
So that I can start using wiki immediately
Background:
# Note: tests expect the test wiki parent folder to exist. Run the preparation step before E2E:
# cross-env NODE_ENV=test pnpm dlx tsx scripts/developmentMkdir.ts
Given I cleanup test wiki so it could create a new one on start
When I launch the TidGi application
And I wait for the page to load completely
@wiki
Scenario: Application has default wiki workspace
Then I should see "page body and wiki workspace" elements with selectors:
| element description | selector |
| page body | body |
| wiki workspace | div[data-testid^='workspace-']:has-text('wiki') |
And the window title should contain ""
@wiki
Scenario: Default wiki workspace displays TiddlyWiki content in browser view
And the browser view should be loaded and visible
And I should see " TiddlyWiki" in the browser view content
@wiki @create-main-workspace
Scenario: Create new main workspace via UI from top sidebar
# Prerequisite: app starts with default wiki workspace
Then I should see a "default wiki workspace" element with selector "div[data-testid^='workspace-']:has-text('wiki')"
# Clear previous log markers before waiting for new ones
And I clear log lines containing "[test-id-WORKSPACE_CREATED]"
And I clear log lines containing "[test-id-VIEW_LOADED]"
# Step 1: Click add workspace button in top sidebar
When I click on an "add workspace button" element with selector "#add-workspace-button"
And I switch to "addWorkspace" window
And I wait for the page to load completely
# Step 2: Verify we're on "Create New Wiki" tab and main workspace mode
Then I should see "create new wiki tab and main/sub workspace switch" elements with selectors:
| element description | selector |
| create new wiki tab | button:has-text('') |
| main/sub workspace switch | [data-testid='main-sub-workspace-switch'] |
# Step 4: Enter a different wiki folder name (default "wiki" already exists)
# First clear any existing value in the input field
When I clear text in "wiki folder name input" element with selector "label:has-text('') + div input"
# Then type the new folder name
When I type "wiki2" in "wiki folder name input" element with selector "label:has-text('') + div input"
# Step 5: Click the create button to create the workspace
When I click on a "create wiki button" element with selector "button:has-text('')"
# Wait for workspace to be created using log marker
Then I wait for "workspace created" log marker "[test-id-WORKSPACE_CREATED]"
# Switch back to main window
When I switch to "main" window
# Wait for wiki view to fully load
Then I wait for "view loaded" log marker "[test-id-VIEW_LOADED]"
# Step 7: Verify the new workspace appears in the sidebar
Then I should see a "wiki2 workspace" element with selector "div[data-testid^='workspace-']:has-text('wiki2')"
# Step 8: Verify workspace is functional - click it and check browser view loads
When I click on a "wiki2 workspace button" element with selector "div[data-testid^='workspace-']:has-text('wiki2')"
And the browser view should be loaded and visible
# Verify TiddlyWiki content is displayed in the new workspace
Then I should see " TiddlyWiki" in the browser view content
@wiki @root-tiddler
Scenario: Configure root tiddler to use lazy-load and verify content still loads
# Wait for browser view to be fully loaded first
And the browser view should be loaded and visible
And I should see " TiddlyWiki" in the browser view content
# Now modify Index tiddler with unique test content before configuring root tiddler
When I modify file "wiki-test/wiki/tiddlers/Index.tid" to contain "Test content for lazy-all verification after restart"
# before restart, should not see the new content from fs yet (watch-fs is off by default)
And I should not see "Test content for lazy-all verification after restart" in the browser view content
# Update rootTiddler setting via API to use lazy-all, and ensure watch-fs is disabled
When I update workspace "wiki" settings:
| property | value |
| rootTiddler | $:/core/save/lazy-all |
| enableFileSystemWatch | false |
# Wait for config to be written
Then I wait for "config file written" log marker "[test-id-TIDGI_CONFIG_WRITTEN]"
# Restart the workspace to apply the rootTiddler configuration
When I restart workspace "wiki"
# Verify browser view is loaded and visible after restart
And the browser view should be loaded and visible
# Verify Index tiddler element exists (confirms rootTiddler=lazy-all config is applied)
Then I should see a "Index tiddler" element in browser view with selector "div[data-tiddler-title='Index']"
# Verify the actual content is displayed (confirms lazy-all loaded the file content on restart)
And I should see "Test content for lazy-all verification after restart" in the browser view content
@wiki @move-workspace
Scenario: Move workspace to a new location
# Enable file system watch for testing (default is false in production)
When I update workspace "wiki" settings:
| property | value |
| enableFileSystemWatch | true |
When I open edit workspace window for workspace with name "wiki"
And I switch to "editWorkspace" window
And I wait for the page to load completely
When I click on a "save and sync options accordion" element with selector "[data-testid='preference-section-saveAndSyncOptions']"
Then I should see a "move workspace button" element with selector "button:has-text('')"
# Test the actual move operation - this will trigger a file dialog
When I prepare to select directory in dialog "wiki-test-moved"
And I click on a "move workspace button" element with selector "button:has-text('')"
Then I wait for log markers:
| description | marker |
| workspace moved to wiki-test-moved | [test-id-WORKSPACE_MOVED: |
| workspace restarted after move | [test-id-WORKSPACE_RESTARTED_AFTER_MOVE: |
| watch-fs stabilized after restart | [test-id-WATCH_FS_STABILIZED] |
| SSE ready after restart | [test-id-SSE_READY] |
| view loaded | [test-id-VIEW_LOADED] |
# Verify the workspace was moved to the new location
Then file "wiki/tiddlywiki.info" should exist in "wiki-test-moved"
# Switch back to main window to interact with wiki
Then I switch to "main" window
# Verify Index tiddler is displayed (confirms view is loaded)
Then I should see a "Index tiddler" element in browser view with selector "div[data-tiddler-title='Index']"
# Verify the wiki is working by modifying a file in the new location
When I modify file "wiki-test-moved/wiki/tiddlers/Index.tid" to contain "Content after moving workspace"
Then I wait for tiddler "Index" to be updated by watch-fs
# The content check will automatically wait for IPC to sync
And I should see "Content after moving workspace" in the browser view content
# Move it back to original location for cleanup
# Clear test-id markers to ensure we're waiting for fresh logs from second restart
When I clear test-id markers from logs
And I switch to "editWorkspace" window
When I prepare to select directory in dialog "wiki-test"
And I click on a "move workspace button" element with selector "button:has-text('')"
Then I wait for log markers:
| description | marker |
| workspace moved back to wiki-test | [test-id-WORKSPACE_MOVED: |
| workspace restarted after move back | [test-id-WORKSPACE_RESTARTED_AFTER_MOVE: |
| watch-fs stabilized after restart back | [test-id-WATCH_FS_STABILIZED] |
| SSE ready after restart back | [test-id-SSE_READY] |
| view loaded after restart back | [test-id-VIEW_LOADED] |
Then file "wiki/tiddlywiki.info" should exist in "wiki-test"
# Switch to main window and wait for view to be ready
Then I switch to "main" window
# Verify the wiki still works after moving back
When I modify file "wiki-test/wiki/tiddlers/Index.tid" to contain "Content after moving back"
Then I wait for tiddler "Index" to be updated by watch-fs
# The content check will automatically wait for IPC to sync
And I should see "Content after moving back" in the browser view content