Skip to content

Commit 92b8346

Browse files
Lightning00BladeDevtools-frontend LUCI CQ
authored andcommitted
[test] Use frontend directly
The helpers are DevTools specific Bug: none Change-Id: If12bbc6a0c3de520b8963ebd58f0253711e17e1d Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6262910 Reviewed-by: Alina Varkki <[email protected]> Auto-Submit: Nikolay Vitkov <[email protected]> Commit-Queue: Alina Varkki <[email protected]>
1 parent b96de43 commit 92b8346

21 files changed

+74
-119
lines changed

extensions/cxx_debugging/e2e/TestDriver.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ describe('CXX Debugging Extension Test Suite', function() {
136136
await focusConsolePrompt();
137137

138138
for (const {expression, value} of evaluations) {
139-
await typeIntoConsoleAndWaitForResult(frontend, expression);
139+
await typeIntoConsoleAndWaitForResult(expression);
140140
const evaluateResults = await frontend.evaluate(() => {
141141
return Array.from(document.querySelectorAll('.console-user-command-result'))
142142
.map(node => node.textContent);

test/e2e/application/cookies_test.ts

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,8 @@ describe('The Application Tab', () => {
3737
it.skip(
3838
'[crbug.com/1443434]: shows cookies even when navigating to an unreachable page (crbug.com/1047348)',
3939
async () => {
40-
const {target} = getBrowserAndPages();
4140
// This sets a new cookie foo=bar
42-
await navigateToApplicationTab(target, 'cookies');
41+
await navigateToApplicationTab('cookies');
4342

4443
await goToResource('network/unreachable.rawresponse');
4544

@@ -50,9 +49,8 @@ describe('The Application Tab', () => {
5049
});
5150

5251
it('shows a preview of the cookie value (crbug.com/462370)', async () => {
53-
const {target} = getBrowserAndPages();
5452
// This sets a new cookie foo=bar
55-
await navigateToApplicationTab(target, 'cookies');
53+
await navigateToApplicationTab('cookies');
5654

5755
await navigateToCookiesForTopDomain();
5856

@@ -69,9 +67,8 @@ describe('The Application Tab', () => {
6967
// reflect the change from the partitionKey column to the partition key site and
7068
// cross-site columns.
7169
it.skip('[crbug.com/345285378]shows cookie partition key site and has cross site ancestor', async () => {
72-
const {target} = getBrowserAndPages();
7370
// This sets a new cookie foo=bar
74-
await navigateToApplicationTab(target, 'cookies');
71+
await navigateToApplicationTab('cookies');
7572

7673
await navigateToCookiesForTopDomain();
7774

@@ -109,9 +106,8 @@ describe('The Application Tab', () => {
109106
});
110107

111108
it('can also show the urldecoded value (crbug.com/997625)', async () => {
112-
const {target} = getBrowserAndPages();
113109
// This sets a new cookie foo=bar
114-
await navigateToApplicationTab(target, 'cookies');
110+
await navigateToApplicationTab('cookies');
115111

116112
await navigateToCookiesForTopDomain();
117113

@@ -135,9 +131,8 @@ describe('The Application Tab', () => {
135131
});
136132

137133
it('clears the preview value when clearing cookies (crbug.com/1086462)', async () => {
138-
const {target} = getBrowserAndPages();
139134
// This sets a new cookie foo=bar
140-
await navigateToApplicationTab(target, 'cookies');
135+
await navigateToApplicationTab('cookies');
141136

142137
await navigateToCookiesForTopDomain();
143138

@@ -163,9 +158,8 @@ describe('The Application Tab', () => {
163158

164159
it('only clear currently visible cookies (crbug.com/978059)', async () => {
165160
expectError('Request CacheStorage.requestCacheNames failed. {"code":-32602,"message":"Invalid security origin"}');
166-
const {target} = getBrowserAndPages();
167161
// This sets a new cookie foo=bar
168-
await navigateToApplicationTab(target, 'cookies');
162+
await navigateToApplicationTab('cookies');
169163

170164
await navigateToCookiesForTopDomain();
171165

test/e2e/application/frame-tree_test.ts

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,7 @@ const getFieldValuesTextContent = async () => {
7373
describe('The Application Tab', () => {
7474
// Update and reactivate when the whole FrameDetailsView is a custom component
7575
it.skip('[crbug.com/1519420]: shows details for a frame when clicked on in the frame tree', async () => {
76-
const {target} = getBrowserAndPages();
77-
await navigateToApplicationTab(target, 'frame-tree');
76+
await navigateToApplicationTab('frame-tree');
7877
await click('#tab-resources');
7978
await navigateToFrame('top');
8079

@@ -98,8 +97,7 @@ describe('The Application Tab', () => {
9897

9998
it('shows stack traces for OOPIF', async () => {
10099
expectError('Request CacheStorage.requestCacheNames failed. {"code":-32602,"message":"Invalid security origin"}');
101-
const {target} = getBrowserAndPages();
102-
await navigateToApplicationTab(target, 'js-oopif');
100+
await navigateToApplicationTab('js-oopif');
103101
await waitForFunction(async () => {
104102
await navigateToFrame('top');
105103
await navigateToFrame('iframe.html');
@@ -126,8 +124,7 @@ describe('The Application Tab', () => {
126124
it('stack traces for OOPIF with ignore listed frames can be expanded and collapsed', async () => {
127125
expectError('Request CacheStorage.requestCacheNames failed. {"code":-32602,"message":"Invalid security origin"}');
128126
await setIgnoreListPattern('js-oopif.js');
129-
const {target} = getBrowserAndPages();
130-
await navigateToApplicationTab(target, 'js-oopif');
127+
await navigateToApplicationTab('js-oopif');
131128
await waitForFunction(async () => {
132129
await navigateToFrame('top');
133130
await navigateToFrame('iframe.html');
@@ -190,7 +187,7 @@ describe('The Application Tab', () => {
190187

191188
it('shows details for opened windows in the frame tree', async () => {
192189
const {target, frontend} = getBrowserAndPages();
193-
await navigateToApplicationTab(target, 'frame-tree');
190+
await navigateToApplicationTab('frame-tree');
194191
await click('#tab-resources');
195192
await navigateToFrame('top');
196193

@@ -226,7 +223,7 @@ describe('The Application Tab', () => {
226223
it('shows dedicated workers in the frame tree', async () => {
227224
expectError('Request CacheStorage.requestCacheNames failed. {"code":-32602,"message":"Invalid security origin"}');
228225
const {target} = getBrowserAndPages();
229-
await navigateToApplicationTab(target, 'frame-tree');
226+
await navigateToApplicationTab('frame-tree');
230227
await navigateToFrame('top');
231228
// DevTools is not ready yet when the worker is being initially attached.
232229
// We therefore need to reload the page to see the worker in DevTools.
@@ -252,8 +249,7 @@ describe('The Application Tab', () => {
252249

253250
it('shows service workers in the frame tree', async () => {
254251
expectError('Request CacheStorage.requestCacheNames failed. {"code":-32602,"message":"Invalid security origin"}');
255-
const {target} = getBrowserAndPages();
256-
await navigateToApplicationTab(target, 'service-worker-network');
252+
await navigateToApplicationTab('service-worker-network');
257253
await navigateToFrameServiceWorkers('top');
258254
void pressKey('ArrowDown');
259255

test/e2e/application/manifest_test.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
import {assert} from 'chai';
66

7-
import {click, getBrowserAndPages, getTestServerPort, waitFor} from '../../shared/helper.js';
7+
import {click, getTestServerPort, waitFor} from '../../shared/helper.js';
88
import {getTrimmedTextContent, navigateToApplicationTab} from '../helpers/application-helpers.js';
99

1010
const MANIFEST_SELECTOR = '[aria-label="Manifest"]';
@@ -21,8 +21,7 @@ const FIELD_VALUES_SELECTOR = '.report-field-value';
2121
// npm run debug-e2etest -- -- --chrome-features=WebAppEnableManifestId
2222
describe.skip('[crbug.com/1222571]: The Manifest Page', () => {
2323
it('shows app id', async () => {
24-
const {target} = getBrowserAndPages();
25-
await navigateToApplicationTab(target, 'app-manifest-id');
24+
await navigateToApplicationTab('app-manifest-id');
2625
await click(MANIFEST_SELECTOR);
2726
await waitFor(APP_ID_SELECTOR);
2827

@@ -33,8 +32,7 @@ describe.skip('[crbug.com/1222571]: The Manifest Page', () => {
3332
});
3433

3534
it('shows start id as app id', async () => {
36-
const {target} = getBrowserAndPages();
37-
await navigateToApplicationTab(target, 'app-manifest-no-id');
35+
await navigateToApplicationTab('app-manifest-no-id');
3836
await click(MANIFEST_SELECTOR);
3937
await waitFor(APP_ID_SELECTOR);
4038

test/e2e/application/reporting-api_test.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import {assert} from 'chai';
66

77
import {
88
click,
9-
getBrowserAndPages,
109
getTestServerPort,
1110
goToResource,
1211
waitFor,
@@ -18,14 +17,12 @@ const REPORTING_API_SELECTOR = '[aria-label="Reporting API"]';
1817

1918
describe('The Reporting API Page', () => {
2019
beforeEach(async () => {
21-
const {target} = getBrowserAndPages();
22-
await navigateToApplicationTab(target, 'empty');
20+
await navigateToApplicationTab('empty');
2321
});
2422

2523
// Flaky on mac
2624
it.skipOnPlatforms(['mac'], '[crbug.com/1482688] shows reports', async () => {
27-
const {target} = getBrowserAndPages();
28-
await navigateToApplicationTab(target, 'reporting-api');
25+
await navigateToApplicationTab('reporting-api');
2926
await click(REPORTING_API_SELECTOR);
3027
const dataGrid = await getDataGrid();
3128
const innerText = await getInnerTextOfDataGridCells(dataGrid, 1, false);

test/e2e/application/service-worker-network_test.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44
import {unregisterAllServiceWorkers} from '../../conductor/hooks.js';
5-
import {click, getBrowserAndPages, step} from '../../shared/helper.js';
5+
import {click, step} from '../../shared/helper.js';
66
import {
77
navigateToApplicationTab,
88
navigateToServiceWorkers,
@@ -17,8 +17,7 @@ const SERVICE_WORKER_NETWORK_SELECTOR = '[title="Network requests"]';
1717

1818
describe('The Application Tab', () => {
1919
beforeEach(async () => {
20-
const {target} = getBrowserAndPages();
21-
await navigateToApplicationTab(target, TEST_HTML_FILE);
20+
await navigateToApplicationTab(TEST_HTML_FILE);
2221
await navigateToServiceWorkers();
2322
});
2423

test/e2e/application/service-worker-update_test.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import {assert} from 'chai';
55

66
import {unregisterAllServiceWorkers} from '../../conductor/hooks.js';
7-
import {getBrowserAndPages, step, waitFor} from '../../shared/helper.js';
7+
import {step, waitFor} from '../../shared/helper.js';
88
import {
99
navigateToApplicationTab,
1010
navigateToServiceWorkers,
@@ -16,8 +16,7 @@ const SERVICE_WORKER_UPDATE_TIMELINE_SELECTOR = '.service-worker-update-timing-t
1616

1717
describe('The Application Tab', function() {
1818
beforeEach(async function() {
19-
const {target} = getBrowserAndPages();
20-
await navigateToApplicationTab(target, TEST_HTML_FILE);
19+
await navigateToApplicationTab(TEST_HTML_FILE);
2120
await navigateToServiceWorkers();
2221
});
2322

test/e2e/application/session-storage_test.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
import {assert} from 'chai';
66

7-
import {getBrowserAndPages, step} from '../../shared/helper.js';
7+
import {step} from '../../shared/helper.js';
88
import {
99
deleteSelectedStorageItem,
1010
getStorageItemsData,
@@ -15,10 +15,8 @@ import {
1515

1616
describe('The Application Tab', () => {
1717
it('shows Session Storage keys and values', async () => {
18-
const {target} = getBrowserAndPages();
19-
2018
await step('navigate to session-storage resource and open Application tab', async () => {
21-
await navigateToApplicationTab(target, 'session-storage');
19+
await navigateToApplicationTab('session-storage');
2220
});
2321

2422
await step('open the domain storage', async () => {
@@ -41,9 +39,7 @@ describe('The Application Tab', () => {
4139
});
4240

4341
it('can delete selected items', async () => {
44-
const {target} = getBrowserAndPages();
45-
46-
await navigateToApplicationTab(target, 'session-storage');
42+
await navigateToApplicationTab('session-storage');
4743

4844
await navigateToSessionStorageForTopDomain();
4945

test/e2e/application/shared-storage_test.ts

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import {expectError} from '../../conductor/events.js';
88
import {
99
$$,
1010
clickElement,
11-
getBrowserAndPages,
1211
getTestServerPort,
1312
goToResource,
1413
step,
@@ -41,11 +40,9 @@ describe('The Application Tab', () => {
4140

4241
// Failing test.
4342
it.skip('[crbug.com/1485830]: shows Shared Storage events', async () => {
44-
const {target} = getBrowserAndPages();
45-
4643
await step('navigate to shared-storage resource and open Application tab', async () => {
4744
// Events are not recorded because tracking is not yet enabled.
48-
await navigateToApplicationTab(target, 'shared-storage');
45+
await navigateToApplicationTab('shared-storage');
4946
});
5047

5148
await step('open the events view', async () => {
@@ -85,10 +82,8 @@ describe('The Application Tab', () => {
8582

8683
// Failing test.
8784
it.skip('[crbug.com/1485830]: shows Shared Storage metadata', async () => {
88-
const {target} = getBrowserAndPages();
89-
9085
await step('navigate to shared-storage resource and open Application tab', async () => {
91-
await navigateToApplicationTab(target, 'shared-storage');
86+
await navigateToApplicationTab('shared-storage');
9287
});
9388

9489
await step('open the domain storage', async () => {
@@ -104,10 +99,8 @@ describe('The Application Tab', () => {
10499

105100
// Failing test.
106101
it.skip('[crbug.com/1485830]: shows Shared Storage keys and values', async () => {
107-
const {target} = getBrowserAndPages();
108-
109102
await step('navigate to shared-storage resource and open Application tab', async () => {
110-
await navigateToApplicationTab(target, 'shared-storage');
103+
await navigateToApplicationTab('shared-storage');
111104
});
112105

113106
await step('open the domain storage', async () => {

test/e2e/application/storage_test.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@ describe('The Application Tab', () => {
2121
// The tests in this suite are particularly slow, as they perform a lot of actions
2222
this.timeout(20000);
2323
beforeEach(async () => {
24-
const {target} = getBrowserAndPages();
25-
await navigateToApplicationTab(target, 'storage-quota');
24+
await navigateToApplicationTab('storage-quota');
2625
await navigateToStorage();
2726
});
2827

0 commit comments

Comments
 (0)