@@ -926,4 +926,34 @@ await page.GetByRole(AriaRole.Button, new() { Name = "Submit" }).ClickAsync();`)
926
926
const predicate = ( msg : ConsoleMessage ) => msg . type ( ) === 'error' && / C o n t e n t [ \- ] S e c u r i t y [ \- ] P o l i c y / i. test ( msg . text ( ) ) ;
927
927
await expect ( page . waitForEvent ( 'console' , { predicate, timeout : 1000 } ) ) . rejects . toThrow ( ) ;
928
928
} ) ;
929
+
930
+ test ( 'should clear when recording is disabled' , { annotation : { type : 'issue' , description : 'https://github.com/microsoft/playwright/issues/33802' } } , async ( { openRecorder } ) => {
931
+ const { recorder } = await openRecorder ( ) ;
932
+
933
+ await recorder . setContentAndWait ( `
934
+ <button id="foo" onclick="console.log('click')">Foo</button>
935
+ <button id="bar" onclick="console.log('click')">Bar</button>
936
+ ` ) ;
937
+
938
+ await recorder . hoverOverElement ( '#foo' ) ;
939
+ let [ sources ] = await Promise . all ( [
940
+ recorder . waitForOutput ( 'JavaScript' , 'click' ) ,
941
+ recorder . trustedClick ( ) ,
942
+ ] ) ;
943
+
944
+ expect ( sources . get ( 'JavaScript' ) . text ) . toContain ( `getByRole('button', { name: 'Foo' }).click()` ) ;
945
+
946
+ await recorder . recorderPage . getByRole ( 'button' , { name : 'Record' } ) . click ( ) ;
947
+ await recorder . recorderPage . getByRole ( 'button' , { name : 'Clear' } ) . click ( ) ;
948
+ await recorder . recorderPage . getByRole ( 'button' , { name : 'Record' } ) . click ( ) ;
949
+
950
+ await recorder . hoverOverElement ( '#bar' ) ;
951
+ [ sources ] = await Promise . all ( [
952
+ recorder . waitForOutput ( 'JavaScript' , 'click' ) ,
953
+ recorder . trustedClick ( ) ,
954
+ ] ) ;
955
+
956
+ expect ( sources . get ( 'JavaScript' ) . text ) . toContain ( `getByRole('button', { name: 'Bar' }).click()` ) ;
957
+ expect ( sources . get ( 'JavaScript' ) . text ) . not . toContain ( `getByRole('button', { name: 'Foo' })` ) ;
958
+ } ) ;
929
959
} ) ;
0 commit comments