TidGi-Desktop/features/tiddler.feature
lin onetwo c53292b548
Fix/misc bug2 (#689)
* Improve IPC sync and multi-window browser views

Add robust revision tracking and per-title save serialization to the IPC sync adaptor to ignore stale SSE echoes and prevent overlapping saves (titlesBeingSaved, lastSavedRevisions, pendingSaveOperations, queueSaveOperation, markSaveStart/Finish). Ensure deletions and loads update stored revisions. Disable backgroundThrottling for BrowserWindow/WebContentsView so renderer callbacks (SSE/observables) continue while windows/views are hidden. Update webContents view helpers and step definitions to target a specific window/page (pass Page/currentWindow through executeInBrowserView, getTextContent, click/type/press helpers), and improve view selection by matching target window URL. Update docs to document hidden-window behavior and revision filtering, and add/update feature tests for cross-window sync, hidden TidGi mini window sync, and a rapid-save tiddler scenario.

* Handle main workspace routing for tiddlers

Adjust FileSystemAdaptor routing so that when a tiddler matches the main workspace it uses the main watch path (watchPathBase) instead of treating it as a sub-wiki folder. Add an isMainWorkspaceMatch check to pick the correct target directory and to avoid generating sub-wiki file info for the main workspace.

Also update tests and feature file: extend subWiki.feature to verify routing to the main workspace path when the workspace has a routing tag configured, and add unit tests to assert routing to the main wiki tiddlers folder and to the wiki root when useWikiFolderAsTiddlersPath is enabled.

* review

* v0.13.0-prerelease22
2026-03-24 18:28:38 +08:00

64 lines
5.3 KiB
Gherkin

Feature: Tiddler Creation and Editing
As a user
I want to create and edit tiddlers in the wiki
So that I can manage my content
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 backend ready" log marker "[test-id-SSE_READY]"
@tiddler @tiddler-create
Scenario: Create a new tiddler with tag and custom field via UI
# These are micro steps of `When I create a tiddler "MyTestTiddler" with field "customfield" set to "customvalue" in browser view` and `When I create a tiddler "MyTestTiddler" with tag "MyTestTag" in browser view`
# Click add tiddler button and focus title input
And I click on "add tiddler button and title input" elements in browser view with selectors:
| element description | selector |
| add tiddler button | button:has(.tc-image-new-button) |
| title input | div[data-tiddler-title^='Draft of'] input.tc-titlebar.tc-edit-texteditor |
And I press "Control+a" in browser view
And I press "Delete" in browser view
And I type "MyTestTiddler" in "title input" element in browser view with selector "div[data-tiddler-title^='Draft of'] input.tc-titlebar.tc-edit-texteditor"
# Add a tag
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 type "MyTestTag" 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='']"
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"
# Add a custom field
And I click on "add field name input" element in browser view with selector "div[data-tiddler-title^='Draft of'] .tc-edit-field-add-name-wrapper input"
And I type "customfield" in "add field name input" element in browser view with selector "div[data-tiddler-title^='Draft of'] .tc-edit-field-add-name-wrapper input"
And I click on "add field value input" element in browser view with selector "div[data-tiddler-title^='Draft of'] .tc-edit-field-add-value input"
And I type "customvalue" in "add field value input" element in browser view with selector "div[data-tiddler-title^='Draft of'] .tc-edit-field-add-value input"
And I click on "add field button and confirm button" elements in browser view with selectors:
| element description | selector |
| add field button | div[data-tiddler-title^='Draft of'] .tc-edit-field-add button |
| confirm button | button:has(.tc-image-done-button) |
# Verify the tiddler and tag were created
Then I should see "MyTestTiddler tiddler and MyTestTag tag" elements in browser view with selectors:
| element description | selector |
| MyTestTiddler tiddler | div[data-tiddler-title='MyTestTiddler'] |
| MyTestTag tag | [data-tiddler-title='MyTestTiddler'] [data-tag-title='MyTestTag'] |
# Verify the tiddler file was created
Then file "MyTestTiddler.tid" should exist in "{tmpDir}/wiki/tiddlers"
@tiddler @tiddler-draft-rapid-save
Scenario: Rapid typing and immediate save should not lose characters
# Test case for: user types quickly, then immediately saves via the done button without waiting.
# This scenario verifies that the revision tracking and save serialization prevent
# earlier echo revisions from overwriting the latest typed content.
# Click add tiddler button to create a draft
When I click on "add tiddler button" element in browser view with selector "button:has(.tc-image-new-button)"
# Get into title field and clear any default text
And I click on "title input" element in browser view with selector "div[data-tiddler-title^='Draft of'] input.tc-titlebar.tc-edit-texteditor"
# Type quickly without pauses - this tests the rapid input scenario
# The title field should be pre-selected, so we can type directly
And I type "RapidSaveTiddler" in "title input" element in browser view with selector "div[data-tiddler-title^='Draft of'] input.tc-titlebar.tc-edit-texteditor"
# Click the done button immediately without waiting for auto-save
And I click on "confirm button" element in browser view with selector "button:has(.tc-image-done-button)"
# Verify the tiddler was created with the full title (no lost characters)
Then I should see a "RapidSaveTiddler tiddler" element in browser view with selector "div[data-tiddler-title='RapidSaveTiddler']"
# Verify the file was created with correct content
Then file "RapidSaveTiddler.tid" should exist in "{tmpDir}/wiki/tiddlers"