Files
payloadcms/test/field-error-states/e2e.spec.ts
Alessio Gravili c068a8784e fix(richtext-lexical): Blocks: make sure fields are wrapped in a uniquely-named group, change block node data format, fix react key error (#3995)
* fix(richtext-lexical): make sure block fields are wrapped in a uniquely-named group

* chore: remove redundant hook

* chore(richtext-lexical): attempt to fix unnecessary unsaved changes warning regression

* cleanup everything

* chore: more cleanup

* debug

* looks like properly cloning the formdata for setting initial state fixes the issue where the old formdata is updated even if node.setFields is not called

* chore: fix e2e tests

* chore: fix e2e tests (a selector has changed)

* chore: fix int tests (due to new blocks data format)

* chore: fix incorrect insert block commands in drawer

* chore: add new e2e test

* chore: fail e2e tests when there are browser console errors

* fix(breaking): beforeInput and afterInput: fix missing key errors, consistent typing and cases in name
2023-11-16 22:01:04 +01:00

53 lines
1.9 KiB
TypeScript

import type { Page } from '@playwright/test'
import { expect, test } from '@playwright/test'
import { initPageConsoleErrorCatch } from '../helpers'
import { initPayloadE2E } from '../helpers/configHelpers'
const { beforeAll, describe } = test
describe('field error states', () => {
let serverURL: string
let page: Page
beforeAll(async ({ browser }) => {
;({ serverURL } = await initPayloadE2E(__dirname))
const context = await browser.newContext()
page = await context.newPage()
initPageConsoleErrorCatch(page)
})
test('Remove row should remove error states from parent fields', async () => {
await page.goto(`${serverURL}/admin/collections/error-fields/create`)
// add parent array
await page.locator('#field-parentArray > .array-field__add-row').click()
// add first child array
await page.locator('#parentArray-row-0 .collapsible__content .array-field__add-row').click()
await page.locator('#field-parentArray__0__childArray__0__childArrayText').focus()
await page.keyboard.type('T1')
// add second child array
await page.locator('#parentArray-row-0 .collapsible__content .array-field__add-row').click()
await page.locator('#field-parentArray__0__childArray__1__childArrayText').focus()
await page.keyboard.type('T2')
// add third child array
await page.locator('#parentArray-row-0 .collapsible__content .array-field__add-row').click()
await page.locator('#parentArray-0-childArray-row-2 .array-actions__button').click()
await page
.locator('#parentArray-0-childArray-row-2 .array-actions__action.array-actions__remove')
.click()
await page.locator('#action-save').click()
const errorPill = await page.waitForSelector(
'#parentArray-row-0 > .collapsible > .collapsible__toggle-wrap .array-field__row-error-pill',
{ state: 'hidden', timeout: 500 },
)
expect(errorPill).toBeNull()
})
})