-
Notifications
You must be signed in to change notification settings - Fork 492
Replace QPO with opening assets tab #8260
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
8c74a03
9fb11a1
fd07245
7609554
f8dfaa3
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 |
|---|---|---|
|
|
@@ -12,7 +12,10 @@ import type { | |
| JobListItem, | ||
| JobStatus | ||
| } from '@/platform/remote/comfyui/jobs/jobTypes' | ||
| import { useSettingStore } from '@/platform/settings/settingStore' | ||
| import { useCommandStore } from '@/stores/commandStore' | ||
| import { TaskItemImpl, useQueueStore } from '@/stores/queueStore' | ||
| import { useSidebarTabStore } from '@/stores/workspace/sidebarTabStore' | ||
| import { isElectron } from '@/utils/envUtil' | ||
|
|
||
| const mockData = vi.hoisted(() => ({ isLoggedIn: false })) | ||
|
|
@@ -33,7 +36,7 @@ vi.mock('@/stores/firebaseAuthStore', () => ({ | |
| })) | ||
| })) | ||
|
|
||
| function createWrapper() { | ||
| function createWrapper(pinia = createTestingPinia({ createSpy: vi.fn })) { | ||
| const i18n = createI18n({ | ||
| legacy: false, | ||
| locale: 'en', | ||
|
|
@@ -53,7 +56,7 @@ function createWrapper() { | |
|
|
||
| return mount(TopMenuSection, { | ||
| global: { | ||
| plugins: [createTestingPinia({ createSpy: vi.fn }), i18n], | ||
| plugins: [pinia, i18n], | ||
| stubs: { | ||
| SubgraphBreadcrumb: true, | ||
| QueueProgressOverlay: true, | ||
|
|
@@ -142,6 +145,71 @@ describe('TopMenuSection', () => { | |
| expect(queueButton.text()).toContain('3 active') | ||
| }) | ||
|
|
||
| it('hides queue progress overlay when QPO V2 is enabled', async () => { | ||
| const pinia = createTestingPinia({ createSpy: vi.fn }) | ||
| const settingStore = useSettingStore(pinia) | ||
| vi.mocked(settingStore.get).mockImplementation((key) => | ||
| key === 'Comfy.Queue.QPOV2' ? true : undefined | ||
| ) | ||
| const wrapper = createWrapper(pinia) | ||
|
|
||
| await nextTick() | ||
|
|
||
| expect(wrapper.find('[data-testid="queue-overlay-toggle"]').exists()).toBe( | ||
| true | ||
| ) | ||
| expect( | ||
| wrapper.findComponent({ name: 'QueueProgressOverlay' }).exists() | ||
| ).toBe(false) | ||
| }) | ||
|
|
||
| it('toggles the queue progress overlay when QPO V2 is disabled', async () => { | ||
| const pinia = createTestingPinia({ createSpy: vi.fn, stubActions: false }) | ||
| const settingStore = useSettingStore(pinia) | ||
| vi.mocked(settingStore.get).mockImplementation((key) => | ||
| key === 'Comfy.Queue.QPOV2' ? false : undefined | ||
| ) | ||
| const wrapper = createWrapper(pinia) | ||
| const commandStore = useCommandStore(pinia) | ||
|
|
||
| await wrapper.find('[data-testid="queue-overlay-toggle"]').trigger('click') | ||
|
|
||
| expect(commandStore.execute).toHaveBeenCalledWith( | ||
| 'Comfy.Queue.ToggleOverlay' | ||
| ) | ||
| }) | ||
|
|
||
| it('opens the assets sidebar tab when QPO V2 is enabled', async () => { | ||
| const pinia = createTestingPinia({ createSpy: vi.fn, stubActions: false }) | ||
| const settingStore = useSettingStore(pinia) | ||
| vi.mocked(settingStore.get).mockImplementation((key) => | ||
| key === 'Comfy.Queue.QPOV2' ? true : undefined | ||
| ) | ||
| const wrapper = createWrapper(pinia) | ||
| const sidebarTabStore = useSidebarTabStore(pinia) | ||
|
|
||
| await wrapper.find('[data-testid="queue-overlay-toggle"]').trigger('click') | ||
|
|
||
| expect(sidebarTabStore.activeSidebarTabId).toBe('assets') | ||
| }) | ||
|
|
||
| it('toggles the assets sidebar tab when QPO V2 is enabled', async () => { | ||
| const pinia = createTestingPinia({ createSpy: vi.fn, stubActions: false }) | ||
| const settingStore = useSettingStore(pinia) | ||
| vi.mocked(settingStore.get).mockImplementation((key) => | ||
| key === 'Comfy.Queue.QPOV2' ? true : undefined | ||
| ) | ||
| const wrapper = createWrapper(pinia) | ||
| const sidebarTabStore = useSidebarTabStore(pinia) | ||
| const toggleButton = wrapper.find('[data-testid="queue-overlay-toggle"]') | ||
|
Comment on lines
+189
to
+204
|
||
|
|
||
| await toggleButton.trigger('click') | ||
| expect(sidebarTabStore.activeSidebarTabId).toBe('assets') | ||
|
|
||
| await toggleButton.trigger('click') | ||
| expect(sidebarTabStore.activeSidebarTabId).toBe(null) | ||
| }) | ||
|
|
||
| it('disables the clear queue context menu item when no queued jobs exist', () => { | ||
| const wrapper = createWrapper() | ||
| const menu = wrapper.findComponent({ name: 'ContextMenu' }) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧹 Nitpick | 🔵 Trivial
Consider using default stubbed actions for this test.
This test uses
stubActions: false, but since you're only verifying thatexecutewas called (not testing the command's actual behavior), the default stubbed actions would be sufficient and simpler. The current approach works because the component doesn't awaitcommandStore.execute, but it could be cleaner.Suggested simplification
📝 Committable suggestion
🤖 Prompt for AI Agents