55import { assert , expect } from 'chai' ;
66import type { ElementHandle } from 'puppeteer-core' ;
77
8- import { reloadDevTools } from '../../e2e/helpers/cross-tool-helper.js' ;
98import {
109 clearTextFilter ,
1110 getAllRequestNames ,
@@ -16,7 +15,6 @@ import {
1615} from '../../e2e/helpers/network-helpers.js' ;
1716import { getBrowserAndPagesWrappers } from '../../shared/non_hosted_wrappers.js' ;
1817import type { DevToolsPage } from '../shared/frontend-helper.js' ;
19- import type { InspectedPage } from '../shared/target-helper.js' ;
2018
2119const SIMPLE_PAGE_REQUEST_NUMBER = 10 ;
2220const SIMPLE_PAGE_URL = `requests.html?num=${ SIMPLE_PAGE_REQUEST_NUMBER } ` ;
@@ -64,42 +62,30 @@ describe('The Network Tab', function() {
6462 // One of these tests reloads panels repeatedly, which can take a longer time.
6563 this . timeout ( 20_000 ) ;
6664
67- it ( 'can filter by text in the log view' , async ( { devToolsPage, inspectedPage} : {
68- devToolsPage : DevToolsPage ,
69- inspectedPage : InspectedPage ,
70- } ) => {
65+ it ( 'can filter by text in the log view' , async ( { devToolsPage, inspectedPage} ) => {
7166 await navigateToNetworkTab ( SIMPLE_PAGE_URL , devToolsPage , inspectedPage ) ;
7267 await devToolsPage . typeText ( '9' ) ;
7368 const nodes = await devToolsPage . waitForMany ( '.data-grid-data-grid-node > .name-column' , 1 ) ;
7469 expect ( nodes . length ) . to . equal ( 1 ) ;
7570 expect ( await elementTextContent ( nodes [ 0 ] ) ) . to . equal ( RESULTS [ 10 ] ) ;
7671 } ) ;
7772
78- it ( 'can match multiple requests by text in the log view' , async ( { devToolsPage, inspectedPage} : {
79- devToolsPage : DevToolsPage ,
80- inspectedPage : InspectedPage ,
81- } ) => {
73+ it ( 'can match multiple requests by text in the log view' , async ( { devToolsPage, inspectedPage} ) => {
8274 await navigateToNetworkTab ( SIMPLE_PAGE_URL , devToolsPage , inspectedPage ) ;
8375 await devToolsPage . typeText ( 'svg' ) ;
8476 const nodes = await devToolsPage . waitForMany ( '.data-grid-data-grid-node > .name-column' , 1 ) ;
8577 expect ( nodes . length ) . to . equal ( 10 ) ;
8678 } ) ;
8779
88- it ( 'can filter by regex in the log view' , async ( { devToolsPage, inspectedPage} : {
89- devToolsPage : DevToolsPage ,
90- inspectedPage : InspectedPage ,
91- } ) => {
80+ it ( 'can filter by regex in the log view' , async ( { devToolsPage, inspectedPage} ) => {
9281 await navigateToNetworkTab ( SIMPLE_PAGE_URL , devToolsPage , inspectedPage ) ;
9382 await devToolsPage . typeText ( '/8/' ) ;
9483 const nodes = await devToolsPage . waitForMany ( '.data-grid-data-grid-node > .name-column' , 1 ) ;
9584 expect ( nodes . length ) . to . equal ( 1 ) ;
9685 expect ( await elementTextContent ( nodes [ 0 ] ) ) . to . equal ( RESULTS [ 9 ] ) ;
9786 } ) ;
9887
99- it ( 'can match multiple requests by regex in the log view' , async ( { devToolsPage, inspectedPage} : {
100- devToolsPage : DevToolsPage ,
101- inspectedPage : InspectedPage ,
102- } ) => {
88+ it ( 'can match multiple requests by regex in the log view' , async ( { devToolsPage, inspectedPage} ) => {
10389 await navigateToNetworkTab ( SIMPLE_PAGE_URL , devToolsPage , inspectedPage ) ;
10490 await devToolsPage . typeText ( '/.*/' ) ;
10591 let nodes = await devToolsPage . waitForMany ( '.data-grid-data-grid-node > .name-column' , 1 ) ;
@@ -116,10 +102,7 @@ describe('The Network Tab', function() {
116102 expect ( nodes . length ) . to . equal ( 10 ) ;
117103 } ) ;
118104
119- it ( 'can match no requests by regex in the log view' , async ( { devToolsPage, inspectedPage} : {
120- devToolsPage : DevToolsPage ,
121- inspectedPage : InspectedPage ,
122- } ) => {
105+ it ( 'can match no requests by regex in the log view' , async ( { devToolsPage, inspectedPage} ) => {
123106 await navigateToNetworkTab ( SIMPLE_PAGE_URL , devToolsPage , inspectedPage ) ;
124107 await devToolsPage . typeText ( '/NOTHINGTOMATCH/' ) ;
125108 await devToolsPage . waitForNone ( '.data-grid-data-grid-node > .name-column' ) ;
@@ -149,10 +132,7 @@ describe('The Network Tab', function() {
149132 await setPersistLog ( false , devToolsPage ) ;
150133 } ) ;
151134
152- it ( 'require operator to filter by scheme' , async ( { devToolsPage, inspectedPage} : {
153- devToolsPage : DevToolsPage ,
154- inspectedPage : InspectedPage ,
155- } ) => {
135+ it ( 'require operator to filter by scheme' , async ( { devToolsPage, inspectedPage} ) => {
156136 await navigateToNetworkTab ( SIMPLE_PAGE_URL , devToolsPage , inspectedPage ) ;
157137 await devToolsPage . typeText ( 'http' ) ;
158138 await devToolsPage . waitForNone ( '.data-grid-data-grid-node > .name-column' ) ;
@@ -169,10 +149,7 @@ describe('The Network Tab', function() {
169149 expect ( nodes . length ) . to . be . greaterThanOrEqual ( 11 ) ;
170150 } ) ;
171151
172- it ( 'require operator to filter by domain' , async ( { devToolsPage, inspectedPage} : {
173- devToolsPage : DevToolsPage ,
174- inspectedPage : InspectedPage ,
175- } ) => {
152+ it ( 'require operator to filter by domain' , async ( { devToolsPage, inspectedPage} ) => {
176153 await navigateToNetworkTab ( SIMPLE_PAGE_URL , devToolsPage , inspectedPage ) ;
177154 await devToolsPage . typeText ( 'localhost' ) ;
178155 await devToolsPage . waitForNone ( '.data-grid-data-grid-node > .name-column' ) ;
@@ -183,21 +160,15 @@ describe('The Network Tab', function() {
183160 expect ( nodes . length ) . to . be . greaterThanOrEqual ( 11 ) ;
184161 } ) ;
185162
186- it ( 'can filter by partial URL in the log view' , async ( { devToolsPage, inspectedPage} : {
187- devToolsPage : DevToolsPage ,
188- inspectedPage : InspectedPage ,
189- } ) => {
163+ it ( 'can filter by partial URL in the log view' , async ( { devToolsPage, inspectedPage} ) => {
190164 await navigateToNetworkTab ( SIMPLE_PAGE_URL , devToolsPage , inspectedPage ) ;
191165 await clearTextFilter ( devToolsPage ) ;
192166 await devToolsPage . typeText ( `https://localhost:${ inspectedPage . serverPort } ` ) ;
193167 const nodes = await devToolsPage . waitForMany ( '.data-grid-data-grid-node > .name-column' , 1 ) ;
194168 expect ( nodes . length ) . to . be . greaterThanOrEqual ( 11 ) ;
195169 } ) ;
196170
197- it ( 'can reverse filter text in the log view' , async ( { devToolsPage, inspectedPage} : {
198- devToolsPage : DevToolsPage ,
199- inspectedPage : InspectedPage ,
200- } ) => {
171+ it ( 'can reverse filter text in the log view' , async ( { devToolsPage, inspectedPage} ) => {
201172 await navigateToNetworkTab ( SIMPLE_PAGE_URL , devToolsPage , inspectedPage ) ;
202173 await devToolsPage . typeText ( '-7' ) ;
203174 const nodes = await devToolsPage . waitForMany ( '.data-grid-data-grid-node > .name-column' , 10 ) ;
@@ -206,10 +177,7 @@ describe('The Network Tab', function() {
206177 expect ( nodes . length ) . to . be . greaterThanOrEqual ( output . length ) ;
207178 } ) ;
208179
209- it ( 'can reverse filter regex in the log view' , async ( { devToolsPage, inspectedPage} : {
210- devToolsPage : DevToolsPage ,
211- inspectedPage : InspectedPage ,
212- } ) => {
180+ it ( 'can reverse filter regex in the log view' , async ( { devToolsPage, inspectedPage} ) => {
213181 await navigateToNetworkTab ( SIMPLE_PAGE_URL , devToolsPage , inspectedPage ) ;
214182 await devToolsPage . typeText ( '-/6/' ) ;
215183 const nodes = await devToolsPage . waitForMany ( '.data-grid-data-grid-node > .name-column' , 10 ) ;
@@ -218,10 +186,7 @@ describe('The Network Tab', function() {
218186 expect ( nodes . length ) . to . be . greaterThanOrEqual ( output . length ) ;
219187 } ) ;
220188
221- it ( 'can invert text filters' , async ( { devToolsPage, inspectedPage} : {
222- devToolsPage : DevToolsPage ,
223- inspectedPage : InspectedPage ,
224- } ) => {
189+ it ( 'can invert text filters' , async ( { devToolsPage, inspectedPage} ) => {
225190 await navigateToNetworkTab ( SIMPLE_PAGE_URL , devToolsPage , inspectedPage ) ;
226191 const invertCheckbox = await ( await devToolsPage . waitForAria ( 'Invert' ) ) . toElement ( 'input' ) ;
227192 expect ( await checkboxIsChecked ( invertCheckbox ) ) . to . equal ( false ) ;
@@ -237,10 +202,7 @@ describe('The Network Tab', function() {
237202 expect ( await checkboxIsChecked ( invertCheckbox ) ) . to . equal ( false ) ;
238203 } ) ;
239204
240- it ( 'can invert regex filters' , async ( { devToolsPage, inspectedPage} : {
241- devToolsPage : DevToolsPage ,
242- inspectedPage : InspectedPage ,
243- } ) => {
205+ it ( 'can invert regex filters' , async ( { devToolsPage, inspectedPage} ) => {
244206 await navigateToNetworkTab ( SIMPLE_PAGE_URL , devToolsPage , inspectedPage ) ;
245207 const invertCheckbox = await ( await devToolsPage . waitForAria ( 'Invert' ) ) . toElement ( 'input' ) ;
246208 expect ( await checkboxIsChecked ( invertCheckbox ) ) . to . equal ( false ) ;
@@ -256,10 +218,7 @@ describe('The Network Tab', function() {
256218 expect ( await checkboxIsChecked ( invertCheckbox ) ) . to . equal ( false ) ;
257219 } ) ;
258220
259- it ( 'can invert negated text filters' , async ( { devToolsPage, inspectedPage} : {
260- devToolsPage : DevToolsPage ,
261- inspectedPage : InspectedPage ,
262- } ) => {
221+ it ( 'can invert negated text filters' , async ( { devToolsPage, inspectedPage} ) => {
263222 await navigateToNetworkTab ( SIMPLE_PAGE_URL , devToolsPage , inspectedPage ) ;
264223 const invertCheckbox = await ( await devToolsPage . waitForAria ( 'Invert' ) ) . toElement ( 'input' ) ;
265224 expect ( await checkboxIsChecked ( invertCheckbox ) ) . to . equal ( false ) ;
@@ -274,10 +233,7 @@ describe('The Network Tab', function() {
274233 expect ( await checkboxIsChecked ( invertCheckbox ) ) . to . equal ( false ) ;
275234 } ) ;
276235
277- it ( 'can invert negated regex filters' , async ( { devToolsPage, inspectedPage} : {
278- devToolsPage : DevToolsPage ,
279- inspectedPage : InspectedPage ,
280- } ) => {
236+ it ( 'can invert negated regex filters' , async ( { devToolsPage, inspectedPage} ) => {
281237 await navigateToNetworkTab ( SIMPLE_PAGE_URL , devToolsPage , inspectedPage ) ;
282238 const invertCheckbox = await ( await devToolsPage . waitForAria ( 'Invert' ) ) . toElement ( 'input' ) ;
283239 expect ( await checkboxIsChecked ( invertCheckbox ) ) . to . equal ( false ) ;
@@ -292,11 +248,7 @@ describe('The Network Tab', function() {
292248 expect ( await checkboxIsChecked ( invertCheckbox ) ) . to . equal ( false ) ;
293249 } ) ;
294250
295- // TODO(crbug.com/1412665): This test is flaky.
296- it . skip ( '[crbug.com/1412665] can persist the invert checkbox' , async ( { devToolsPage, inspectedPage} : {
297- devToolsPage : DevToolsPage ,
298- inspectedPage : InspectedPage ,
299- } ) => {
251+ it ( 'can persist the invert checkbox' , async ( { devToolsPage, inspectedPage} ) => {
300252 await navigateToNetworkTab ( SIMPLE_PAGE_URL , devToolsPage , inspectedPage ) ;
301253 // Start with invert disabled, then enable it.
302254 {
@@ -306,29 +258,24 @@ describe('The Network Tab', function() {
306258 expect ( await checkboxIsChecked ( invertCheckbox ) ) . to . equal ( true ) ;
307259 }
308260 // Verify persistence when enabled.
309- await reloadDevTools ( { queryParams : { panel : 'network' } } ) ;
261+ await devToolsPage . reloadWithParams ( { panel : 'network' } ) ;
310262 {
311- const { devToolsPage} = getBrowserAndPagesWrappers ( ) ;
312263 const invertCheckbox = await ( await devToolsPage . waitForAria ( 'Invert' ) ) . toElement ( 'input' ) ;
313264 expect ( await checkboxIsChecked ( invertCheckbox ) ) . to . equal ( true ) ;
314265 await invertCheckbox . click ( ) ;
315266 expect ( await checkboxIsChecked ( invertCheckbox ) ) . to . equal ( false ) ;
316267 }
317268 // Verify persistence when disabled.
318- await reloadDevTools ( { queryParams : { panel : 'network' } } ) ;
269+ await devToolsPage . reloadWithParams ( { panel : 'network' } ) ;
319270 {
320- const { devToolsPage} = getBrowserAndPagesWrappers ( ) ;
321271 const invertCheckbox = await ( await devToolsPage . waitForAria ( 'Invert' ) ) . toElement ( 'input' ) ;
322272 expect ( await checkboxIsChecked ( invertCheckbox ) ) . to . equal ( false ) ;
323273 }
324274 } ) ;
325275} ) ;
326276
327277describe ( 'The Network Tab' , function ( ) {
328- it ( 'can show only third-party requests' , async ( { devToolsPage, inspectedPage} : {
329- devToolsPage : DevToolsPage ,
330- inspectedPage : InspectedPage ,
331- } ) => {
278+ it ( 'can show only third-party requests' , async ( { devToolsPage, inspectedPage} ) => {
332279 await navigateToNetworkTab ( 'empty.html' , devToolsPage , inspectedPage ) ;
333280 await setCacheDisabled ( true , devToolsPage ) ;
334281 await setPersistLog ( false , devToolsPage ) ;
0 commit comments