@@ -242,6 +242,14 @@ async function chooseTarget(dialog: Locator, ariaLabel: 'Target groups' | 'Targe
242242}
243243
244244async function resetSystemRuleToBaseline ( dialog : Locator ) {
245+ const instanceRow = getRuleRow ( dialog , 'Instance' , instanceWideTargetLabel )
246+ const hasInstanceRule = await instanceRow . count ( ) . then ( ( count ) => count > 0 )
247+
248+ if ( hasInstanceRule ) {
249+ await removeRule ( dialog , 'Instance' , instanceWideTargetLabel )
250+ return
251+ }
252+
245253 await openSystemDefaultEditor ( dialog )
246254 expect ( await setSigningFlow ( dialog , 'none' ) , 'Expected signing-flow radios in system editor' ) . toBe ( true )
247255 await submitSystemRuleAndWait ( dialog )
@@ -334,7 +342,7 @@ test('system default persists across edit cycles and can be reset to the system
334342 await expect ( getRuleRow ( reloadedDialog , 'Instance' , instanceWideTargetLabel ) ) . toContainText ( 'Simultaneous (Parallel)' )
335343
336344 await resetSystemRuleToBaseline ( reloadedDialog )
337- await expect ( getRuleRow ( reloadedDialog , 'Instance' , instanceWideTargetLabel ) ) . toContainText ( 'Let users choose' )
345+ await expect ( getRuleRow ( reloadedDialog , 'Instance' , instanceWideTargetLabel ) ) . toHaveCount ( 0 )
338346 await expect ( reloadedDialog . getByText ( / D e f a u l t : \s * L e t u s e r s c h o o s e / i) ) . toBeVisible ( )
339347} )
340348
@@ -399,6 +407,6 @@ test('admin can manage instance and user rules while signature-flow group rules
399407
400408 // Global rule: reset to explicit "let users choose" baseline
401409 await resetSystemRuleToBaseline ( reloadedDialog )
402- await expect ( getRuleRow ( reloadedDialog , 'Instance' , instanceWideTargetLabel ) ) . toContainText ( 'Let users choose' )
410+ await expect ( getRuleRow ( reloadedDialog , 'Instance' , instanceWideTargetLabel ) ) . toHaveCount ( 0 )
403411 await expect ( reloadedDialog . getByText ( / D e f a u l t : \s * L e t u s e r s c h o o s e / i) ) . toBeVisible ( )
404412} )
0 commit comments