Skip to content

Commit

Permalink
[bidi][js] Add test for basic auth network event
Browse files Browse the repository at this point in the history
  • Loading branch information
pujagani committed Jan 24, 2024
1 parent fa658f4 commit fe77555
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions javascript/node/selenium-webdriver/test/bidi/network_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit fe77555

Please sign in to comment.