Fetch state after logging out.
parent
9d7224b7ad
commit
0571df4058
|
@ -1,5 +1,4 @@
|
||||||
|
#!/bin/bash
|
||||||
set -e
|
|
||||||
|
|
||||||
export PATH=./cmd/authelia-scripts/:/tmp:$PATH
|
export PATH=./cmd/authelia-scripts/:/tmp:$PATH
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
import { connect } from 'react-redux';
|
||||||
|
import { Dispatch } from 'redux';
|
||||||
|
import { RootState } from '../../../reducers';
|
||||||
|
import LogoutView, { DispatchProps } from '../../../views/LogoutView/LogoutView';
|
||||||
|
import LogoutBehavior from '../../../behaviors/LogoutBehavior';
|
||||||
|
|
||||||
|
const mapStateToProps = (state: RootState) => {
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
const mapDispatchToProps = (dispatch: Dispatch): DispatchProps => {
|
||||||
|
return {
|
||||||
|
onInit: () => LogoutBehavior(dispatch),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default connect(mapStateToProps, mapDispatchToProps)(LogoutView);
|
|
@ -4,7 +4,7 @@ import SecurityKeyRegistrationView from "../containers/views/SecurityKeyRegistra
|
||||||
import ForgotPasswordView from "../containers/views/ForgotPasswordView/ForgotPasswordView";
|
import ForgotPasswordView from "../containers/views/ForgotPasswordView/ForgotPasswordView";
|
||||||
import ResetPasswordView from "../containers/views/ResetPasswordView/ResetPasswordView";
|
import ResetPasswordView from "../containers/views/ResetPasswordView/ResetPasswordView";
|
||||||
import AuthenticationView from "../containers/views/AuthenticationView/AuthenticationView";
|
import AuthenticationView from "../containers/views/AuthenticationView/AuthenticationView";
|
||||||
import LogoutView from "../views/LogoutView/LogoutView";
|
import LogoutView from "../containers/views/LogoutView/LogoutView";
|
||||||
|
|
||||||
export const routes = [{
|
export const routes = [{
|
||||||
path: '/',
|
path: '/',
|
||||||
|
|
|
@ -1,13 +1,15 @@
|
||||||
import React from "react"
|
import React from "react"
|
||||||
import { Redirect } from "react-router";
|
import { Redirect } from "react-router";
|
||||||
|
|
||||||
async function logout() {
|
export interface DispatchProps {
|
||||||
return fetch("/api/logout", {method: "POST"})
|
onInit: () => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default class LogoutView extends React.Component {
|
type Props = DispatchProps;
|
||||||
componentDidMount() {
|
|
||||||
logout().catch(console.error);
|
export default class LogoutView extends React.Component<Props> {
|
||||||
|
componentWillMount() {
|
||||||
|
this.props.onInit();
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
|
|
@ -152,10 +152,12 @@ var SuitesTestCmd = &cobra.Command{
|
||||||
runSuiteTests(suite, runningSuite == "")
|
runSuiteTests(suite, runningSuite == "")
|
||||||
} else {
|
} else {
|
||||||
if runningSuite != "" {
|
if runningSuite != "" {
|
||||||
panic(errors.New("Cannot run all tests while a suite is currently running. Shutdown running suite and retry"))
|
fmt.Println("Running suite (" + runningSuite + ") detected. Run tests of that suite")
|
||||||
|
runSuiteTests(runningSuite, false)
|
||||||
|
} else {
|
||||||
|
fmt.Println("No suite provided therefore all suites will be tested")
|
||||||
|
runAllSuites()
|
||||||
}
|
}
|
||||||
fmt.Println("No suite provided therefore all suites will be tested")
|
|
||||||
runAllSuites()
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
Args: cobra.MaximumNArgs(1),
|
Args: cobra.MaximumNArgs(1),
|
||||||
|
@ -193,11 +195,9 @@ func runSuiteTests(suite string, withEnv bool) {
|
||||||
var cmd *exec.Cmd
|
var cmd *exec.Cmd
|
||||||
|
|
||||||
if withEnv {
|
if withEnv {
|
||||||
fmt.Println("No running suite detected, setting up an environment for running the tests")
|
|
||||||
cmd = CommandWithStdout("bash", "-c",
|
cmd = CommandWithStdout("bash", "-c",
|
||||||
"./node_modules/.bin/ts-node ./scripts/run-environment.ts "+suite+" '"+mochaCmdLine+"'")
|
"./node_modules/.bin/ts-node ./scripts/run-environment.ts "+suite+" '"+mochaCmdLine+"'")
|
||||||
} else {
|
} else {
|
||||||
fmt.Println("Running suite detected. Running tests...")
|
|
||||||
cmd = CommandWithStdout("bash", "-c", mochaCmdLine)
|
cmd = CommandWithStdout("bash", "-c", mochaCmdLine)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -209,7 +209,7 @@ func runSuiteTests(suite string, withEnv bool) {
|
||||||
err := cmd.Run()
|
err := cmd.Run()
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
os.Exit(1)
|
panic(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,8 @@
|
||||||
import { WebDriver } from "selenium-webdriver";
|
import { WebDriver } from "selenium-webdriver";
|
||||||
import LoginAndRegisterTotp from "../LoginAndRegisterTotp";
|
import LoginAndRegisterTotp from "../LoginAndRegisterTotp";
|
||||||
import FullLogin from "../FullLogin";
|
|
||||||
import VerifyUrlIs from "../assertions/VerifyUrlIs";
|
import VerifyUrlIs from "../assertions/VerifyUrlIs";
|
||||||
import VisitPageAndWaitUrlIs from "./VisitPageAndWaitUrlIs";
|
import VisitPageAndWaitUrlIs from "./VisitPageAndWaitUrlIs";
|
||||||
import ValidateTotp from "../ValidateTotp";
|
import ValidateTotp from "../ValidateTotp";
|
||||||
import FillLoginPageAndClick from "../FillLoginPageAndClick";
|
|
||||||
|
|
||||||
export default async function(
|
export default async function(
|
||||||
driver: WebDriver,
|
driver: WebDriver,
|
||||||
|
|
|
@ -28,10 +28,7 @@ export default function(timeout: number = 5000) {
|
||||||
it("should redirect to portal if not enough authorized", async function() {
|
it("should redirect to portal if not enough authorized", async function() {
|
||||||
await LoginOneFactor(this.driver, "john", "password", "https://singlefactor.example.com:8080/secret.html", timeout);
|
await LoginOneFactor(this.driver, "john", "password", "https://singlefactor.example.com:8080/secret.html", timeout);
|
||||||
await VisitPage(this.driver, "https://admin.example.com:8080/secret.html");
|
await VisitPage(this.driver, "https://admin.example.com:8080/secret.html");
|
||||||
|
|
||||||
// the url should be the one from the portal.
|
|
||||||
await VerifyUrlContains(this.driver, "https://login.example.com:8080/#/?rd=https://admin.example.com:8080/secret.html", timeout);
|
|
||||||
|
|
||||||
// And the user should end up on the second factor page.
|
// And the user should end up on the second factor page.
|
||||||
await VerifyIsSecondFactorStage(this.driver, timeout);
|
await VerifyIsSecondFactorStage(this.driver, timeout);
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue