@@ -2,18 +2,25 @@ import {
22 test ,
33 expect ,
44 findTraces ,
5- assigns_entry ,
5+ findAssignsEntry ,
66 findSwitchTracingButton ,
77 findRefreshTracesButton ,
88 findClearTracesButton ,
9+ Page ,
910} from './dev-dbg-test' ;
1011
12+ const findNodeBasicInfo = ( page : Page ) =>
13+ page . locator ( '#node-inspector-basic-info' ) ;
14+
15+ const findComponentsTreeButton = ( page : Page , name : string ) =>
16+ page . getByRole ( 'button' , { name } ) ;
17+
1118test ( 'user can see traces of executed callbacks and updated assigns' , async ( {
1219 devApp,
1320 dbgApp,
1421} ) => {
1522 const traces = findTraces ( dbgApp ) ;
16- await expect ( assigns_entry ( dbgApp , 'counter' , '0' ) ) . toBeVisible ( ) ;
23+ await expect ( findAssignsEntry ( dbgApp , 'counter' , '0' ) ) . toBeVisible ( ) ;
1724 await expect ( traces ) . toHaveCount ( 2 ) ;
1825
1926 const incBtn = devApp . getByRole ( 'button' , {
@@ -23,15 +30,15 @@ test('user can see traces of executed callbacks and updated assigns', async ({
2330 await incBtn . click ( ) ;
2431 await incBtn . click ( ) ;
2532
26- await expect ( assigns_entry ( dbgApp , 'counter' , '2' ) ) . toBeVisible ( ) ;
33+ await expect ( findAssignsEntry ( dbgApp , 'counter' , '2' ) ) . toBeVisible ( ) ;
2734 await expect ( traces ) . toHaveCount ( 6 ) ;
2835
2936 await findSwitchTracingButton ( dbgApp ) . click ( ) ;
3037
3138 await incBtn . click ( ) ;
3239 await incBtn . click ( ) ;
3340
34- await expect ( assigns_entry ( dbgApp , 'counter' , '4' ) ) . toBeVisible ( ) ;
41+ await expect ( findAssignsEntry ( dbgApp , 'counter' , '4' ) ) . toBeVisible ( ) ;
3542 await expect ( traces ) . toHaveCount ( 6 ) ;
3643
3744 await findRefreshTracesButton ( dbgApp ) . click ( ) ;
@@ -104,6 +111,49 @@ test('return button redirects to active live views dashboard', async ({
104111 ) . toBeVisible ( ) ;
105112} ) ;
106113
114+ test ( 'user can change nodes using node tree and see their assigns and callback traces' , async ( {
115+ devApp,
116+ dbgApp,
117+ } ) => {
118+ await findComponentsTreeButton ( dbgApp , 'Conditional (5)' ) . click ( ) ;
119+
120+ await expect ( findNodeBasicInfo ( dbgApp ) ) . toContainText ( 'LiveComponent' ) ;
121+ await expect ( findNodeBasicInfo ( dbgApp ) ) . toContainText (
122+ 'LiveDebuggerDev.LiveComponents.Conditional'
123+ ) ;
124+
125+ await expect ( findAssignsEntry ( dbgApp , 'show_child?' , 'false' ) ) . toBeVisible ( ) ;
126+ await expect ( findTraces ( dbgApp ) ) . toHaveCount ( 2 ) ;
127+
128+ await expect (
129+ findComponentsTreeButton ( dbgApp , 'ManyAssigns (15)' )
130+ ) . not . toBeVisible ( ) ;
131+
132+ await devApp . locator ( '#conditional-button' ) . click ( ) ;
133+
134+ await expect (
135+ findComponentsTreeButton ( dbgApp , 'ManyAssigns (15)' )
136+ ) . toBeVisible ( ) ;
137+
138+ await expect ( findAssignsEntry ( dbgApp , 'show_child?' , 'true' ) ) . toBeVisible ( ) ;
139+ await expect ( findTraces ( dbgApp ) ) . toHaveCount ( 4 ) ;
140+
141+ await findComponentsTreeButton ( dbgApp , 'Conditional (6)' ) . click ( ) ;
142+ await findComponentsTreeButton ( dbgApp , 'Conditional (5)' ) . click ( ) ;
143+
144+ await expect ( findAssignsEntry ( dbgApp , 'show_child?' , 'true' ) ) . toBeVisible ( ) ;
145+ await expect ( findTraces ( dbgApp ) ) . toHaveCount ( 4 ) ;
146+
147+ await devApp . locator ( '#conditional-button' ) . click ( ) ;
148+
149+ await expect (
150+ findComponentsTreeButton ( dbgApp , 'ManyAssigns (15)' )
151+ ) . not . toBeVisible ( ) ;
152+
153+ await expect ( findAssignsEntry ( dbgApp , 'show_child?' , 'false' ) ) . toBeVisible ( ) ;
154+ await expect ( findTraces ( dbgApp ) ) . toHaveCount ( 6 ) ;
155+ } ) ;
156+
107157test ( 'Open in editor is disabled when envs are not set' , async ( { dbgApp } ) => {
108158 const openButton = dbgApp . getByRole ( 'button' , { name : 'Open in editor' } ) ;
109159 await expect ( openButton ) . toBeDisabled ( ) ;
0 commit comments