Skip to content

Commit

Permalink
Add Playwright test
Browse files Browse the repository at this point in the history
  • Loading branch information
christian-byrne committed Sep 29, 2024
1 parent 480f944 commit 20423a3
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
4 changes: 4 additions & 0 deletions browser_tests/ComfyPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,10 @@ class Topbar {
.allInnerTexts()
}

async openSubmenuMobile() {
await this.page.locator('.p-menubar-mobile').click()
}

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

test.describe('Topbar submmenus', () => {
test('@mobile Items fully visible on mobile screen width', async ({
comfyPage
}) => {
await comfyPage.menu.topbar.openSubmenuMobile()
const topLevelMenuItem = comfyPage.page
.locator('a.p-menubar-item-link')
.first()
const isTextCutoff = await topLevelMenuItem.evaluate((el) => {
return el.scrollWidth > el.clientWidth
})
expect(isTextCutoff).toBe(false)
})
})

// Only test 'Top' to reduce test time.
// ['Bottom', 'Top']
;['Top'].forEach(async (position) => {
Expand Down

0 comments on commit 20423a3

Please sign in to comment.