From c5eb86e0fd2c3176331f0263336f7aeebd304694 Mon Sep 17 00:00:00 2001 From: Clement Michaud Date: Wed, 30 Jan 2019 16:47:03 +0100 Subject: [PATCH] Fix e2e test with minimal configuration. --- Dockerfile | 2 +- .../AlreadyAuthenticated.tsx | 3 +- .../FirstFactorForm/FirstFactorForm.tsx | 5 +- .../components/Notification/Notification.tsx | 2 +- .../SecondFactorForm/SecondFactorForm.tsx | 14 +- .../ForgotPasswordView/ForgotPasswordView.tsx | 7 +- .../OneTimePasswordRegistrationView.tsx | 5 +- .../ResetPasswordView/ResetPasswordView.tsx | 4 + config.minimal.yml | 6 +- config.template.yml | 10 +- docker-compose.yml | 8 +- example/compose/nginx/portal/nginx.conf.ejs | 12 +- example/compose/nginx/portal/render.js | 12 +- package-lock.json | 2898 +++++++++-------- package.json | 4 +- scripts/authelia-scripts | 4 +- scripts/authelia-scripts-serve | 41 +- scripts/authelia-scripts-start | 12 +- scripts/authelia-scripts-test | 26 +- scripts/mocha | 2 +- scripts/run-dev-server.sh | 2 +- scripts/utils/prepare-environment.sh | 10 - test/complete-config/closed-redirection.ts | 12 +- .../mongo-broken-connection.ts | 6 +- test/helpers/AccessSecret.ts | 14 + test/helpers/ClickOn.ts | 8 + test/helpers/ClickOnLink.ts | 8 + test/helpers/FillField.ts | 9 + test/helpers/FillLoginPageAndClick.ts | 17 + test/helpers/FullLogin.ts | 13 + test/helpers/GetIdentityLink.ts | 32 + test/helpers/IsSecondFactorStage.ts | 5 + test/helpers/LoginAndRegisterTotp.ts | 10 + test/helpers/LoginAs.ts | 8 + test/helpers/RegisterTotp.ts | 13 + test/helpers/SeeNotification.ts | 9 + test/helpers/ValidateTotp.ts | 16 + test/helpers/VisitPage.ts | 6 + test/helpers/WaitRedirected.ts | 5 + test/helpers/access-secret.ts | 12 - test/helpers/click-on-button.ts | 13 - test/helpers/click-on-link.ts | 10 - test/helpers/context/AutheliaSuite.ts | 34 + test/helpers/context/WithAutheliaRunning.ts | 23 + test/helpers/context/WithDriver.ts | 20 + test/helpers/fill-field.ts | 10 - test/helpers/fill-login-page-and-click.ts | 29 - test/helpers/full-login.ts | 12 - test/helpers/get-identity-link.ts | 34 - test/helpers/login-and-register-totp.ts | 10 - test/helpers/login-as.ts | 7 - test/helpers/register-totp.ts | 23 - test/helpers/see-notification.ts | 18 - test/helpers/validate-totp.ts | 20 - test/helpers/visit-page.ts | 8 - test/helpers/wait-redirected.ts | 5 - test/helpers/with-driver.ts | 13 - test/inactivity/keep_me_logged_in.ts | 12 +- test/minimal-config/00-suite.ts | 15 - test/minimal-config/bad_password.ts | 30 - test/minimal-config/fail_totp.ts | 39 - test/minimal-config/index.ts | 23 + test/minimal-config/register_totp.ts | 32 - test/minimal-config/reset_password.ts | 42 - test/minimal-config/scenarii/BadPassword.ts | 23 + test/minimal-config/scenarii/RegisterTotp.ts | 30 + test/minimal-config/scenarii/ResetPassword.ts | 29 + .../minimal-config/scenarii/TOTPValidation.ts | 51 + test/minimal-config/validate_totp.ts | 46 - test/tsconfig.json | 19 + test/types/mocha.d.ts | 9 + users_database.example.yml | 29 + 72 files changed, 2065 insertions(+), 1945 deletions(-) create mode 100644 test/helpers/AccessSecret.ts create mode 100644 test/helpers/ClickOn.ts create mode 100644 test/helpers/ClickOnLink.ts create mode 100644 test/helpers/FillField.ts create mode 100644 test/helpers/FillLoginPageAndClick.ts create mode 100644 test/helpers/FullLogin.ts create mode 100644 test/helpers/GetIdentityLink.ts create mode 100644 test/helpers/IsSecondFactorStage.ts create mode 100644 test/helpers/LoginAndRegisterTotp.ts create mode 100644 test/helpers/LoginAs.ts create mode 100644 test/helpers/RegisterTotp.ts create mode 100644 test/helpers/SeeNotification.ts create mode 100644 test/helpers/ValidateTotp.ts create mode 100644 test/helpers/VisitPage.ts create mode 100644 test/helpers/WaitRedirected.ts delete mode 100644 test/helpers/access-secret.ts delete mode 100644 test/helpers/click-on-button.ts delete mode 100644 test/helpers/click-on-link.ts create mode 100644 test/helpers/context/AutheliaSuite.ts create mode 100644 test/helpers/context/WithAutheliaRunning.ts create mode 100644 test/helpers/context/WithDriver.ts delete mode 100644 test/helpers/fill-field.ts delete mode 100644 test/helpers/fill-login-page-and-click.ts delete mode 100644 test/helpers/full-login.ts delete mode 100644 test/helpers/get-identity-link.ts delete mode 100644 test/helpers/login-and-register-totp.ts delete mode 100644 test/helpers/login-as.ts delete mode 100644 test/helpers/register-totp.ts delete mode 100644 test/helpers/see-notification.ts delete mode 100644 test/helpers/validate-totp.ts delete mode 100644 test/helpers/visit-page.ts delete mode 100644 test/helpers/wait-redirected.ts delete mode 100644 test/helpers/with-driver.ts delete mode 100644 test/minimal-config/00-suite.ts delete mode 100644 test/minimal-config/bad_password.ts delete mode 100644 test/minimal-config/fail_totp.ts create mode 100644 test/minimal-config/index.ts delete mode 100644 test/minimal-config/register_totp.ts delete mode 100644 test/minimal-config/reset_password.ts create mode 100644 test/minimal-config/scenarii/BadPassword.ts create mode 100644 test/minimal-config/scenarii/RegisterTotp.ts create mode 100644 test/minimal-config/scenarii/ResetPassword.ts create mode 100644 test/minimal-config/scenarii/TOTPValidation.ts delete mode 100644 test/minimal-config/validate_totp.ts create mode 100644 test/tsconfig.json create mode 100644 test/types/mocha.d.ts create mode 100644 users_database.example.yml diff --git a/Dockerfile b/Dockerfile index 6687edd86..7abb1699f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,7 +12,7 @@ RUN apk --update add --no-cache --virtual \ COPY dist/server /usr/src/server COPY dist/shared /usr/src/shared -EXPOSE 8080 +EXPOSE 9091 VOLUME /etc/authelia VOLUME /var/lib/authelia diff --git a/client/src/components/AlreadyAuthenticated/AlreadyAuthenticated.tsx b/client/src/components/AlreadyAuthenticated/AlreadyAuthenticated.tsx index 6c64513b6..054095ef0 100644 --- a/client/src/components/AlreadyAuthenticated/AlreadyAuthenticated.tsx +++ b/client/src/components/AlreadyAuthenticated/AlreadyAuthenticated.tsx @@ -1,4 +1,5 @@ import React, { Component } from "react"; +import classnames from 'classnames'; import styles from '../../assets/scss/components/AlreadyAuthenticated/AlreadyAuthenticated.module.scss'; import Button from "@material/react-button"; @@ -17,7 +18,7 @@ export type Props = OwnProps & DispatchProps; class AlreadyAuthenticated extends Component { render() { return ( -
+
{this.props.username} diff --git a/client/src/components/FirstFactorForm/FirstFactorForm.tsx b/client/src/components/FirstFactorForm/FirstFactorForm.tsx index 6082c0173..b07ff8fbe 100644 --- a/client/src/components/FirstFactorForm/FirstFactorForm.tsx +++ b/client/src/components/FirstFactorForm/FirstFactorForm.tsx @@ -65,7 +65,7 @@ class FirstFactorForm extends Component { render() { return ( -
+
@@ -103,8 +103,9 @@ class FirstFactorForm extends Component {
diff --git a/client/src/components/Notification/Notification.tsx b/client/src/components/Notification/Notification.tsx index d5d0d1738..46cd27e9c 100644 --- a/client/src/components/Notification/Notification.tsx +++ b/client/src/components/Notification/Notification.tsx @@ -11,7 +11,7 @@ interface Props { class Notification extends Component { render() { return (this.props.show) - ? (
+ ? (
{this.props.children}
) : null; diff --git a/client/src/components/SecondFactorForm/SecondFactorForm.tsx b/client/src/components/SecondFactorForm/SecondFactorForm.tsx index f754966bb..2af9585ae 100644 --- a/client/src/components/SecondFactorForm/SecondFactorForm.tsx +++ b/client/src/components/SecondFactorForm/SecondFactorForm.tsx @@ -1,4 +1,5 @@ -import React, { Component, KeyboardEvent, ChangeEvent, FormEvent } from 'react'; +import React, { Component, KeyboardEvent, FormEvent } from 'react'; +import classnames from 'classnames'; import TextField, { Input } from '@material/react-text-field'; import Button from '@material/react-button'; @@ -63,7 +64,7 @@ class SecondFactorView extends Component {
- Register device @@ -89,7 +90,7 @@ class SecondFactorView extends Component { private renderTotp(n: number) { return ( -
+
Option {n} - One-Time Password
{this.props.oneTimePasswordVerificationError} @@ -99,14 +100,14 @@ class SecondFactorView extends Component { label="One-Time Password" outlined={true}>
- Register device @@ -115,6 +116,7 @@ class SecondFactorView extends Component { diff --git a/client/src/views/OneTimePasswordRegistrationView/OneTimePasswordRegistrationView.tsx b/client/src/views/OneTimePasswordRegistrationView/OneTimePasswordRegistrationView.tsx index 2f7437021..a3411f52c 100644 --- a/client/src/views/OneTimePasswordRegistrationView/OneTimePasswordRegistrationView.tsx +++ b/client/src/views/OneTimePasswordRegistrationView/OneTimePasswordRegistrationView.tsx @@ -1,4 +1,5 @@ import React, { Component } from "react"; +import classnames from 'classnames'; import Button from "@material/react-button"; @@ -54,10 +55,10 @@ class OneTimePasswordRegistrationView extends Component { Register your device by scanning the barcode or adding the key.
-
+
-
{secret.base32_secret}
+
{secret.base32_secret}