Files
ComfyUI_frontend/browser_tests/fixtures/components/BottomPanel.ts
Alexander Brown 959e91bf4d test: add BottomPanel page object for E2E tests
Extract repeated locators into BottomPanel and ShortcutsTab page objects.

Refactor bottomPanelShortcuts.spec.ts and menu.spec.ts to use the new page object.

Amp-Thread-ID: https://ampcode.com/threads/T-019c167b-dacb-706c-9626-4a31a1f6ab6e
Co-authored-by: Amp <amp@ampcode.com>
2026-01-31 16:05:37 -08:00

36 lines
1.1 KiB
TypeScript

import type { Locator, Page } from '@playwright/test'
class ShortcutsTab {
readonly essentialsTab: Locator
readonly viewControlsTab: Locator
readonly manageButton: Locator
readonly keyBadges: Locator
readonly subcategoryTitles: Locator
constructor(readonly page: Page) {
this.essentialsTab = page.getByRole('tab', { name: /Essential/i })
this.viewControlsTab = page.getByRole('tab', { name: /View Controls/i })
this.manageButton = page.getByRole('button', { name: /Manage Shortcuts/i })
this.keyBadges = page.locator('.key-badge')
this.subcategoryTitles = page.locator('.subcategory-title')
}
}
export class BottomPanel {
readonly root: Locator
readonly keyboardShortcutsButton: Locator
readonly toggleButton: Locator
readonly shortcuts: ShortcutsTab
constructor(readonly page: Page) {
this.root = page.locator('.bottom-panel')
this.keyboardShortcutsButton = page.getByRole('button', {
name: /Keyboard Shortcuts/i
})
this.toggleButton = page.getByRole('button', {
name: /Toggle Bottom Panel/i
})
this.shortcuts = new ShortcutsTab(page)
}
}