mirror of
https://github.com/tiddly-gittly/TidGi-Desktop.git
synced 2026-05-11 14:54:36 -07:00
* fix: hide non-wiki workspaces from menu and disable remove for them (#694) * fix(workspace): make workspace settings save transactional to prevent data loss - Move disk write before memory update in Workspace.set() - Remove error swallowing in writeTidgiConfig() to let errors propagate - Add error handling in useForm.ts to catch and log save failures - Add UI error display in EditWorkspace/index.tsx - Only update Observable after successful persistence This fixes the issue where save button disappears but changes aren't persisted to tidgi.config.json, causing data loss when reopening settings. * feat(i18n): add error messages for workspace save failures Add SaveError and SaveErrorPrefix translations in English and Chinese to display error messages when workspace settings fail to save. * test(e2e): add test for tagNames persistence and missing step definitions - Add @edit-workspace-save-tagnames scenario to verify tagNames persist after save to tidgi.config.json - Add 'I clear and type' step definition for clearing input before typing - Add 'I close current window' step definition for closing windows - This test covers the regression where save button disappears but changes aren't persisted * use 5.4.0 * fix: spaced file in git op * fix: menu register race condition * Update pnpm-lock.yaml * Update wiki * fix: regenerate lockfile with pnpm 10.33.0 to fix checksum format * fix: remove unused import and useless constructor * fix: address Copilot review comments - Use new path for rename/copy in git operations - Ensure transactional workspace save (persist before cache update) - Normalize null label to undefined in menu * Remove close-window step; simplify UI typing Remove the Cucumber step that closed the current window and simplify a UI step by calling locator.fill(...) inline (also replace {tmpDir} in the input). Clean up minor whitespace in gitOperations and fix indentation/extra brace around startWiki error handling in the wiki service to correct control flow and prevent accidental scope issues. * Improve workspace form, git diff, and UI tests Refactor EditWorkspace form and UI behavior, make git diff/status handling more robust, and update E2E tests. - Add hasConfigChanges and related effects in useForm to correctly detect config-only changes and control restart requests; fix save button visibility in EditWorkspace and pass currentWorkspace to restart snackbar. Rename workspace section test id from 'workspace-section-search' to 'preference-section-search'. - Enhance gitOperations.getFileDiff to use porcelain -z and a helper to parse per-path status (getPorcelainStatusForPath) for reliable untracked/deleted detection. - Add clickBrowserViewElementWithRetry helper with backoff and text-aware selector handling; replace repetitive click logic in browser view step definitions and remove some redundant browser background assertions and a deprecated clear-and-type step. - Update feature files (gitLog, editWorkspace, vectorSearch) to reflect selector/id/name changes and i18n fallbacks for tab/button text. * doc * Use localized draft selector and show e2e window Update feature tests to target the localized draft tiddler title (data-tiddler-title$='的草稿') instead of the English prefix selector. Applied the change across features/hibernation.feature and features/tiddler.feature to ensure selectors match localized UI. Also enable SHOW_E2E_WINDOW=1 in the test:manual-e2e script in package.json so manual end-to-end runs open a visible window for debugging.
47 lines
3 KiB
Gherkin
47 lines
3 KiB
Gherkin
@edit-workspace-save
|
|
Feature: Edit Workspace
|
|
As a user
|
|
I want to edit workspace settings
|
|
|
|
Background:
|
|
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
|
|
Then I should see a "default wiki workspace" element with selector "div[data-testid^='workspace-']:has-text('wiki')"
|
|
# Open edit workspace window
|
|
When I open edit workspace window for workspace with name "wiki"
|
|
And I switch to "editWorkspace" window
|
|
|
|
@edit-workspace-save-http-api
|
|
Scenario: Save button disappears after enabling HTTP API and restarting wiki
|
|
# Server section is always visible (no accordion). Click sidebar to scroll to it, then toggle the switch.
|
|
When I click on "server section sidebar and enableHTTPAPI switch and save button" elements with selectors:
|
|
| element description | selector |
|
|
| server section sidebar btn | [data-testid='preference-section-server'] |
|
|
| enableHTTPAPI switch | [data-testid='enable-http-api-switch'] |
|
|
| save button | [data-testid='edit-workspace-save-button'] |
|
|
Then I should not see a "save button" element with selector "[data-testid='edit-workspace-save-button']"
|
|
Then I should see a "restart snackbar with restart button" element with selector "button:has-text('现在重启知识库')"
|
|
# Clear RESTARTING marker to catch the new restart event
|
|
And I clear log lines containing "[test-id-WIKI_WORKER_RESTARTING]"
|
|
# Click the restart button in the snackbar (still in editWorkspace window)
|
|
When I click on a "restart now button in snackbar" element with selector "button:has-text('现在重启知识库')"
|
|
# Wait for wiki worker restart to begin - RESTARTING marker is logged immediately when restart starts
|
|
Then I wait for "wiki worker restart initiated" log marker "[test-id-WIKI_WORKER_RESTARTING]"
|
|
# Save button should STILL be hidden after restart completes
|
|
# This tests that the workspace state doesn't diverge after restart, not triggered by fields like `lastUrl`
|
|
Then I should not see a "save button after restart" element with selector "[data-testid='edit-workspace-save-button']"
|
|
Then settings.json should have workspace "wiki" with "enableHTTPAPI" set to "true"
|
|
|
|
@edit-workspace-save-tagnames
|
|
Scenario: tagNames syncable config is persisted to tidgi.config.json
|
|
# This scenario verifies the persistence path for syncable tagNames fields.
|
|
# It intentionally updates the workspace through the service API instead of the EditWorkspace UI.
|
|
When I update workspace "wiki" settings:
|
|
| property | value |
|
|
| tagNames | ["Tag1","Tag2"] |
|
|
Then I wait for "config file written" log marker "[test-id-TIDGI_CONFIG_WRITTEN]"
|
|
Then file "wiki/tidgi.config.json" should exist in "wiki-test"
|
|
Then file "wiki/tidgi.config.json" should contain JSON with:
|
|
| jsonPath | value |
|
|
| $.tagNames | Tag1,Tag2 |
|