@@ -2,22 +2,23 @@ import type { BrowserContext, Page } from '@playwright/test'
22
33import { expect , test } from '@playwright/test'
44import { addArrayRow } from '__helpers/e2e/fields/array/index.js'
5+ import { addBlock } from '__helpers/e2e/fields/blocks/index.js'
56import path from 'path'
67import { fileURLToPath } from 'url'
78
89import type { PayloadTestSDK } from '../../../__helpers/shared/sdk/index.js'
910import type { Config } from '../../payload-types.js'
1011
12+ import { assertNetworkRequests } from '../../../__helpers/e2e/assertNetworkRequests.js'
1113import {
1214 ensureCompilationIsDone ,
1315 initPageConsoleErrorCatch ,
1416 saveDocAndAssert ,
1517 // throttleTest,
1618} from '../../../__helpers/e2e/helpers.js'
1719import { AdminUrlUtil } from '../../../__helpers/shared/adminUrlUtil.js'
18- import { assertNetworkRequests } from '../../../__helpers/e2e/assertNetworkRequests.js'
19- import { initPayloadE2ENoConfig } from '../../../__helpers/shared/initPayloadE2ENoConfig.js'
2020import { reInitializeDB } from '../../../__helpers/shared/clearAndSeed/reInitializeDB.js'
21+ import { initPayloadE2ENoConfig } from '../../../__helpers/shared/initPayloadE2ENoConfig.js'
2122import { RESTClient } from '../../../__helpers/shared/rest.js'
2223import { TEST_TIMEOUT_LONG } from '../../../playwright.config.js'
2324import { conditionalLogicSlug } from '../../slugs.js'
@@ -287,4 +288,36 @@ describe('Conditional Logic', () => {
287288
288289 await expect ( fieldWithOperationCondition ) . toBeHidden ( )
289290 } )
291+
292+ test ( 'should toggle conditional field when radio changes inside a block' , async ( ) => {
293+ await page . goto ( url . create )
294+
295+ await addBlock ( {
296+ page,
297+ fieldName : 'blocksWithRadioCondition' ,
298+ blockToSelect : 'Block With Radio Condition' ,
299+ } )
300+
301+ // Conditional field should be hidden (defaultValue: 'hide')
302+ const conditionalField = page . locator (
303+ '#field-blocksWithRadioCondition__0__conditionalTextField' ,
304+ )
305+ await expect ( conditionalField ) . toBeHidden ( )
306+
307+ // Click "Show" radio and wait for form state response
308+ const showRadio = page . locator ( 'label:has(input[id*="radioTrigger-show"])' )
309+ await showRadio . click ( )
310+
311+ await expect ( async ( ) => {
312+ await expect ( conditionalField ) . toBeVisible ( )
313+ } ) . toPass ( )
314+
315+ // Click "Hide" radio
316+ const hideRadio = page . locator ( 'label:has(input[id*="radioTrigger-hide"])' )
317+ await hideRadio . click ( )
318+
319+ await expect ( async ( ) => {
320+ await expect ( conditionalField ) . toBeHidden ( )
321+ } ) . toPass ( )
322+ } )
290323} )
0 commit comments