-
Notifications
You must be signed in to change notification settings - Fork 490
test: deflake templates locale coverage #7705
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
1c46de5
2533f0d
8cf725b
72799fc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -109,22 +109,27 @@ test.describe('Templates', () => { | |
| }) | ||
|
|
||
| test('Uses proper locale files for templates', async ({ comfyPage }) => { | ||
| // Load the templates dialog and wait for the French index file request | ||
| const requestPromise = comfyPage.page.waitForRequest( | ||
| '**/templates/index.fr.json' | ||
| ) | ||
|
|
||
| // Set locale to French before opening templates | ||
| await comfyPage.setSetting('Comfy.Locale', 'fr') | ||
|
|
||
| await comfyPage.executeCommand('Comfy.BrowseTemplates') | ||
|
|
||
| const request = await requestPromise | ||
| const dialog = comfyPage.page.getByRole('dialog').filter({ | ||
| has: comfyPage.page.getByRole('heading', { name: 'Modèles', exact: true }) | ||
| }) | ||
| await expect(dialog).toBeVisible() | ||
|
|
||
| // Verify French index was requested | ||
| expect(request.url()).toContain('templates/index.fr.json') | ||
| // Validate that French-localized strings from the templates index are rendered | ||
| await expect( | ||
| dialog.getByRole('heading', { name: 'Modèles', exact: true }) | ||
| ).toBeVisible() | ||
| await expect( | ||
| dialog.getByRole('button', { name: 'Tous les modèles', exact: true }) | ||
| ).toBeVisible() | ||
|
|
||
| await expect(comfyPage.templates.content).toBeVisible() | ||
| // Ensure the English fallback copy is not shown anywhere | ||
| await expect( | ||
| comfyPage.page.getByText('All Templates', { exact: true }) | ||
| ).toHaveCount(0) | ||
| }) | ||
|
Comment on lines
111
to
133
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick | 🔵 Trivial Excellent improvement to test reliability! The approach of validating rendered French UI strings is much more robust than waiting on network requests. The dialog filtering by heading "Modèles" and use of specific role-based selectors with Optional: Scope the negative assertion to the dialog for consistency. Lines 122-127 correctly scope positive assertions to the 🔎 Proposed refinement // Ensure the English fallback copy is not shown anywhere
await expect(
- comfyPage.page.getByText('All Templates', { exact: true })
+ dialog.getByText('All Templates', { exact: true })
).toHaveCount(0)This ensures the test only validates the dialog content (as stated in the PR objectives) and prevents false negatives if "All Templates" appears elsewhere on the page (e.g., in navigation or menus). 🤖 Prompt for AI Agents |
||
|
|
||
| test('Falls back to English templates when locale file not found', async ({ | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.