@@ -652,6 +652,13 @@ test.describe('Sections Validation and Error Lifecycle', () => {
652652 makeAxeBuilder,
653653 } ) => {
654654 const sectionRow = page . getByRole ( 'row' ) . filter ( { hasText : 'Results' } ) ;
655+
656+ // Ensure the section is included so the narrative select is visible
657+ const includeCheckbox = sectionRow . getByRole ( 'checkbox' ) ;
658+ if ( ! ( await includeCheckbox . isChecked ( ) ) ) {
659+ await includeCheckbox . click ( ) ;
660+ }
661+
655662 const narrativeSelect = sectionRow . getByRole ( 'combobox' ) ;
656663 const codedDataSwitch = sectionRow . getByRole ( 'switch' ) ;
657664
@@ -662,6 +669,10 @@ test.describe('Sections Validation and Error Lifecycle', () => {
662669 // 1. Trigger Error: Switch to 'Keep original'
663670 await expect ( codedDataSwitch ) . toBeChecked ( ) ;
664671 await codedDataSwitch . click ( ) ;
672+ const resultsCheckbox = sectionRow . getByRole ( 'checkbox' ) ;
673+ if ( ! ( await resultsCheckbox . isChecked ( ) ) ) {
674+ await resultsCheckbox . click ( ) ;
675+ }
665676 const errorAlert = sectionRow . getByRole ( 'alert' ) ;
666677 await expect ( errorAlert ) . toBeVisible ( ) ;
667678 await expect ( errorAlert ) . toHaveText (
@@ -680,10 +691,7 @@ test.describe('Sections Validation and Error Lifecycle', () => {
680691 await expect ( errorAlert ) . toBeVisible ( ) ;
681692
682693 // 4. Persistence via Internal Click
683- await page
684- . locator ( '[data-error-trigger]' )
685- . first ( )
686- . click ( { position : { x : 20 , y : 20 } } ) ;
694+ await sectionRow . getByRole ( 'switch' ) . click ( { position : { x : 20 , y : 20 } } ) ;
687695 await expect ( errorAlert ) . toBeVisible ( ) ;
688696
689697 // 5. Dismiss via Input Change
0 commit comments