From b74c31941f55f3ec6ae987ebfced5c3ef719f6cd Mon Sep 17 00:00:00 2001 From: Benjamin Lu Date: Mon, 11 May 2026 17:03:40 -0700 Subject: [PATCH] test: trim unused assets sidebar locators --- .../fixtures/components/SidebarTab.ts | 41 ++----------------- browser_tests/tests/sidebar/assets.spec.ts | 6 +-- 2 files changed, 7 insertions(+), 40 deletions(-) diff --git a/browser_tests/fixtures/components/SidebarTab.ts b/browser_tests/fixtures/components/SidebarTab.ts index 4dc5b6457d..a12a008e85 100644 --- a/browser_tests/fixtures/components/SidebarTab.ts +++ b/browser_tests/fixtures/components/SidebarTab.ts @@ -297,7 +297,6 @@ export class AssetsSidebarTab extends SidebarTab { public readonly sortFastestFirst: Locator public readonly assetCards: Locator public readonly selectedCards: Locator - public readonly listViewItems: Locator public readonly selectionFooter: Locator public readonly selectionCountButton: Locator public readonly deselectAllButton: Locator @@ -337,7 +336,6 @@ export class AssetsSidebarTab extends SidebarTab { .getByRole('button') .and(this.root.locator('[data-selected]')) this.selectedCards = this.root.locator('[data-selected="true"]') - this.listViewItems = this.root.getByRole('button', { name: /asset$/i }) this.selectionFooter = this.root.locator('..').getByRole('toolbar', { name: 'Selected asset actions' }) @@ -383,6 +381,10 @@ export class AssetsSidebarTab extends SidebarTab { ) } + listViewItem(name: string) { + return this.root.getByRole('button').filter({ hasText: name }).first() + } + contextMenuItem(label: string) { return this.page.locator('.p-contextmenu').getByText(label) } @@ -391,14 +393,6 @@ export class AssetsSidebarTab extends SidebarTab { return this.contextMenuItem(label) } - async showGenerated() { - await this.switchToGenerated() - } - - async showImported() { - await this.switchToImported() - } - async search(query: string) { await this.searchInput.fill(query) } @@ -429,33 +423,6 @@ export class AssetsSidebarTab extends SidebarTab { await this.contextMenuAction(actionName).click() } - async openAssetPreview(name: string) { - const asset = this.asset(name) - await asset.hover() - - const zoomButton = asset.getByLabel('Zoom in') - if (await zoomButton.isVisible().catch(() => false)) { - await zoomButton.click() - return - } - - await asset.dblclick() - } - - async openOutputFolder(name: string) { - await this.asset(name) - .getByRole('button', { name: 'See more outputs' }) - .click() - - await this.backToAssetsButton.waitFor({ state: 'visible' }) - } - - async toggleStack(name: string) { - await this.asset(name) - .getByRole('button', { name: 'See more outputs' }) - .click() - } - async selectAssets(names: string[]) { if (names.length === 0) { return diff --git a/browser_tests/tests/sidebar/assets.spec.ts b/browser_tests/tests/sidebar/assets.spec.ts index cadd23d6ae..1fdb763c98 100644 --- a/browser_tests/tests/sidebar/assets.spec.ts +++ b/browser_tests/tests/sidebar/assets.spec.ts @@ -276,8 +276,8 @@ test.describe('Assets sidebar - view mode toggle', () => { await tab.openSettingsMenu() await tab.listViewOption.click() - // List view items should now be visible - await expect(tab.listViewItems.first()).toBeVisible() + // List view should render the existing asset row. + await expect(tab.listViewItem('landscape.png')).toBeVisible() }) test('Can switch back to grid view', async ({ comfyPage }) => { @@ -288,7 +288,7 @@ test.describe('Assets sidebar - view mode toggle', () => { // Switch to list view await tab.openSettingsMenu() await tab.listViewOption.click() - await expect(tab.listViewItems.first()).toBeVisible() + await expect(tab.listViewItem('landscape.png')).toBeVisible() // Switch back to grid view (settings popover is still open) await tab.gridViewOption.click()