1
0
mirror of https://github.com/0rangebananaspy/authelia.git synced 2024-09-14 22:47:21 +07:00
authelia/test/helpers/behaviors/RegisterAndLoginTwoFactor.ts
2019-11-01 19:03:22 +01:00

20 lines
778 B
TypeScript

import { WebDriver } from "selenium-webdriver";
import LoginAndRegisterTotp from "../LoginAndRegisterTotp";
import VerifyUrlIs from "../assertions/VerifyUrlIs";
import VisitPageAndWaitUrlIs from "./VisitPageAndWaitUrlIs";
import ValidateTotp from "../ValidateTotp";
export default async function(
driver: WebDriver,
username: string,
password: string,
email: boolean = false,
targetUrl: string = "https://login.example.com:8080/#/",
timeout: number = 5000) {
const secret = await LoginAndRegisterTotp(driver, username, password, email, timeout);
await VisitPageAndWaitUrlIs(driver, `https://login.example.com:8080/#/?rd=${targetUrl}`, timeout);
await ValidateTotp(driver, secret, timeout);
await VerifyUrlIs(driver, targetUrl, timeout);
return secret;
};