mirror of
https://github.com/0rangebananaspy/authelia.git
synced 2024-09-14 22:47:21 +07:00
16 lines
632 B
TypeScript
16 lines
632 B
TypeScript
|
import Cucumber = require("cucumber");
|
||
|
import seleniumWebdriver = require("selenium-webdriver");
|
||
|
import Assert = require("assert");
|
||
|
|
||
|
Cucumber.defineSupportCode(function ({ Given, When, Then }) {
|
||
|
When("the otpauth url has label {stringInDoubleQuotes} and issuer \
|
||
|
{stringInDoubleQuotes}", function (label: string, issuer: string) {
|
||
|
return this.driver.findElement(seleniumWebdriver.By.id("qrcode"))
|
||
|
.getAttribute("title")
|
||
|
.then(function (title: string) {
|
||
|
const re = `^otpauth://totp/${label}\\?secret=[A-Z0-9]+&issuer=${issuer}$`;
|
||
|
Assert(new RegExp(re).test(title));
|
||
|
})
|
||
|
});
|
||
|
});
|