From 03415474312fff1f90355a3cae65ddd3850207dd Mon Sep 17 00:00:00 2001 From: KobeNguyenT <7845001+kobenguyent@users.noreply.github.com> Date: Thu, 21 Dec 2023 06:36:05 +0100 Subject: [PATCH] fix(puppeteer): hide deprecation info (#4075) --- lib/helper/Puppeteer.js | 4 +++- test/helper/Puppeteer_test.js | 8 ++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/helper/Puppeteer.js b/lib/helper/Puppeteer.js index ccbfb61c1..061e1bae6 100644 --- a/lib/helper/Puppeteer.js +++ b/lib/helper/Puppeteer.js @@ -259,6 +259,7 @@ class Puppeteer extends Helper { headless: !this.options.show, ...this._getOptions(config), }; + if (this.puppeteerOptions.headless) this.puppeteerOptions.headless = 'new'; this.isRemoteBrowser = !!this.puppeteerOptions.browserWSEndpoint; popupStore.defaultAction = this.options.defaultPopupAction; } @@ -742,7 +743,8 @@ class Puppeteer extends Helper { assertElementExists(els, locator, 'Element to focus'); const el = els[0]; - await focusElement(el, this.page); + await el.click(); + await el.focus(); return this._waitForAction(); } diff --git a/test/helper/Puppeteer_test.js b/test/helper/Puppeteer_test.js index c5ef748d9..7623f9536 100644 --- a/test/helper/Puppeteer_test.js +++ b/test/helper/Puppeteer_test.js @@ -137,8 +137,12 @@ describe('Puppeteer', function () { }); it('should be unauthenticated ', async () => { - await I.amOnPage('/basic_auth'); - await I.dontSee('You entered admin as your password.'); + try { + await I.amOnPage('/basic_auth'); + await I.dontSee('You entered admin as your password.'); + } catch (e) { + expect(e.message).to.eq('net::ERR_INVALID_AUTH_CREDENTIALS at http://localhost:8000/basic_auth'); + } }); });