mirror of
https://github.com/tiddly-gittly/TidGi-Desktop.git
synced 2025-12-05 18:20:39 -08:00
* feat: Skip restart if file system watch is enabled - the watcher will handle file changes automatically * fix: sometimes change sync interval not working fixes #310 * fix: Return false on sync failure - no successful changes were made fixes #558 * fix: step that is wrong * feat: monitoring subwiki * AI added waitForSSEReady * Revert "AI added waitForSSEReady" This reverts commit983b1c623c. * fix: error on frontend loading worker thread * fix * Update wiki.ts * auto reload view and click subwiki icon * Refactor sync echo prevention and improve logging Removed frontend-side echo prevention logic in ipcSyncAdaptor, relying solely on backend file exclusion for echo prevention. Improved console log wrappers to preserve native behavior and added a log statement to setupSSE. Updated test steps and file modification logic to better simulate external edits without modifying timestamps. Added internal documentation on sync architecture. * feat: deboucne and prevent data race when write file * Update watch-filesystem-adaptor.ts * rename camelcase * Update filesystemPlugin.feature * Fix sync interval timezone handling and add tests Refactored syncDebounceInterval logic in Sync.tsx to be timezone-independent, ensuring correct interval storage and display across all timezones. Added comprehensive tests in Sync.timezone.test.ts to verify correct behavior and document previous timezone-related bugs. fixes #310 * i18n for notification * Update index.tsx * fix: potential symlinks problem of subwiki * Update Sync.timezone.test.ts * lint * Implement backoff for file existence check Refactor file existence check to use backoff strategy and add directory tree retrieval for error reporting. * Update BACKOFF_OPTIONS with new configuration * Update wiki.ts * remove log * Update wiki.ts * fix: draft not move to sub * Update filesystemPlugin.feature * fix: routing tw logger to file * Update filesystemPlugin.feature * test: use id to check view load and sse load * Optimize test steps and screenshot logic Removed unnecessary short waits in filesystemPlugin.feature and increased wait time for tiddler state to settle. Updated application.ts to skip screenshots for wait steps, reducing redundant screenshots during test execution. * Check if the WebContents is actually loaded and remove fake webContentsViewHelper.new.ts created by AI * Update view.ts * fix: prevent echo by exclude title * test: Then file "Draft of '新条目'.tid" should not exist in "{tmpDir}/wiki/tiddlers" * Revert "fix: prevent echo by exclude title" This reverts commit86aa838d24. * fix: when move file to subwiki, delete old file * fix: prevent ipc echo change back to frontend * test: view might take longer to load * fix: minor issues * test: fix cleanup timeout * Update cleanup.ts * feat: capture webview screenshot * Update filesystemPlugin.feature * Update SyncArchitecture.md * rename * test: add some time to easy failed steps * Separate logs by test scenario for easier debugging * Update selectors for add and confirm buttons in tests Changed the CSS selectors for the add tiddler and confirm buttons in the filesystem plugin feature tests to use :has() with icon classes. This improves selector robustness and aligns with UI changes. * Ensure window has focus and is ready * Update window.ts * fix: webview screenshot capture prevent mini window to close * fix: Failed to take screenshot: Error: ENAMETOOLONG: name too long, open '/home/runner/work/TidGi-Desktop/TidGi-Desktop/userData-test/logs/screenshots/Agent workflow - Create notes- update embeddings- then search/2025-10-30T11-46-28-891Z-I type -在 wiki 工作区创建一个名为 AI Agent Guide 的笔记-内容是-智能体是一种可以执行任务的AI系统-它可以使用工具-搜索信息并与用户交互- in -chat input- element with selec-PASSED-page.png' * Update window.ts * feat: remove deprecated symlink subwiki approach * Update wiki.ts * fix: remove AI buggy bring window to front cause mini window test to fail * lint * Adjust wait time for draft saving in filesystemPlugin Increased wait time for file system plugin to save draft. * Adjust wait time for tiddler state stabilization Increased wait time to ensure tiddler state settles properly. * Refactor release workflow to simplify dependency installation Removed installation steps for x64 and arm64 dependencies, and adjusted the build process for plugins and native modules. * Enhance wait for IPC in filesystemPlugin feature Added a wait time to improve reliability of content update verification in CI.
216 lines
13 KiB
Gherkin
216 lines
13 KiB
Gherkin
Feature: Filesystem Plugin
|
|
As a user
|
|
I want tiddlers with specific tags to be saved to sub-wikis automatically
|
|
So that I can organize content across wikis
|
|
|
|
Background:
|
|
Given I cleanup test wiki so it could create a new one on start
|
|
And I launch the TidGi application
|
|
And I wait for the page to load completely
|
|
Then I should see a "default wiki workspace" element with selector "div[data-testid^='workspace-']:has-text('wiki')"
|
|
When I click on a "default wiki workspace button" element with selector "div[data-testid^='workspace-']:has-text('wiki')"
|
|
Then the browser view should be loaded and visible
|
|
And I wait for SSE and watch-fs to be ready
|
|
|
|
@file-watching @subwiki
|
|
Scenario: Tiddler with tag saves to sub-wiki folder
|
|
# Create sub-workspace linked to the default wiki
|
|
When I click on an "add workspace button" element with selector "#add-workspace-button"
|
|
And I switch to "addWorkspace" window
|
|
# Toggle to sub-workspace mode by clicking the switch
|
|
And I click on a "main/sub workspace switch" element with selector "[data-testid='main-sub-workspace-switch']"
|
|
# Select the first (default) wiki workspace from dropdown
|
|
And I select "wiki" from MUI Select with test id "main-wiki-select"
|
|
# Type folder name
|
|
And I type "SubWiki" in "sub wiki folder name input" element with selector "input[aria-describedby*='-helper-text'][value='wiki']"
|
|
And I type "TestTag" in "tag name input" element with selector "[data-testid='tagname-autocomplete-input']"
|
|
And I click on a "create sub workspace button" element with selector "button.MuiButton-colorSecondary"
|
|
And I switch to "main" window
|
|
Then I should see a "SubWiki workspace" element with selector "div[data-testid^='workspace-']:has-text('SubWiki')"
|
|
# Wait for main wiki to restart after sub-wiki creation
|
|
Then I wait for main wiki to restart after sub-wiki creation
|
|
Then I wait for view to finish loading
|
|
# Click SubWiki workspace again to ensure TestTag tiddler is displayed
|
|
And I wait for 1 seconds
|
|
When I click on a "SubWiki workspace button" element with selector "div[data-testid^='workspace-']:has-text('SubWiki')"
|
|
And I wait for 1 seconds
|
|
# Verify TestTag tiddler is visible
|
|
And I should see "TestTag" in the browser view content
|
|
# Create tiddler with tag to test file system plugin
|
|
And I click on "add tiddler button" element in browser view with selector "button:has(.tc-image-new-button)"
|
|
# Focus on title input, clear it, and type new title in the draft tiddler
|
|
And I click on "title input" element in browser view with selector "div[data-tiddler-title^='Draft of'] input.tc-titlebar.tc-edit-texteditor"
|
|
And I wait for 0.2 seconds
|
|
And I press "Control+a" in browser view
|
|
And I wait for 0.2 seconds
|
|
And I press "Delete" in browser view
|
|
And I type "TestTiddlerTitle" in "title input" element in browser view with selector "div[data-tiddler-title^='Draft of'] input.tc-titlebar.tc-edit-texteditor"
|
|
# Wait for tiddler state to settle, otherwise it still shows 3 chars (新条目) for a while
|
|
And I wait for 2 seconds
|
|
Then I should see "16 chars" in the browser view content
|
|
# Input tag by typing in the tag input field - use precise selector to target the tag input specifically
|
|
And I click on "tag input" element in browser view with selector "div[data-tiddler-title^='Draft of'] div.tc-edit-add-tag-ui input.tc-edit-texteditor[placeholder='标签名称']"
|
|
And I wait for 0.2 seconds
|
|
And I press "Control+a" in browser view
|
|
And I wait for 0.2 seconds
|
|
And I press "Delete" in browser view
|
|
And I wait for 0.2 seconds
|
|
And I type "TestTag" in "tag input" element in browser view with selector "div[data-tiddler-title^='Draft of'] div.tc-edit-add-tag-ui input.tc-edit-texteditor[placeholder='标签名称']"
|
|
# Click the add tag button to confirm the tag (not just typing)
|
|
And I wait for 0.2 seconds
|
|
And I click on "add tag button" element in browser view with selector "div[data-tiddler-title^='Draft of'] span.tc-add-tag-button button"
|
|
# Wait for file system plugin to save the draft tiddler to SubWiki folder, Even 3 second will randomly failed in next step.
|
|
And I wait for 4.5 seconds
|
|
# Verify the DRAFT tiddler has been routed to sub-wiki immediately after adding the tag
|
|
Then file "Draft of '新条目'.tid" should exist in "{tmpDir}/SubWiki"
|
|
# Verify the draft file is NOT in main wiki tiddlers folder (it should have been moved to SubWiki)
|
|
Then file "Draft of '新条目'.tid" should not exist in "{tmpDir}/wiki/tiddlers"
|
|
# Click confirm button to save the tiddler
|
|
And I click on "confirm button" element in browser view with selector "button:has(.tc-image-done-button)"
|
|
And I wait for 1 seconds
|
|
# Verify the final tiddler file exists in sub-wiki folder after save
|
|
# After confirming the draft, it should be saved as TestTiddlerTitle.tid in SubWiki
|
|
Then file "TestTiddlerTitle.tid" should exist in "{tmpDir}/SubWiki"
|
|
# Test SSE is still working after SubWiki creation - modify a main wiki tiddler
|
|
When I modify file "{tmpDir}/wiki/tiddlers/Index.tid" to contain "Main wiki content modified after SubWiki creation"
|
|
Then I wait for tiddler "Index" to be updated by watch-fs
|
|
# Confirm Index always open
|
|
Then I should see a "Index tiddler" element in browser view with selector "div[data-tiddler-title='Index']"
|
|
Then I should see "Main wiki content modified after SubWiki creation" in the browser view content
|
|
# Test modification in sub-workspace via symlink
|
|
# Modify the tiddler file externally - need to preserve .tid format with metadata
|
|
When I modify file "{tmpDir}/SubWiki/TestTiddlerTitle.tid" to contain "Content modified in SubWiki symlink"
|
|
# Wait for watch-fs to detect the change
|
|
Then I wait for tiddler "TestTiddlerTitle" to be updated by watch-fs
|
|
And I wait for 2 seconds
|
|
# Verify the modified content appears in the wiki
|
|
Then I should see "Content modified in SubWiki symlink" in the browser view content
|
|
|
|
@file-watching
|
|
Scenario: External file creation syncs to wiki
|
|
# Create a test tiddler file directly on filesystem
|
|
When I create file "{tmpDir}/wiki/tiddlers/WatchTestTiddler.tid" with content:
|
|
"""
|
|
created: 20250226070000000
|
|
modified: 20250226070000000
|
|
title: WatchTestTiddler
|
|
|
|
Initial content from filesystem
|
|
"""
|
|
# Wait for watch-fs to detect and add the tiddler
|
|
Then I wait for tiddler "WatchTestTiddler" to be added by watch-fs
|
|
# Open sidebar "最近" tab to see the timeline
|
|
And I click on "sidebar tab" element in browser view with selector "div.tc-tab-buttons.tc-sidebar-tabs-main > button:has-text('最近')"
|
|
# wait for tw animation, sidebar need time to show
|
|
And I wait for 1 seconds
|
|
# Click on the tiddler link in timeline to open it
|
|
And I click on "timeline link" element in browser view with selector "div.tc-timeline a.tc-tiddlylink:has-text('WatchTestTiddler')"
|
|
# Verify the tiddler content is displayed
|
|
Then I should see "Initial content from filesystem" in the browser view content
|
|
|
|
@file-watching
|
|
Scenario: External file modification and deletion sync to wiki
|
|
# Create initial file
|
|
When I create file "{tmpDir}/wiki/tiddlers/TestTiddler.tid" with content:
|
|
"""
|
|
created: 20250226070000000
|
|
modified: 20250226070000000
|
|
title: TestTiddler
|
|
|
|
Original content
|
|
"""
|
|
Then I wait for tiddler "TestTiddler" to be added by watch-fs
|
|
# Open the tiddler to view it
|
|
And I click on "sidebar tab" element in browser view with selector "div.tc-tab-buttons.tc-sidebar-tabs-main > button:has-text('最近')"
|
|
And I wait for 0.5 seconds
|
|
And I click on "timeline link" element in browser view with selector "div.tc-timeline a.tc-tiddlylink:has-text('TestTiddler')"
|
|
And I wait for 0.5 seconds
|
|
Then I should see "Original content" in the browser view content
|
|
# Modify the file externally
|
|
When I modify file "{tmpDir}/wiki/tiddlers/TestTiddler.tid" to contain "Modified content from external editor"
|
|
Then I wait for tiddler "TestTiddler" to be updated by watch-fs
|
|
# Verify the wiki shows updated content (should auto-refresh), need to wait for IPC, it is slow on CI and will randomly failed
|
|
And I wait for 2 seconds
|
|
Then I should see "Modified content from external editor" in the browser view content
|
|
# Now delete the file externally
|
|
When I delete file "{tmpDir}/wiki/tiddlers/TestTiddler.tid"
|
|
Then I wait for tiddler "TestTiddler" to be deleted by watch-fs
|
|
# Re-open timeline to see updated list
|
|
And I click on "sidebar tab" element in browser view with selector "div.tc-tab-buttons.tc-sidebar-tabs-main > button:has-text('最近')"
|
|
# The timeline should not have a clickable link to TestTiddler anymore
|
|
Then I should not see a "TestTiddler timeline link" element in browser view with selector "div.tc-timeline a.tc-tiddlylink:has-text('TestTiddler')"
|
|
|
|
@file-watching
|
|
Scenario: Deleting open tiddler file shows missing tiddler message
|
|
# Delete the Index.tid file while Index tiddler is open (it's open by default)
|
|
When I delete file "{tmpDir}/wiki/tiddlers/Index.tid"
|
|
Then I wait for tiddler "Index" to be deleted by watch-fs
|
|
And I wait for 0.5 seconds
|
|
# Verify the missing tiddler message appears in the tiddler frame
|
|
Then I should see "佚失条目 \"Index\"" in the browser view DOM
|
|
|
|
@file-watching
|
|
Scenario: External file rename syncs to wiki
|
|
# Create initial file
|
|
When I create file "{tmpDir}/wiki/tiddlers/OldName.tid" with content:
|
|
"""
|
|
created: 20250226070000000
|
|
modified: 20250226070000000
|
|
title: OldName
|
|
|
|
Content before rename
|
|
"""
|
|
Then I wait for tiddler "OldName" to be added by watch-fs
|
|
# Open sidebar to see the timeline
|
|
And I click on "sidebar tab" element in browser view with selector "div.tc-tab-buttons.tc-sidebar-tabs-main > button:has-text('最近')"
|
|
And I wait for 0.5 seconds
|
|
And I click on "timeline link" element in browser view with selector "div.tc-timeline a.tc-tiddlylink:has-text('OldName')"
|
|
Then I should see "Content before rename" in the browser view content
|
|
# Rename the file externally
|
|
When I rename file "{tmpDir}/wiki/tiddlers/OldName.tid" to "{tmpDir}/wiki/tiddlers/NewName.tid"
|
|
# Update the title field in the renamed file to match the new filename
|
|
And I modify file "{tmpDir}/wiki/tiddlers/NewName.tid" to contain:
|
|
"""
|
|
created: 20250226070000000
|
|
modified: 20250226070000000
|
|
title: NewName
|
|
|
|
Content before rename
|
|
"""
|
|
# Wait for the new tiddler to be detected and synced
|
|
Then I wait for tiddler "NewName" to be updated by watch-fs
|
|
# Navigate to timeline to verify changes
|
|
And I click on "sidebar tab" element in browser view with selector "div.tc-tab-buttons.tc-sidebar-tabs-main > button:has-text('最近')"
|
|
And I wait for 1 seconds
|
|
# Verify new name appears
|
|
And I click on "timeline link" element in browser view with selector "div.tc-timeline a.tc-tiddlylink:has-text('NewName')"
|
|
Then I should see "Content before rename" in the browser view content
|
|
|
|
@file-watching
|
|
Scenario: External field modification syncs to wiki
|
|
# Modify an existing tiddler file by adding a tags field to TiddlyWikiIconBlue.png
|
|
When I modify file "{tmpDir}/wiki/tiddlers/TiddlyWikiIconBlue.png.tid" to add field "tags: TestTag"
|
|
Then I wait for tiddler "TiddlyWikiIconBlue.png" to be updated by watch-fs
|
|
# Open the tiddler to verify the tag was added
|
|
And I click on "sidebar tab" element in browser view with selector "div.tc-tab-buttons.tc-sidebar-tabs-main > button:has-text('最近')"
|
|
And I wait for 1 seconds
|
|
And I click on "timeline link" element in browser view with selector "div.tc-timeline a.tc-tiddlylink:has-text('TiddlyWikiIconBlue.png')"
|
|
And I wait for 1 seconds
|
|
# Verify the tag appears in the tiddler using data attribute
|
|
Then I should see a "TestTag tag" element in browser view with selector "[data-tiddler-title='TiddlyWikiIconBlue.png'] [data-tag-title='TestTag']"
|
|
# Now modify Index.tid by adding a tags field
|
|
When I modify file "{tmpDir}/wiki/tiddlers/Index.tid" to add field "tags: AnotherTag"
|
|
Then I wait for tiddler "Index" to be updated by watch-fs
|
|
And I wait for 1 seconds
|
|
# Index is displayed by default, verify the AnotherTag appears in Index tiddler
|
|
Then I should see a "AnotherTag tag" element in browser view with selector "[data-tiddler-title='Index'] [data-tag-title='AnotherTag']"
|
|
# Modify favicon.ico.meta file by adding a tags field
|
|
When I modify file "{tmpDir}/wiki/tiddlers/favicon.ico.meta" to add field "tags: IconTag"
|
|
Then I wait for tiddler "favicon.ico" to be updated by watch-fs
|
|
# Navigate to favicon.ico tiddler
|
|
And I click on "sidebar tab" element in browser view with selector "div.tc-tab-buttons.tc-sidebar-tabs-main > button:has-text('最近')"
|
|
And I wait for 0.5 seconds
|
|
And I click on "timeline link" element in browser view with selector "div.tc-timeline a.tc-tiddlylink[href='#favicon.ico']"
|
|
And I wait for 1 seconds
|
|
# Verify the IconTag appears in favicon.ico tiddler
|
|
Then I should see a "IconTag tag" element in browser view with selector "[data-tiddler-title='favicon.ico'] [data-tag-title='IconTag']"
|