From fe77555cd2ba0a79771ca284f7ea608545ddd780 Mon Sep 17 00:00:00 2001 From: Puja Jagani Date: Wed, 24 Jan 2024 11:39:37 +0530 Subject: [PATCH] [bidi][js] Add test for basic auth network event --- .../test/bidi/network_test.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/javascript/node/selenium-webdriver/test/bidi/network_test.js b/javascript/node/selenium-webdriver/test/bidi/network_test.js index a91437d066b4b..01acc2c5cdd26 100644 --- a/javascript/node/selenium-webdriver/test/bidi/network_test.js +++ b/javascript/node/selenium-webdriver/test/bidi/network_test.js @@ -186,6 +186,25 @@ suite( assert.equal(onResponseCompleted[0].redirectCount, 0) }) + xit('can listen to auth required event', async function () { + let authRequiredEvent = null + const inspector = await NetworkInspector(driver) + await inspector.authRequired(function (event) { + authRequiredEvent = event + }) + + await driver.get(Pages.basicAuth) + + const url = authRequiredEvent.request.url + assert.equal(authRequiredEvent.id, await driver.getWindowHandle()) + assert.equal(authRequiredEvent.request.method, 'GET') + assert.equal(url.includes('basicAuth'), true) + + assert.equal(authRequiredEvent.response.status, 401) + assert.equal(authRequiredEvent.response.headers.length > 1, true) + assert.equal(authRequiredEvent.response.url.includes('basicAuth'), true) + }) + it('test response completed mime type', async function () { let onResponseCompleted = [] const inspector = await NetworkInspector(driver)