chore: add skipped, failing lexical e2e test for errors within nested block fields, fix lexical seed data, disable access-control test (#5508)

This commit is contained in:
Alessio Gravili
2024-03-28 13:36:05 -04:00
committed by GitHub
parent 08dd9ca91c
commit 93dd6b5a98
4 changed files with 37 additions and 3 deletions

View File

@@ -257,7 +257,8 @@ describe('access control', () => {
}) })
}) })
test('should show test global immediately after allowing access', async () => { // TODO: Test flakes. In CI, test global does not appear in nav. Perhaps the checkbox setValue is not triggered BEFORE the document is saved, as the custom save button can be clicked even if the form has not been set to modified.
test.skip('should show test global immediately after allowing access', async () => {
await page.goto(`${serverURL}/admin/globals/settings`) await page.goto(`${serverURL}/admin/globals/settings`)
await openNav(page) await openNav(page)

View File

@@ -16,6 +16,17 @@ export const BlockColumns = ({ name }: { name: string }): ArrayField => ({
name: 'text', name: 'text',
type: 'text', type: 'text',
}, },
{
name: 'subArray',
type: 'array',
fields: [
{
name: 'requiredText',
type: 'text',
required: true,
},
],
},
], ],
}) })
export const ConditionalLayoutBlock: Block = { export const ConditionalLayoutBlock: Block = {

View File

@@ -270,8 +270,6 @@ export function generateLexicalRichText() {
text: 'text in conditionalLayout block', text: 'text in conditionalLayout block',
}, },
], ],
columns2: null,
columns3: null,
}, },
}, // Do not remove this blocks node. It ensures that validation passes when it's created }, // Do not remove this blocks node. It ensures that validation passes when it's created
{ {

View File

@@ -763,5 +763,29 @@ describe('lexical', () => {
await expect(page.locator('.Toastify')).not.toContainText('Please correct invalid fields.') await expect(page.locator('.Toastify')).not.toContainText('Please correct invalid fields.')
}) })
test.skip('should respect required error state in deeply nested text field', async () => {
await navigateToLexicalFields()
const richTextField = page.locator('.rich-text-lexical').nth(1) // second
await richTextField.scrollIntoViewIfNeeded()
await expect(richTextField).toBeVisible()
const conditionalArrayBlock = richTextField.locator('.lexical-block').nth(7)
await conditionalArrayBlock.scrollIntoViewIfNeeded()
await expect(conditionalArrayBlock).toBeVisible()
await conditionalArrayBlock.locator('.btn__label:has-text("Add Sub Array")').first().click()
await page.click('#action-save', { delay: 100 })
await expect(page.locator('.Toastify')).toContainText('The following field is invalid')
// Check if error is shown next to field
await expect(
conditionalArrayBlock
.locator('.tooltip-content:has-text("This field is required.")')
.first(),
).toBeVisible()
})
}) })
}) })