Skip to content

Commit

Permalink
Add playwright test
Browse files Browse the repository at this point in the history
  • Loading branch information
huchenlei committed Nov 5, 2024
1 parent b4a2b79 commit 24dd8de
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
8 changes: 8 additions & 0 deletions browser_tests/fixtures/components/Topbar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,14 @@ export class Topbar {
await this.page.waitForTimeout(300)
}

async saveWorkflowAs(workflowName: string) {
await this.triggerTopbarCommand(['Workflow', 'Save As'])
await this.page.locator('.p-dialog-content input').fill(workflowName)
await this.page.keyboard.press('Enter')
// Wait for the dialog to close.
await this.page.waitForTimeout(300)
}

async triggerTopbarCommand(path: string[]) {
if (path.length < 2) {
throw new Error('Path is too short')
Expand Down
13 changes: 13 additions & 0 deletions browser_tests/menu.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,19 @@ test.describe('Menu', () => {
)
})

test('Can save workflow as', async ({ comfyPage }) => {
await comfyPage.menu.workflowsTab.newBlankWorkflowButton.click()
await comfyPage.menu.topbar.saveWorkflowAs('workflow3.json')
expect(
await comfyPage.menu.workflowsTab.getOpenedWorkflowNames()
).toEqual(['*Unsaved Workflow.json', 'workflow3.json'])

await comfyPage.menu.topbar.saveWorkflowAs('workflow4.json')
expect(
await comfyPage.menu.workflowsTab.getOpenedWorkflowNames()
).toEqual(['*Unsaved Workflow.json', 'workflow3.json', 'workflow4.json'])
})

test('Does not report warning when switching between opened workflows', async ({
comfyPage
}) => {
Expand Down

0 comments on commit 24dd8de

Please sign in to comment.