Fetch state after logging out.

pull/424/head
Clement Michaud 2019-11-01 16:08:22 +01:00 committed by Clément Michaud
parent 9d7224b7ad
commit 0571df4058
7 changed files with 33 additions and 20 deletions

View File

@ -1,5 +1,4 @@
set -e
#!/bin/bash
export PATH=./cmd/authelia-scripts/:/tmp:$PATH

View File

@ -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);

View File

@ -4,7 +4,7 @@ import SecurityKeyRegistrationView from "../containers/views/SecurityKeyRegistra
import ForgotPasswordView from "../containers/views/ForgotPasswordView/ForgotPasswordView";
import ResetPasswordView from "../containers/views/ResetPasswordView/ResetPasswordView";
import AuthenticationView from "../containers/views/AuthenticationView/AuthenticationView";
import LogoutView from "../views/LogoutView/LogoutView";
import LogoutView from "../containers/views/LogoutView/LogoutView";
export const routes = [{
path: '/',

View File

@ -1,13 +1,15 @@
import React from "react"
import { Redirect } from "react-router";
async function logout() {
return fetch("/api/logout", {method: "POST"})
export interface DispatchProps {
onInit: () => void;
}
export default class LogoutView extends React.Component {
componentDidMount() {
logout().catch(console.error);
type Props = DispatchProps;
export default class LogoutView extends React.Component<Props> {
componentWillMount() {
this.props.onInit();
}
render() {

View File

@ -152,11 +152,13 @@ var SuitesTestCmd = &cobra.Command{
runSuiteTests(suite, runningSuite == "")
} else {
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()
}
}
},
Args: cobra.MaximumNArgs(1),
}
@ -193,11 +195,9 @@ func runSuiteTests(suite string, withEnv bool) {
var cmd *exec.Cmd
if withEnv {
fmt.Println("No running suite detected, setting up an environment for running the tests")
cmd = CommandWithStdout("bash", "-c",
"./node_modules/.bin/ts-node ./scripts/run-environment.ts "+suite+" '"+mochaCmdLine+"'")
} else {
fmt.Println("Running suite detected. Running tests...")
cmd = CommandWithStdout("bash", "-c", mochaCmdLine)
}
@ -209,7 +209,7 @@ func runSuiteTests(suite string, withEnv bool) {
err := cmd.Run()
if err != nil {
os.Exit(1)
panic(err)
}
}

View File

@ -1,10 +1,8 @@
import { WebDriver } from "selenium-webdriver";
import LoginAndRegisterTotp from "../LoginAndRegisterTotp";
import FullLogin from "../FullLogin";
import VerifyUrlIs from "../assertions/VerifyUrlIs";
import VisitPageAndWaitUrlIs from "./VisitPageAndWaitUrlIs";
import ValidateTotp from "../ValidateTotp";
import FillLoginPageAndClick from "../FillLoginPageAndClick";
export default async function(
driver: WebDriver,

View File

@ -29,9 +29,6 @@ export default function(timeout: number = 5000) {
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");
// 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.
await VerifyIsSecondFactorStage(this.driver, timeout);
});