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 @@
#!/bin/bash
set -e
export PATH=./cmd/authelia-scripts/:/tmp:$PATH 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 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: '/',

View File

@ -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() {

View File

@ -152,11 +152,13 @@ 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") fmt.Println("No suite provided therefore all suites will be tested")
runAllSuites() 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)
} }
} }

View File

@ -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,

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