Files
payloadcms/test/helpers/folders/createFolderFromDoc.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

31 lines
709 B
TypeScript

import { expect, type Page } from '@playwright/test'
import { createFolder } from './createFolder.js'
import { createFolderDoc } from './createFolderDoc.js'
type Args = {
folderName: string
folderType?: string[]
page: Page
}
export async function createFolderFromDoc({
folderName,
page,
folderType = ['Posts'],
}: Args): Promise<void> {
const addFolderButton = page.locator('.create-new-doc-in-folder__button', {
hasText: 'Create folder',
})
await addFolderButton.click()
await createFolderDoc({
page,
folderName,
folderType,
})
const folderCard = page.locator('.folder-file-card__name', { hasText: folderName }).first()
await expect(folderCard).toBeVisible()
}