authelia/test/features/step_definitions/registration.ts

14 lines
514 B
TypeScript
Raw Normal View History

2018-03-29 05:04:59 +07:00
import {When} from "cucumber";
import seleniumWebdriver = require("selenium-webdriver");
import Assert = require("assert");
2018-03-29 05:04:59 +07:00
When("the otpauth url has label {string} and issuer \
{string}", 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));
})
});