-
Notifications
You must be signed in to change notification settings - Fork 37
Expand file tree
/
Copy pathSectionCreateFolderDialog.ts
More file actions
30 lines (24 loc) · 1023 Bytes
/
SectionCreateFolderDialog.ts
File metadata and controls
30 lines (24 loc) · 1023 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/*!
* SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: MIT
*/
import type { Locator, Page } from '@playwright/test'
import { expect } from '@playwright/test'
export class SectionCreateFolderDialog {
public readonly dialogLocator: Locator
public readonly buttonCreateFolder: Locator
public readonly inputFolderName: Locator
constructor(public readonly page: Page) {
this.dialogLocator = page.getByRole('dialog', { name: 'Create new folder' })
this.buttonCreateFolder = this.dialogLocator.getByRole('button', { name: /Create/i })
this.inputFolderName = this.dialogLocator.getByRole('textbox', { name: /Folder name/i })
}
public async createFolder(folderName: string): Promise<this> {
const response = this.page.waitForResponse((res) => res.request().method() === 'MKCOL')
await this.inputFolderName.fill(folderName)
await expect(this.buttonCreateFolder).not.toBeDisabled()
await this.buttonCreateFolder.click()
await response
return this
}
}