diff --git a/jam-ui/cypress/integration/auth/login.js b/jam-ui/cypress/integration/auth/login.js new file mode 100644 index 000000000..0522f5ae9 --- /dev/null +++ b/jam-ui/cypress/integration/auth/login.js @@ -0,0 +1,71 @@ +/// + +describe('Unauthenticated users redirect to login page', () => { + it('redirects to login page', () => { + cy.clearCookie('remeber_token') + cy.visit('/friends') + cy.url().should('include', '/authentication/basic/login') + cy.contains('Sign in') + }) +}) + +describe('Login page', () => { + before(() => { + cy.clearCookie('remeber_token') + cy.visit('/authentication/basic/login') + }) + + it('validate login form', () => { + cy.reload() + cy.get('[data-testid=submit]').should('be.disabled') + cy.get('[data-testid=email]').type('invalid-email-format@example') + cy.get('[data-testid=submit]').should('be.disabled') + cy.get('[data-testid=email]').type('valid-email-format@example.com') + cy.get('[data-testid=submit]').should('be.disabled') + cy.get('[data-testid=password]').type('password') + cy.get('[data-testid=submit]').should('not.be.disabled') + }) + + it('submit login form with invalid credentials', () => { + cy.reload() + cy.get('[data-testid=email]').type('peter@example.com') + cy.get('[data-testid=password]').type('wrong') + cy.get('[data-testid=submit]').click() + cy.contains('Incorrect email or password') + }) + + it('submits login form', () => { + const userAttrs = { + id: '1', + first_name: 'Peter', + last_name: 'Pan', + name: 'Peter Pan', + photo_url: '', + email: 'peter@example.com' + } + + cy.intercept('POST', `${Cypress.env('apiBaseUrl')}/auths/login`, { + statusCode: 200, + body: userAttrs + }).as('createSession') + + cy.intercept('GET', `${Cypress.env('apiBaseUrl')}/me`, { + statusCode: 200, + body: userAttrs + }).as('getCurrentUser') + + cy.reload() + cy.get('[data-testid=email]').type('peter@example.com') + cy.get('[data-testid=password]').type('jam123') + cy.get('[data-testid=submit]').click() + cy.url().should('eq', Cypress.config().baseUrl + '/') // tests won't fail in case the port changes + //cy.contains('Signed in as peter@example.com') + //cy.contains('Peter Pan') + //cy.getCookie('remember_token').should('exist') + + + }) + +}) + + diff --git a/jam-ui/src/components/page/JKHelp.js b/jam-ui/src/components/page/JKHelp.js new file mode 100644 index 000000000..61fc2f47c --- /dev/null +++ b/jam-ui/src/components/page/JKHelp.js @@ -0,0 +1,16 @@ +import React, {useEffect} from 'react' + +const JKHelp = () => { + useEffect(() => { + window.location.href = `${process.env.REACT_APP_LEGACY_BASE_URL}/corp/help` + return () => { + }; + }, []) + return ( +
+ redirecting... +
+ ) +} + +export default JKHelp; \ No newline at end of file diff --git a/jam-ui/src/components/page/JKHomePage.js b/jam-ui/src/components/page/JKHomePage.js new file mode 100644 index 000000000..c5b0c1eba --- /dev/null +++ b/jam-ui/src/components/page/JKHomePage.js @@ -0,0 +1,20 @@ +import React from 'react'; +import { Card, CardBody } from 'reactstrap'; +import FalconCardHeader from '../common/FalconCardHeader'; +import { useTranslation } from "react-i18next"; + +function JKHomePage() { + const {t} = useTranslation() + + return ( + + + +

Coming soon...

+ +
+
+ ) +} + +export default JKHomePage diff --git a/jam-ui/src/components/page/JKPrivacy.js b/jam-ui/src/components/page/JKPrivacy.js new file mode 100644 index 000000000..8acef8b8b --- /dev/null +++ b/jam-ui/src/components/page/JKPrivacy.js @@ -0,0 +1,11 @@ +import React from 'react' + +function JKPrivacy() { + return ( +
+ Privacy page +
+ ) +} + +export default JKPrivacy diff --git a/jam-ui/src/layouts/JKPublicRoutes.js b/jam-ui/src/layouts/JKPublicRoutes.js new file mode 100644 index 000000000..c59a8cf82 --- /dev/null +++ b/jam-ui/src/layouts/JKPublicRoutes.js @@ -0,0 +1,17 @@ +import React from 'react'; +import { Redirect, Route, Switch } from 'react-router-dom'; + +import JKPrivacy from '../components/page/JKPrivacy'; + + +const JKPublicRoutes = () => ( + + + + {/*Redirect*/} + + +); + + +export default JKPublicRoutes;