refactor: replace fragile CSS selectors in SidebarTab.ts and SettingDialog.ts

Amp-Thread-ID: https://ampcode.com/threads/T-019c1359-48cc-7676-abc8-2de8c57b52cf
Co-authored-by: Amp <amp@ampcode.com>
This commit is contained in:
Alexander Brown
2026-01-31 01:26:28 -08:00
parent e193924a36
commit 062c4d3964
2 changed files with 20 additions and 18 deletions

View File

@@ -1,6 +1,7 @@
import type { Page } from '@playwright/test'
import type { ComfyPage } from '../ComfyPage'
import { TestIds } from '../selectors'
export class SettingDialog {
constructor(
@@ -9,12 +10,12 @@ export class SettingDialog {
) {}
get root() {
return this.page.locator('div.settings-container')
return this.page.getByTestId(TestIds.dialogs.settings)
}
async open() {
await this.comfyPage.executeCommand('Comfy.ShowSettingsDialog')
await this.page.waitForSelector('div.settings-container')
await this.root.waitFor({ state: 'visible' })
}
/**
@@ -41,8 +42,9 @@ export class SettingDialog {
}
async goToAboutPanel() {
const aboutButton = this.page.locator('li[aria-label="About"]')
await aboutButton.click()
await this.page.waitForSelector('div.about-container')
await this.page.getByTestId('settings-tab-about').click()
await this.page
.getByTestId(TestIds.dialogs.about)
.waitFor({ state: 'visible' })
}
}