Skip to content

Commit e15f4c7

Browse files
chore!: purge devtools
1 parent 7bc315b commit e15f4c7

21 files changed

Lines changed: 239 additions & 292 deletions

File tree

examples/component-testing/create-react-app/testplane.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
export default {
22
gridUrl: "local",
33
baseUrl: "http://localhost",
4-
automationProtocol: "devtools",
4+
automationProtocol: "webdriver",
55
sessionsPerBrowser: 1,
66
testsPerSession: 10,
77
windowSize: "1280x720",

package-lock.json

Lines changed: 65 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@
7777
"@jspm/core": "2.0.1",
7878
"@jsquash/png": "3.1.1",
7979
"@puppeteer/browsers": "2.7.1",
80-
"@testplane/devtools": "8.32.5",
8180
"@testplane/wdio-protocols": "9.4.7",
8281
"@testplane/wdio-utils": "9.5.4",
8382
"@testplane/webdriverio": "9.5.23",

src/browser/commands/openAndWait.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,8 @@ const makeOpenAndWaitCommand = (config: BrowserConfig, session: WebdriverIO.Brow
4040
): Promise<string | void> {
4141
const PageLoader = await import("../../utils/page-loader").then(m => m.default);
4242
const isChrome = config.desiredCapabilities?.browserName === "chrome";
43-
const isCDP = config.automationProtocol === "devtools";
4443

45-
waitNetworkIdle &&= isChrome || isCDP;
44+
waitNetworkIdle &&= isChrome;
4645

4746
const originalPageLoadTimeout = config.pageLoadTimeout;
4847
const shouldUpdateTimeout = timeout && timeout !== originalPageLoadTimeout;

src/browser/commands/restoreState/index.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ import fs from "fs-extra";
33
import { restoreStorage } from "./restoreStorage";
44

55
import type { Browser } from "../../types";
6-
import { DEVTOOLS_PROTOCOL, WEBDRIVER_PROTOCOL } from "../../../constants/config";
7-
import { getOverridesProtocol, getWebdriverFrames, SaveStateData } from "../saveState";
6+
import { isBidiWithIsolation, getWebdriverFrames, SaveStateData } from "../saveState";
87
import { getActivePuppeteerPage } from "../../existing-browser";
98
import { Cookie } from "@testplane/wdio-protocols";
109
import { StateOpts } from "../../../config/types";
@@ -40,8 +39,8 @@ export default (browser: Browser): void => {
4039
restoreState.cookies = restoreState?.cookies.filter(options.cookieFilter);
4140
}
4241

43-
switch (getOverridesProtocol(browser)) {
44-
case WEBDRIVER_PROTOCOL: {
42+
switch (isBidiWithIsolation(browser)) {
43+
case false: {
4544
await session.switchToParentFrame();
4645

4746
if (restoreState.cookies && options.cookies) {
@@ -105,7 +104,7 @@ export default (browser: Browser): void => {
105104

106105
break;
107106
}
108-
case DEVTOOLS_PROTOCOL: {
107+
case true: {
109108
const page = await getActivePuppeteerPage(session);
110109

111110
if (!page) {

src/browser/commands/saveState/index.ts

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import fs from "fs-extra";
22

33
import _ from "lodash";
44
import { dumpStorage, StorageData } from "./dumpStorage";
5-
import { DEVTOOLS_PROTOCOL, WEBDRIVER_PROTOCOL } from "../../../constants/config";
65
import { ExistingBrowser, getActivePuppeteerPage } from "../../existing-browser";
76
import * as logger from "../../../utils/logger";
87
import { Cookie } from "../../../types";
@@ -18,13 +17,9 @@ export type SaveStateData = {
1817
framesData: Record<string, FrameData>;
1918
};
2019

21-
// in case when we use webdriver protocol, bidi and isolation
22-
// we have to force change protocol to devtools, for use puppeteer,
23-
// because we use it for create incognito window
24-
export const getOverridesProtocol = (browser: Browser): typeof WEBDRIVER_PROTOCOL | typeof DEVTOOLS_PROTOCOL =>
25-
browser.config.automationProtocol === WEBDRIVER_PROTOCOL && browser.publicAPI.isBidi && browser.config.isolation
26-
? DEVTOOLS_PROTOCOL
27-
: browser.config.automationProtocol;
20+
// in case when we use bidi and isolation
21+
// we have to use puppeteer, because we use it for creating incognito window
22+
export const isBidiWithIsolation = (browser: Browser): boolean => browser.publicAPI.isBidi && browser.config.isolation;
2823

2924
export const getWebdriverFrames = async (session: WebdriverIO.Browser): Promise<string[]> =>
3025
session.execute<string[], []>(() =>
@@ -49,8 +44,8 @@ export default (browser: ExistingBrowser): void => {
4944
framesData: {},
5045
};
5146

52-
switch (getOverridesProtocol(browser)) {
53-
case WEBDRIVER_PROTOCOL: {
47+
switch (isBidiWithIsolation(browser)) {
48+
case false: {
5449
if (options.cookies) {
5550
const cookies = await session.getAllCookies();
5651

@@ -106,7 +101,7 @@ export default (browser: ExistingBrowser): void => {
106101
data.framesData = framesData;
107102
break;
108103
}
109-
case DEVTOOLS_PROTOCOL: {
104+
case true: {
110105
if (options.cookies) {
111106
const cookies = await session.getAllCookies();
112107

0 commit comments

Comments
 (0)