nextcloud/tests/playwright/support/sections/FilesSidebarPage.ts
Peter Ringelmann 87f8d78424 test(files): migrate favorites e2e from Cypress to Playwright
Signed-off-by: Peter Ringelmann <peter.ringelmann@nextcloud.com>
2026-06-10 12:09:32 +02:00

33 lines
921 B
TypeScript

/*
* SPDX-FileCopyrightText: 2026 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
import type { Locator, Page } from '@playwright/test'
export class FilesSidebarPage {
constructor(private readonly page: Page) {}
sidebar(): Locator {
return this.page.locator('#app-sidebar-vue')
}
heading(name: string): Locator {
return this.sidebar().getByRole('heading', { name })
}
/**
* Open the sidebar "Actions" menu and click the entry with the given name
* (e.g. "Favorite" / "Unfavorite").
*/
async triggerAction(name: string): Promise<void> {
await this.sidebar().getByRole('button', { name: 'Actions' }).click()
const action = this.page.getByRole('menuitem', { name })
await action.waitFor({ state: 'visible' })
await action.click()
}
async close(): Promise<void> {
await this.sidebar().getByRole('button', { name: 'Close sidebar' }).click()
}
}