TidGi-Desktop/features/aiCommitMessage.feature
lin onetwo 1cd266d8fe test: implement scenario isolation for E2E tests
- Isolate each test scenario in test-artifacts/{scenarioSlug}/ directory
- Use dynamic ports for mock OpenAI server to avoid port conflicts
- Log VIEW_LOADED event via did-finish-load in main process (more reliable)
- Search all .log files when waiting for log markers
- Increase timeout for log marker steps to 15 seconds
- Fix ts-node cache issues by clearing cache before tests
- Move application launch to individual scenarios (required for mock server setup)

All 45 E2E test scenarios now pass consistently.
2026-01-17 01:19:53 +08:00

56 lines
3.5 KiB
Gherkin
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

Feature: AI-Generated Git Commit Messages
As a user
I want AI to automatically generate commit messages
So that I can have meaningful backup titles based on my changes
@git @mockOpenAI
Scenario: AI generates commit message based on file changes
Given I cleanup test wiki so it could create a new one on start
Given I add test ai settings:
| freeModel | true |
| aiGenerateBackupTitle | true |
# Start mock server BEFORE launching the application
And I have started the mock OpenAI server
| response | stream |
| Index AI | false |
# Now launch the application
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')"
# Enable file system watch for testing (default is false in production)
When I update workspace "wiki" settings:
| property | value |
| enableFileSystemWatch | true |
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
And I wait for "git initialization" log marker "[test-id-git-init-complete]"
# Modify a file to create changes
When I modify file "{tmpDir}/wiki/tiddlers/Index.tid" to contain "AI-generated commit message test content"
Then I wait for tiddler "Index" to be updated by watch-fs
And I wait for 3 seconds for "git to detect file changes"
# Open Git Log window to commit using the button
When I click menu " > "
And I switch to "gitHistory" window
And I wait for the page to load completely
# Should see uncommitted changes row
Then I should see a "uncommitted changes row" element with selector "[data-testid='uncommitted-changes-row']"
# Click on the uncommitted changes row
When I click on a "uncommitted changes row" element with selector "[data-testid='uncommitted-changes-row']"
# Verify we can see the modified Index.tid file
Then I should see a "Index.tid file in uncommitted list" element with selector "li:has-text('Index.tid')"
# Switch to Actions tab
When I click on a "actions tab" element with selector "button[role='tab']:has-text(''), button[role='tab']:has-text('Actions')"
# Verify the commit now button is visible
Then I should see a "commit now button" element with selector "button[data-testid='commit-now-button']"
# Click the commit now button - this will trigger AI generation
When I click on a "commit now button" element with selector "button[data-testid='commit-now-button']"
Then I wait for "git commit completed" log marker "[test-id-git-commit-complete]"
# Wait for git log data to be updated and rendered to DOM
Then I wait for "git log data rendered to DOM" log marker "[test-id-git-log-data-rendered]"
# After commit, verify AI-generated message and file in git log table
# Message is in p.MuiTypography-body2, file div has aria-label
Then I should see "commit with AI message and Index.tid file" elements with selectors:
| element description | selector |
| commit with AI message | p.MuiTypography-body2:has-text(' Index ') |
| Index.tid file | div.MuiBox-root[aria-label*='Index.tid'] |