Skip to content

Commit 4f9d290

Browse files
committed
[js] Enabling virtual authenticator tests for Firefox
@whimboo mentioned this is supported now
1 parent c618cac commit 4f9d290

File tree

1 file changed

+31
-29
lines changed

1 file changed

+31
-29
lines changed

javascript/node/selenium-webdriver/test/virtualAuthenticator_test.js

Lines changed: 31 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ const GET_CREDENTIAL = `getCredential([{
3535
"id": Int8Array.from(arguments[0]),
3636
}]).then(arguments[arguments.length - 1]);`
3737

38-
async function createRkEnabledU2fAuthenticator(driver) {
38+
async function createRkEnabledU2fAuthenticator (driver) {
3939
let options
4040
options = new virtualAuthenticatorOptions()
4141
options.setProtocol(Protocol['U2F'])
@@ -44,7 +44,7 @@ async function createRkEnabledU2fAuthenticator(driver) {
4444
return driver
4545
}
4646

47-
async function createRkDisabledU2fAuthenticator(driver) {
47+
async function createRkDisabledU2fAuthenticator (driver) {
4848
let options
4949
options = new virtualAuthenticatorOptions()
5050
options.setProtocol(Protocol['U2F'])
@@ -53,7 +53,7 @@ async function createRkDisabledU2fAuthenticator(driver) {
5353
return driver
5454
}
5555

56-
async function createRkEnabledCTAP2Authenticator(driver) {
56+
async function createRkEnabledCTAP2Authenticator (driver) {
5757
let options
5858
options = new virtualAuthenticatorOptions()
5959
options.setProtocol(Protocol['CTAP2'])
@@ -64,7 +64,7 @@ async function createRkEnabledCTAP2Authenticator(driver) {
6464
return driver
6565
}
6666

67-
async function createRkDisabledCTAP2Authenticator(driver) {
67+
async function createRkDisabledCTAP2Authenticator (driver) {
6868
let options
6969
options = new virtualAuthenticatorOptions()
7070
options.setProtocol(Protocol['CTAP2'])
@@ -75,15 +75,15 @@ async function createRkDisabledCTAP2Authenticator(driver) {
7575
return driver
7676
}
7777

78-
async function getAssertionFor(driver, credentialId) {
78+
async function getAssertionFor (driver, credentialId) {
7979
return await driver.executeAsyncScript(GET_CREDENTIAL, credentialId)
8080
}
8181

82-
function extractRawIdFrom(response) {
82+
function extractRawIdFrom (response) {
8383
return response.credential.rawId
8484
}
8585

86-
function extractIdFrom(response) {
86+
function extractIdFrom (response) {
8787
return response.credential.id
8888
}
8989

@@ -96,7 +96,7 @@ function extractIdFrom(response) {
9696
* @param array2 Second array to be checked for equality
9797
* @returns true if equal, otherwise false.
9898
*/
99-
function arraysEqual(array1, array2) {
99+
function arraysEqual (array1, array2) {
100100
return (
101101
array1.length == array2.length &&
102102
array1.every((item) => array2.includes(item)) &&
@@ -150,7 +150,7 @@ suite(function (env) {
150150
})
151151

152152
describe('VirtualAuthenticator Test Suit 2', function () {
153-
ignore(browsers(Browser.SAFARI, Browser.FIREFOX)).it(
153+
ignore(browsers(Browser.SAFARI)).it(
154154
'should test create authenticator',
155155
async function () {
156156
/**
@@ -170,7 +170,7 @@ suite(function (env) {
170170
}
171171
)
172172

173-
ignore(browsers(Browser.SAFARI, Browser.FIREFOX)).it(
173+
ignore(browsers(Browser.SAFARI)).it(
174174
'should test remove authenticator',
175175
async function () {
176176
let options = new virtualAuthenticatorOptions()
@@ -182,7 +182,7 @@ suite(function (env) {
182182
}
183183
)
184184

185-
ignore(browsers(Browser.SAFARI, Browser.FIREFOX)).it(
185+
ignore(browsers(Browser.SAFARI)).it(
186186
'should test add non-resident credential',
187187
async function () {
188188
/**
@@ -206,7 +206,7 @@ suite(function (env) {
206206
}
207207
)
208208

209-
ignore(browsers(Browser.SAFARI, Browser.FIREFOX)).it(
209+
ignore(browsers(Browser.SAFARI)).it(
210210
'should test add non-resident credential when authenticator uses U2F protocol',
211211
async function () {
212212
/**
@@ -239,7 +239,7 @@ suite(function (env) {
239239
}
240240
)
241241

242-
ignore(browsers(Browser.SAFARI, Browser.FIREFOX)).it(
242+
ignore(browsers(Browser.SAFARI)).it(
243243
'should test add resident credential',
244244
async function () {
245245
/**
@@ -269,7 +269,7 @@ suite(function (env) {
269269
}
270270
)
271271

272-
ignore(browsers(Browser.SAFARI, Browser.FIREFOX)).it(
272+
ignore(browsers(Browser.SAFARI)).it(
273273
'should test add resident credential not supported when authenticator uses U2F protocol',
274274
async function () {
275275
/**
@@ -309,7 +309,7 @@ suite(function (env) {
309309
}
310310
)
311311

312-
ignore(browsers(Browser.SAFARI, Browser.FIREFOX)).it(
312+
ignore(browsers(Browser.SAFARI)).it(
313313
'should test get credentials',
314314
async function () {
315315
/**
@@ -321,8 +321,9 @@ suite(function (env) {
321321
* Register a resident credential.
322322
*/
323323
let response1 = await driver.executeAsyncScript(
324-
'registerCredential({authenticatorSelection: {requireResidentKey: true}})' +
325-
' .then(arguments[arguments.length - 1]);'
324+
'registerCredential({authenticatorSelection: {requireResidentKey: true}})'
325+
+
326+
' .then(arguments[arguments.length - 1]);'
326327
)
327328
assert(response1['status'] === 'OK')
328329

@@ -364,7 +365,7 @@ suite(function (env) {
364365
}
365366
)
366367

367-
ignore(browsers(Browser.SAFARI, Browser.FIREFOX)).it(
368+
ignore(browsers(Browser.SAFARI)).it(
368369
'should test remove credential by rawID',
369370
async function () {
370371
driver = await createRkDisabledU2fAuthenticator(driver)
@@ -389,7 +390,7 @@ suite(function (env) {
389390
}
390391
)
391392

392-
ignore(browsers(Browser.SAFARI, Browser.FIREFOX)).it(
393+
ignore(browsers(Browser.SAFARI)).it(
393394
'should test remove credential by base64url Id',
394395
async function () {
395396
driver = await createRkDisabledU2fAuthenticator(driver)
@@ -416,7 +417,7 @@ suite(function (env) {
416417
}
417418
)
418419

419-
ignore(browsers(Browser.SAFARI, Browser.FIREFOX)).it(
420+
ignore(browsers(Browser.SAFARI)).it(
420421
'should test remove all credentials',
421422
async function () {
422423
driver = await createRkDisabledU2fAuthenticator(driver)
@@ -442,20 +443,20 @@ suite(function (env) {
442443
*/
443444
let response = await driver.executeAsyncScript(
444445
'getCredential([{' +
445-
' "type": "public-key",' +
446-
' "id": Int8Array.from(arguments[0]),' +
447-
'}, {' +
448-
' "type": "public-key",' +
449-
' "id": Int8Array.from(arguments[1]),' +
450-
'}]).then(arguments[arguments.length - 1]);',
446+
' "type": "public-key",' +
447+
' "id": Int8Array.from(arguments[0]),' +
448+
'}, {' +
449+
' "type": "public-key",' +
450+
' "id": Int8Array.from(arguments[1]),' +
451+
'}]).then(arguments[arguments.length - 1]);',
451452
rawId1,
452453
rawId2
453454
)
454455
assert(response['status'].startsWith('NotAllowedError'))
455456
}
456457
)
457458

458-
ignore(browsers(Browser.SAFARI, Browser.FIREFOX)).it(
459+
ignore(browsers(Browser.SAFARI)).it(
459460
'should test set user verified',
460461
async function () {
461462
driver = await createRkEnabledCTAP2Authenticator(driver)
@@ -464,8 +465,9 @@ suite(function (env) {
464465
* Register a credential requiring UV.
465466
*/
466467
let response = await driver.executeAsyncScript(
467-
"registerCredential({authenticatorSelection: {userVerification: 'required'}})" +
468-
' .then(arguments[arguments.length - 1]);'
468+
'registerCredential({authenticatorSelection: {userVerification: \'required\'}})'
469+
+
470+
' .then(arguments[arguments.length - 1]);'
469471
)
470472
assert(response['status'] === 'OK')
471473
let rawId = extractRawIdFrom(response)

0 commit comments

Comments
 (0)