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
26 lines
724 B
TypeScript
26 lines
724 B
TypeScript
import type { Locator, Page } from 'playwright'
|
|
|
|
import { openArrayRowActions } from './openArrayRowActions.js'
|
|
|
|
/**
|
|
* Duplicates the array row at the specified index.
|
|
*/
|
|
export const duplicateArrayRow = async (
|
|
page: Page,
|
|
{ fieldName, rowIndex = 0 }: Parameters<typeof openArrayRowActions>[1],
|
|
): Promise<{
|
|
popupContentLocator: Locator
|
|
rowActionsButtonLocator: Locator
|
|
}> => {
|
|
const { popupContentLocator, rowActionsButtonLocator } = await openArrayRowActions(page, {
|
|
fieldName,
|
|
rowIndex,
|
|
})
|
|
|
|
await popupContentLocator.locator('.array-actions__action.array-actions__duplicate').click()
|
|
|
|
// TODO: test the array row has been duplicated
|
|
|
|
return { popupContentLocator, rowActionsButtonLocator }
|
|
}
|