Files
payloadcms/test/helpers/folders/createFolderDoc.ts
Jarrod Flesch 12539c61d4 feat(ui): supports collection scoped folders (#12797)
As discussed in [this
RFC](https://github.com/payloadcms/payload/discussions/12729), this PR
supports collection-scoped folders. You can scope folders to multiple
collection types or just one.

This unlocks the possibility to have folders on a per collection instead
of always being shared on every collection. You can combine this feature
with the `browseByFolder: false` to completely isolate a collection from
other collections.

Things left to do:
- [x] ~~Create a custom react component for the selecting of
collectionSlugs to filter out available options based on the current
folders parameters~~


https://github.com/user-attachments/assets/14cb1f09-8d70-4cb9-b1e2-09da89302995


---
- To see the specific tasks where the Asana app for GitHub is being
used, see below:
  - https://app.asana.com/0/0/1210564397815557
2025-07-17 13:24:22 -04:00

27 lines
717 B
TypeScript

import { expect, type Page } from '@playwright/test'
import { selectInput } from '../../helpers/e2e/selectInput.js'
export const createFolderDoc = async ({
folderName,
page,
folderType,
}: {
folderName: string
folderType: string[]
page: Page
}) => {
const drawer = page.locator('dialog .collection-edit--payload-folders')
await drawer.locator('input#field-name').fill(folderName)
await selectInput({
multiSelect: true,
options: folderType,
selectLocator: drawer.locator('#field-folderType'),
})
const createButton = drawer.getByRole('button', { name: 'Save' })
await createButton.click()
await expect(page.locator('.payload-toast-container')).toContainText('successfully')
}