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
43 lines
1.1 KiB
TypeScript
43 lines
1.1 KiB
TypeScript
import { expect, type Page } from '@playwright/test'
|
|
|
|
import { createFolderDoc } from './createFolderDoc.js'
|
|
|
|
type Args = {
|
|
folderName: string
|
|
folderType?: string[]
|
|
fromDropdown?: boolean
|
|
page: Page
|
|
}
|
|
export async function createFolder({
|
|
folderName,
|
|
fromDropdown = false,
|
|
page,
|
|
folderType = ['Posts'],
|
|
}: Args): Promise<void> {
|
|
if (fromDropdown) {
|
|
const titleActionsLocator = page.locator('.list-header__title-actions')
|
|
const folderDropdown = titleActionsLocator.locator('.create-new-doc-in-folder__action-popup', {
|
|
hasText: 'Create',
|
|
})
|
|
await folderDropdown.click()
|
|
const createFolderButton = titleActionsLocator.locator('.popup-button-list__button', {
|
|
hasText: 'Folder',
|
|
})
|
|
await createFolderButton.click()
|
|
} else {
|
|
const createFolderButton = page.locator(
|
|
'.create-new-doc-in-folder__button:has-text("Create New")',
|
|
)
|
|
await createFolderButton.click()
|
|
}
|
|
|
|
await createFolderDoc({
|
|
page,
|
|
folderName,
|
|
folderType,
|
|
})
|
|
|
|
const folderCard = page.locator('.folder-file-card__name', { hasText: folderName }).first()
|
|
await expect(folderCard).toBeVisible()
|
|
}
|