mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-05-23 06:10:32 +00:00
test: trim unused assets sidebar locators
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user