mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-20 14:30:41 +00:00
## Summary Adds e2e Save As tests for #10679. Refactors tests to remove getByX and other locators in tests to instead be in fixtures. ## Changes - **What**: - extract app mode fixtures - add test ids where required - add new tests ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-10680-test-refactor-App-mode-Refactor-Save-As-tests-3316d73d3650815b9d49ccfbb6d54416) by [Unito](https://www.unito.io)
70 lines
1.5 KiB
TypeScript
70 lines
1.5 KiB
TypeScript
import type { Locator, Page } from '@playwright/test'
|
|
|
|
import type { ComfyPage } from '../ComfyPage'
|
|
import { TestIds } from '../selectors'
|
|
|
|
export class BuilderFooterHelper {
|
|
constructor(private readonly comfyPage: ComfyPage) {}
|
|
|
|
private get page(): Page {
|
|
return this.comfyPage.page
|
|
}
|
|
|
|
get nav(): Locator {
|
|
return this.page.getByTestId(TestIds.builder.footerNav)
|
|
}
|
|
|
|
get exitButton(): Locator {
|
|
return this.buttonByName('Exit app builder')
|
|
}
|
|
|
|
get nextButton(): Locator {
|
|
return this.buttonByName('Next')
|
|
}
|
|
|
|
get backButton(): Locator {
|
|
return this.buttonByName('Back')
|
|
}
|
|
|
|
get saveButton(): Locator {
|
|
return this.page.getByTestId(TestIds.builder.saveButton)
|
|
}
|
|
|
|
get saveAsButton(): Locator {
|
|
return this.page.getByTestId(TestIds.builder.saveAsButton)
|
|
}
|
|
|
|
get saveAsChevron(): Locator {
|
|
return this.page.getByTestId(TestIds.builder.saveAsChevron)
|
|
}
|
|
|
|
get opensAsPopover(): Locator {
|
|
return this.page.getByTestId(TestIds.builder.opensAs)
|
|
}
|
|
|
|
private buttonByName(name: string): Locator {
|
|
return this.nav.getByRole('button', { name })
|
|
}
|
|
|
|
async next() {
|
|
await this.nextButton.click()
|
|
await this.comfyPage.nextFrame()
|
|
}
|
|
|
|
async back() {
|
|
await this.backButton.click()
|
|
await this.comfyPage.nextFrame()
|
|
}
|
|
|
|
async exitBuilder() {
|
|
await this.exitButton.click()
|
|
await this.comfyPage.nextFrame()
|
|
}
|
|
|
|
async openSaveAsFromChevron() {
|
|
await this.saveAsChevron.click()
|
|
await this.page.getByRole('menuitem', { name: 'Save as' }).click()
|
|
await this.comfyPage.nextFrame()
|
|
}
|
|
}
|