diff --git a/third-party/devtools-tests/e2e/lighthouse/devtools-settings_test.ts b/third-party/devtools-tests/e2e/lighthouse/devtools-settings_test.ts index 2e00454f8c96..1a7afd2e7ac0 100644 --- a/third-party/devtools-tests/e2e/lighthouse/devtools-settings_test.ts +++ b/third-party/devtools-tests/e2e/lighthouse/devtools-settings_test.ts @@ -12,7 +12,7 @@ import { waitForAria, waitForElementWithTextContent, } from '../../shared/helper.js'; -import {describe} from '../../shared/mocha-extensions.js'; +import {describe, it} from '../../shared/mocha-extensions.js'; import {openDeviceToolbar, reloadDockableFrontEnd, selectDevice} from '../helpers/emulation-helpers.js'; import { clickStartButton, @@ -57,23 +57,23 @@ describe('DevTools', function() { // the designated tests in network-request-blocking-panel_test.ts are skipped by default due to flakiness. beforeEach(async () => { const {frontend} = getBrowserAndPages(); - await frontend.evaluate(() => { - // @ts-ignore layout test global - const networkManager = self.SDK.multitargetNetworkManager; + await frontend.evaluate(`(async () => { + const SDK = await import('./core/sdk/sdk.js'); + const networkManager = SDK.NetworkManager.MultitargetNetworkManager.instance(); networkManager.setBlockingEnabled(true); networkManager.setBlockedPatterns([{enabled: true, url: '*.css'}]); - }); + })()`); }); // Reset request blocking state afterEach(async () => { const {frontend} = getBrowserAndPages(); - await frontend.evaluate(() => { - // @ts-ignore layout test global - const networkManager = globalThis.SDK.multitargetNetworkManager; + await frontend.evaluate(`(async () => { + const SDK = await import('./core/sdk/sdk.js'); + const networkManager = SDK.NetworkManager.MultitargetNetworkManager.instance(); networkManager.setBlockingEnabled(false); networkManager.setBlockedPatterns([]); - }); + })()`); }); it('is respected during a lighthouse run', async () => {