mirror of
https://github.com/AutoMaker-Org/automaker.git
synced 2026-02-02 20:43:36 +00:00
refactor: improve test stability and clarity in various test cases
- Updated the 'Add Context Image' test to simplify file verification by relying on UI visibility instead of disk checks. - Enhanced the 'Feature Manual Review Flow' test with better project setup and API interception to ensure consistent test conditions. - Improved the 'AI Profiles' test by replacing arbitrary timeouts with dynamic checks for profile count. - Refined the 'Project Creation' and 'Open Existing Project' tests to ensure proper project visibility and settings management during tests. - Added mechanisms to prevent settings hydration from restoring previous project states, ensuring tests run in isolation. - Removed unused test image from fixtures to clean up the repository.
This commit is contained in:
@@ -28,6 +28,9 @@ test.describe('AI Profiles', () => {
|
||||
await waitForNetworkIdle(page);
|
||||
await navigateToProfiles(page);
|
||||
|
||||
// Get initial custom profile count (may be 0 or more due to server settings hydration)
|
||||
const initialCount = await countCustomProfiles(page);
|
||||
|
||||
await clickNewProfileButton(page);
|
||||
|
||||
await fillProfileForm(page, {
|
||||
@@ -42,7 +45,15 @@ test.describe('AI Profiles', () => {
|
||||
|
||||
await waitForSuccessToast(page, 'Profile created');
|
||||
|
||||
const customCount = await countCustomProfiles(page);
|
||||
expect(customCount).toBe(1);
|
||||
// Wait for the new profile to appear in the list (replaces arbitrary timeout)
|
||||
// The count should increase by 1 from the initial count
|
||||
await expect(async () => {
|
||||
const customCount = await countCustomProfiles(page);
|
||||
expect(customCount).toBe(initialCount + 1);
|
||||
}).toPass({ timeout: 5000 });
|
||||
|
||||
// Verify the count is correct (final assertion)
|
||||
const finalCount = await countCustomProfiles(page);
|
||||
expect(finalCount).toBe(initialCount + 1);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user