diff --git a/bootstrap.sh b/bootstrap.sh index 48eff9f60..7e147962b 100644 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -1,5 +1,4 @@ - -set -e +#!/bin/bash export PATH=./cmd/authelia-scripts/:/tmp:$PATH diff --git a/client/src/containers/views/LogoutView/LogoutView.ts b/client/src/containers/views/LogoutView/LogoutView.ts new file mode 100644 index 000000000..52d2cd508 --- /dev/null +++ b/client/src/containers/views/LogoutView/LogoutView.ts @@ -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); \ No newline at end of file diff --git a/client/src/routes/routes.ts b/client/src/routes/routes.ts index 40208e4a7..d3c9c3471 100644 --- a/client/src/routes/routes.ts +++ b/client/src/routes/routes.ts @@ -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: '/', diff --git a/client/src/views/LogoutView/LogoutView.tsx b/client/src/views/LogoutView/LogoutView.tsx index f0bfc3394..72adcda97 100644 --- a/client/src/views/LogoutView/LogoutView.tsx +++ b/client/src/views/LogoutView/LogoutView.tsx @@ -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 { + componentWillMount() { + this.props.onInit(); } render() { diff --git a/cmd/authelia-scripts/cmd_suites.go b/cmd/authelia-scripts/cmd_suites.go index 8d42d1a58..6eddf438c 100644 --- a/cmd/authelia-scripts/cmd_suites.go +++ b/cmd/authelia-scripts/cmd_suites.go @@ -152,10 +152,12 @@ 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() } - 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) } } diff --git a/test/helpers/behaviors/RegisterAndLoginTwoFactor.ts b/test/helpers/behaviors/RegisterAndLoginTwoFactor.ts index 701398733..f477e0d3a 100644 --- a/test/helpers/behaviors/RegisterAndLoginTwoFactor.ts +++ b/test/helpers/behaviors/RegisterAndLoginTwoFactor.ts @@ -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, diff --git a/test/helpers/scenarii/SingleFactorAuthentication.ts b/test/helpers/scenarii/SingleFactorAuthentication.ts index 9cbec8958..c1a74c3a2 100644 --- a/test/helpers/scenarii/SingleFactorAuthentication.ts +++ b/test/helpers/scenarii/SingleFactorAuthentication.ts @@ -28,10 +28,7 @@ export default function(timeout: number = 5000) { 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 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); });