Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
Rostislav Provodenko committed Jun 28, 2023
1 parent 59304ef commit 61f1696
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
12 changes: 6 additions & 6 deletions src/browser/existing-browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ const Camera = require("./camera");
const clientBridge = require("./client-bridge");
const history = require("./history");
const logger = require("../utils/logger");
const dns = require('node:dns');
const dns = require("node:dns");

dns.setDefaultResultOrder('ipv4first'); //https://github.com/webdriverio/webdriverio/issues/8279
dns.setDefaultResultOrder("ipv4first"); //https://github.com/webdriverio/webdriverio/issues/8279

const OPTIONAL_SESSION_OPTS = ["transformRequest", "transformResponse"];

Expand Down Expand Up @@ -88,22 +88,22 @@ module.exports = class ExistingBrowser extends Browser {

for (let handle of currentOpenWindows) {
try {
await this._session.switchToWindow(handle)
await this._session.switchToWindow(handle);
await this._session.closeWindow();
} catch (e) {
if (!e.message.includes("no such window")) {
throw e;
}
}
}

if (this._browserContext) {
this._browserContext.close();
}
this._browserContext = context;

const [newWindow] = await this._session.getWindowHandles();
await this._session.switchToWindow(newWindow)
await this._session.switchToWindow(newWindow);
}

markAsBroken() {
Expand Down
7 changes: 6 additions & 1 deletion test/src/browser/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,12 @@ exports.mkSessionStub_ = () => {
session.waitUntil = sinon.stub().named("waitUntil").resolves();
session.setTimeout = sinon.stub().named("setTimeout").resolves();
session.setTimeouts = sinon.stub().named("setTimeouts").resolves();
session.getPuppeteer = sinon.stub().named("getPuppeteer").resolves({});
session.getPuppeteer = sinon
.stub()
.named("getPuppeteer")
.resolves({ createIncognitoBrowserContext: () => ({ newPage: () => {}, close: () => {} }) });
session.getWindowHandles = sinon.stub().named("getWindowHandles").resolves([]);
session.switchToWindow = sinon.stub().named("switchToWindow").resolves();
session.$ = sinon.stub().named("$").resolves(element);

session.addCommand = sinon.stub().callsFake((name, command, isElement) => {
Expand Down

0 comments on commit 61f1696

Please sign in to comment.