Replace WaitRedirected assertion by VerifyUrlIs.
parent
036d1a4f51
commit
3702d6607d
|
@ -1,5 +0,0 @@
|
|||
import SeleniumWebdriver, { WebDriver } from "selenium-webdriver";
|
||||
|
||||
export default async function(driver: WebDriver, url: string, timeout: number = 5000) {
|
||||
await driver.wait(SeleniumWebdriver.until.urlIs(url), timeout);
|
||||
}
|
|
@ -1,7 +1,6 @@
|
|||
import LoginAndRegisterTotp from "../../../helpers/LoginAndRegisterTotp";
|
||||
import FillLoginPageWithUserAndPasswordAndClick from "../../../helpers/FillLoginPageAndClick";
|
||||
import ValidateTotp from "../../../helpers/ValidateTotp";
|
||||
import WaitRedirected from "../../../helpers/WaitRedirected";
|
||||
import { WebDriver } from "selenium-webdriver";
|
||||
import VisitPageAndWaitUrlIs from "../../../helpers/behaviors/VisitPageAndWaitUrlIs";
|
||||
import VisitPage from "../../../helpers/VisitPage";
|
||||
|
@ -19,11 +18,11 @@ export default function(this: Mocha.ISuiteCallbackContext) {
|
|||
await VisitPageAndWaitUrlIs(driver, "https://login.example.com:8080/?rd=https://admin.example.com:8080/secret.html");
|
||||
await FillLoginPageWithUserAndPasswordAndClick(driver, 'john', 'password', false);
|
||||
await ValidateTotp(driver, this.secret);
|
||||
await WaitRedirected(driver, "https://admin.example.com:8080/secret.html");
|
||||
await VerifyUrlIs(driver, "https://admin.example.com:8080/secret.html");
|
||||
await VisitPageAndWaitUrlIs(driver, "https://home.example.com:8080/");
|
||||
await driver.sleep(6000);
|
||||
await driver.get("https://admin.example.com:8080/secret.html");
|
||||
await WaitRedirected(driver, "https://login.example.com:8080/?rd=https://admin.example.com:8080/secret.html");
|
||||
await VerifyUrlIs(driver, "https://login.example.com:8080/?rd=https://admin.example.com:8080/secret.html");
|
||||
});
|
||||
|
||||
it('should disconnect user after cookie expiration', async function() {
|
||||
|
@ -31,7 +30,7 @@ export default function(this: Mocha.ISuiteCallbackContext) {
|
|||
await VisitPageAndWaitUrlIs(driver, "https://login.example.com:8080/?rd=https://admin.example.com:8080/secret.html");
|
||||
await FillLoginPageWithUserAndPasswordAndClick(driver, 'john', 'password', false);
|
||||
await ValidateTotp(driver, this.secret);
|
||||
await WaitRedirected(driver, "https://admin.example.com:8080/secret.html");
|
||||
await VerifyUrlIs(driver, "https://admin.example.com:8080/secret.html");
|
||||
await VisitPageAndWaitUrlIs(driver, "https://home.example.com:8080/");
|
||||
|
||||
await driver.sleep(4000);
|
||||
|
@ -41,7 +40,7 @@ export default function(this: Mocha.ISuiteCallbackContext) {
|
|||
|
||||
await driver.sleep(2000);
|
||||
await driver.get("https://admin.example.com:8080/secret.html");
|
||||
await WaitRedirected(driver, "https://login.example.com:8080/?rd=https://admin.example.com:8080/secret.html");
|
||||
await VerifyUrlIs(driver, "https://login.example.com:8080/?rd=https://admin.example.com:8080/secret.html");
|
||||
|
||||
});
|
||||
|
||||
|
@ -51,7 +50,7 @@ export default function(this: Mocha.ISuiteCallbackContext) {
|
|||
await VisitPageAndWaitUrlIs(driver, "https://login.example.com:8080/?rd=https://admin.example.com:8080/secret.html");
|
||||
await FillLoginPageWithUserAndPasswordAndClick(driver, 'john', 'password', true);
|
||||
await ValidateTotp(driver, this.secret);
|
||||
await WaitRedirected(driver, "https://admin.example.com:8080/secret.html");
|
||||
await VerifyUrlIs(driver, "https://admin.example.com:8080/secret.html");
|
||||
await VisitPageAndWaitUrlIs(driver, "https://home.example.com:8080/");
|
||||
await driver.sleep(6000);
|
||||
await VisitPage(driver, "https://admin.example.com:8080/secret.html");
|
||||
|
|
|
@ -2,22 +2,22 @@ import SeleniumWebDriver from 'selenium-webdriver';
|
|||
|
||||
import ClickOnLink from '../../../helpers/ClickOnLink';
|
||||
import ClickOn from '../../../helpers/ClickOn';
|
||||
import WaitRedirected from '../../../helpers/WaitRedirected';
|
||||
import FillField from "../../../helpers/FillField";
|
||||
import {GetLinkFromEmail} from "../../../helpers/GetIdentityLink";
|
||||
import FillLoginPageAndClick from "../../../helpers/FillLoginPageAndClick";
|
||||
import IsSecondFactorStage from "../../../helpers/assertions/VerifyIsSecondFactorStage";
|
||||
import VisitPageAndWaitUrlIs from '../../../helpers/behaviors/VisitPageAndWaitUrlIs';
|
||||
import VerifyNotificationDisplayed from '../../../helpers/assertions/VerifyNotificationDisplayed';
|
||||
import VerifyUrlIs from '../../../helpers/assertions/VerifyUrlIs';
|
||||
|
||||
export default function() {
|
||||
it("should reset password for john", async function() {
|
||||
await VisitPageAndWaitUrlIs(this.driver, "https://login.example.com:8080/");
|
||||
await ClickOnLink(this.driver, "Forgot password\?");
|
||||
await WaitRedirected(this.driver, "https://login.example.com:8080/forgot-password");
|
||||
await VerifyUrlIs(this.driver, "https://login.example.com:8080/forgot-password");
|
||||
await FillField(this.driver, "username", "john");
|
||||
await ClickOn(this.driver, SeleniumWebDriver.By.id('next-button'));
|
||||
await WaitRedirected(this.driver, 'https://login.example.com:8080/confirmation-sent');
|
||||
await VerifyUrlIs(this.driver, 'https://login.example.com:8080/confirmation-sent');
|
||||
|
||||
await this.driver.sleep(500); // Simulate the time it takes to receive the e-mail.
|
||||
const link = await GetLinkFromEmail();
|
||||
|
@ -25,7 +25,7 @@ export default function() {
|
|||
await FillField(this.driver, "password1", "newpass");
|
||||
await FillField(this.driver, "password2", "newpass");
|
||||
await ClickOn(this.driver, SeleniumWebDriver.By.id('reset-button'));
|
||||
await WaitRedirected(this.driver, "https://login.example.com:8080/");
|
||||
await VerifyUrlIs(this.driver, "https://login.example.com:8080/");
|
||||
await FillLoginPageAndClick(this.driver, "john", "newpass");
|
||||
|
||||
// The user reaches the second factor page using the new password.
|
||||
|
@ -35,21 +35,21 @@ export default function() {
|
|||
it("should persuade reset password is initiated for unknown user", async function() {
|
||||
await VisitPageAndWaitUrlIs(this.driver, "https://login.example.com:8080/");
|
||||
await ClickOnLink(this.driver, "Forgot password\?");
|
||||
await WaitRedirected(this.driver, "https://login.example.com:8080/forgot-password");
|
||||
await VerifyUrlIs(this.driver, "https://login.example.com:8080/forgot-password");
|
||||
await FillField(this.driver, "username", "unknown");
|
||||
await ClickOn(this.driver, SeleniumWebDriver.By.id('next-button'));
|
||||
|
||||
// The malicious user thinks the confirmation has been sent.
|
||||
await WaitRedirected(this.driver, 'https://login.example.com:8080/confirmation-sent');
|
||||
await VerifyUrlIs(this.driver, 'https://login.example.com:8080/confirmation-sent');
|
||||
});
|
||||
|
||||
it("should notify passwords are different in reset form", async function() {
|
||||
await VisitPageAndWaitUrlIs(this.driver, "https://login.example.com:8080/");
|
||||
await ClickOnLink(this.driver, "Forgot password\?");
|
||||
await WaitRedirected(this.driver, "https://login.example.com:8080/forgot-password");
|
||||
await VerifyUrlIs(this.driver, "https://login.example.com:8080/forgot-password");
|
||||
await FillField(this.driver, "username", "john");
|
||||
await ClickOn(this.driver, SeleniumWebDriver.By.id('next-button'));
|
||||
await WaitRedirected(this.driver, 'https://login.example.com:8080/confirmation-sent');
|
||||
await VerifyUrlIs(this.driver, 'https://login.example.com:8080/confirmation-sent');
|
||||
|
||||
await this.driver.sleep(500); // Simulate the time it takes to receive the e-mail.
|
||||
const link = await GetLinkFromEmail();
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
import FillLoginPageWithUserAndPasswordAndClick from '../../../helpers/FillLoginPageAndClick';
|
||||
import WaitRedirected from '../../../helpers/WaitRedirected';
|
||||
import ValidateTotp from '../../../helpers/ValidateTotp';
|
||||
import VerifySecretObserved from "../../../helpers/assertions/VerifySecretObserved";
|
||||
import LoginAndRegisterTotp from '../../../helpers/LoginAndRegisterTotp';
|
||||
import { AUTHENTICATION_TOTP_FAILED } from '../../../../shared/UserMessages';
|
||||
import VisitPageAndWaitUrlIs from '../../../helpers/behaviors/VisitPageAndWaitUrlIs';
|
||||
import VerifyNotificationDisplayed from '../../../helpers/assertions/VerifyNotificationDisplayed';
|
||||
import VerifyUrlIs from '../../../helpers/assertions/VerifyUrlIs';
|
||||
|
||||
export default function() {
|
||||
/**
|
||||
|
@ -21,7 +21,7 @@ export default function() {
|
|||
await VisitPageAndWaitUrlIs(this.driver, "https://login.example.com:8080/?rd=https://admin.example.com:8080/secret.html");
|
||||
await FillLoginPageWithUserAndPasswordAndClick(this.driver, 'john', 'password');
|
||||
await ValidateTotp(this.driver, secret);
|
||||
await WaitRedirected(this.driver, "https://admin.example.com:8080/secret.html");
|
||||
await VerifyUrlIs(this.driver, "https://admin.example.com:8080/secret.html");
|
||||
});
|
||||
|
||||
it("should access the secret", async function() {
|
||||
|
|
Loading…
Reference in New Issue