@@ -57,13 +57,13 @@ class TraceViewerPage {
57
57
this . actionTitles = page . locator ( '.action-title' ) ;
58
58
this . actionsTree = page . getByTestId ( 'actions-tree' ) ;
59
59
this . callLines = page . locator ( '.call-tab .call-line' ) ;
60
- this . logLines = page . getByTestId ( 'log- list') . locator ( '.list-view-entry ') ;
60
+ this . logLines = page . getByRole ( ' list', { name : 'Log entries' } ) . getByRole ( 'listitem ') ;
61
61
this . consoleLines = page . locator ( '.console-line' ) ;
62
62
this . consoleLineMessages = page . locator ( '.console-line-message' ) ;
63
63
this . errorMessages = page . locator ( '.error-message' ) ;
64
64
this . consoleStacks = page . locator ( '.console-stack' ) ;
65
- this . stackFrames = page . getByTestId ( 'stack-trace- list') . locator ( '.list-view-entry ') ;
66
- this . networkRequests = page . getByTestId ( 'network- list') . locator ( '.list-view-entry ') ;
65
+ this . stackFrames = page . getByRole ( ' list', { name : 'Stack trace' } ) . getByRole ( 'listitem ') ;
66
+ this . networkRequests = page . getByRole ( ' list', { name : 'Network requests' } ) . getByRole ( 'listitem ') ;
67
67
this . snapshotContainer = page . locator ( '.snapshot-container iframe.snapshot-visible[name=snapshot]' ) ;
68
68
this . metadataTab = page . getByTestId ( 'metadata-view' ) ;
69
69
this . sourceCodeTab = page . getByTestId ( 'source-code' ) ;
@@ -73,58 +73,57 @@ class TraceViewerPage {
73
73
this . displayCanvasContentSetting = page . locator ( '.setting' ) . getByText ( 'Display canvas content' ) ;
74
74
}
75
75
76
- async actionIconsText ( action : string ) {
77
- const entry = await this . page . waitForSelector ( `.tree-view-entry:has-text("${ action } ")` ) ;
78
- await entry . waitForSelector ( '.action-icon-value:visible' ) ;
79
- return await entry . $$eval ( '.action-icon-value:visible' , ee => ee . map ( e => e . textContent ) ) ;
76
+ actionIconsText ( action : string ) {
77
+ const entry = this . page . locator ( `.tree-view-entry` ) . filter ( { hasText : action } ) ;
78
+ return entry . locator ( '.action-icon-value' ) . filter ( { visible : true } ) ;
80
79
}
81
80
82
- async actionIcons ( action : string ) {
83
- return await this . page . waitForSelector ( `.tree-view-entry:has-text(" ${ action } ") . action-icons` ) ;
81
+ actionIcons ( action : string ) {
82
+ return this . page . locator ( `.tree-view-entry` ) . filter ( { hasText : action } ) . locator ( '. action-icons' ) . filter ( { visible : true } ) ;
84
83
}
85
84
86
85
@step
87
- async expandAction ( title : string , ordinal : number = 0 ) {
88
- await this . actionsTree . locator ( '.tree-view-entry ', { hasText : title } ) . nth ( ordinal ) . locator ( '.codicon-chevron-right' ) . click ( ) ;
86
+ async expandAction ( title : string ) {
87
+ await this . actionsTree . getByRole ( 'treeitem ', { name : title } ) . nth ( 0 ) . getByRole ( 'button' , { name : 'Expand' } ) . click ( ) ;
89
88
}
90
89
91
90
@step
92
91
async selectAction ( title : string , ordinal : number = 0 ) {
93
- await this . page . locator ( `.action-title:has-text(" ${ title } ")` ) . nth ( ordinal ) . click ( ) ;
92
+ await this . actionsTree . getByRole ( 'treeitem' , { name : title } ) . nth ( ordinal ) . click ( ) ;
94
93
}
95
94
96
95
@step
97
96
async hoverAction ( title : string , ordinal : number = 0 ) {
98
- await this . page . locator ( `.action-title:has-text(" ${ title } ")` ) . nth ( ordinal ) . hover ( ) ;
97
+ await this . actionTitles . filter ( { hasText : title } ) . nth ( ordinal ) . hover ( ) ;
99
98
}
100
99
101
100
@step
102
101
async selectSnapshot ( name : string ) {
103
- await this . page . click ( ` .snapshot-tab .tabbed-pane-tab-label:has-text(" ${ name } ")` ) ;
102
+ await this . page . locator ( ' .snapshot-tab .tabbed-pane-tab-label' ) . filter ( { hasText : name } ) . click ( ) ;
104
103
}
105
104
106
105
async showErrorsTab ( ) {
107
- await this . page . click ( 'text=" Errors"' ) ;
106
+ await this . page . getByRole ( 'tab' , { name : ' Errors' } ) . click ( ) ;
108
107
}
109
108
110
109
async showConsoleTab ( ) {
111
- await this . page . click ( 'text=" Console"' ) ;
110
+ await this . page . getByRole ( 'tab' , { name : ' Console' } ) . click ( ) ;
112
111
}
113
112
114
113
async showSourceTab ( ) {
115
- await this . page . click ( 'text=" Source"' ) ;
114
+ await this . page . getByRole ( 'tab' , { name : ' Source' } ) . click ( ) ;
116
115
}
117
116
118
117
async showNetworkTab ( ) {
119
- await this . page . click ( 'text=" Network"' ) ;
118
+ await this . page . getByRole ( 'tab' , { name : ' Network' } ) . click ( ) ;
120
119
}
121
120
122
121
async showMetadataTab ( ) {
123
- await this . page . click ( 'text=" Metadata"' ) ;
122
+ await this . page . getByRole ( 'tab' , { name : ' Metadata' } ) . click ( ) ;
124
123
}
125
124
126
125
async showSettings ( ) {
127
- await this . page . locator ( '.settings-gear' ) . click ( ) ;
126
+ await this . page . getByRole ( 'button' , { name : 'Settings' } ) . click ( ) ;
128
127
}
129
128
130
129
@step
0 commit comments