Adds various helpers to make it easier and more standard to manage array fields within e2e tests. Retrofits existing tests to ensure consistent interactions across the board, and also organizes existing blocks and relationship field helpers in the same way. --- - To see the specific tasks where the Asana app for GitHub is being used, see below: - https://app.asana.com/0/0/1211094073049046
21 lines
656 B
TypeScript
21 lines
656 B
TypeScript
import type { Page } from 'playwright'
|
|
|
|
import { wait } from 'payload/shared'
|
|
import { expect } from 'playwright/test'
|
|
|
|
export async function openCreateDocDrawer({
|
|
page,
|
|
fieldSelector,
|
|
}: {
|
|
fieldSelector: string
|
|
page: Page
|
|
}): Promise<void> {
|
|
await wait(500) // wait for parent form state to initialize
|
|
const relationshipField = page.locator(fieldSelector)
|
|
await expect(relationshipField.locator('input')).toBeEnabled()
|
|
const addNewButton = relationshipField.locator('.relationship-add-new__add-button')
|
|
await expect(addNewButton).toBeVisible()
|
|
await addNewButton.click()
|
|
await wait(500) // wait for drawer form state to initialize
|
|
}
|