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
32 lines
784 B
TypeScript
32 lines
784 B
TypeScript
import type { Page } from '@playwright/test'
|
|
|
|
import { expect } from '@playwright/test'
|
|
import { exactText } from 'helpers.js'
|
|
|
|
import { openBlocksDrawer } from './openBlocksDrawer.js'
|
|
|
|
export const addBlock = async ({
|
|
page,
|
|
fieldName = 'blocks',
|
|
blockToSelect = 'Block',
|
|
}: {
|
|
/**
|
|
* The name of the block to select from the blocks drawer.
|
|
*/
|
|
blockToSelect: string
|
|
fieldName: string
|
|
page: Page
|
|
}) => {
|
|
const blocksDrawer = await openBlocksDrawer({ page, fieldName })
|
|
|
|
const blockCard = blocksDrawer.locator('.blocks-drawer__block .thumbnail-card__label', {
|
|
hasText: blockToSelect,
|
|
})
|
|
|
|
await expect(blockCard).toBeVisible()
|
|
|
|
await blocksDrawer.getByRole('button', { name: exactText(blockToSelect) }).click()
|
|
|
|
// expect to see the block on the page
|
|
}
|