Skip to content

Commit

Permalink
fix e2e
Browse files Browse the repository at this point in the history
  • Loading branch information
adamraine committed Oct 19, 2023
1 parent c22c24f commit c85ce8e
Showing 1 changed file with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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 () => {
Expand Down

0 comments on commit c85ce8e

Please sign in to comment.