new pages
This commit is contained in:
parent
480de3e89f
commit
08a69da490
|
|
@ -0,0 +1,71 @@
|
|||
///<reference types="cypress" />
|
||||
|
||||
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')
|
||||
|
||||
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
|
||||
|
|
@ -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 (
|
||||
<div>
|
||||
redirecting...
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default JKHelp;
|
||||
|
|
@ -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 (
|
||||
<Card>
|
||||
<FalconCardHeader title={t('page_title', {ns: 'home'})} titleClass="font-weight-semi-bold" />
|
||||
<CardBody className="pt-0">
|
||||
<p className="text-muted">Coming soon...</p>
|
||||
|
||||
</CardBody>
|
||||
</Card>
|
||||
)
|
||||
}
|
||||
|
||||
export default JKHomePage
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
import React from 'react'
|
||||
|
||||
function JKPrivacy() {
|
||||
return (
|
||||
<div>
|
||||
Privacy page
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default JKPrivacy
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
import React from 'react';
|
||||
import { Redirect, Route, Switch } from 'react-router-dom';
|
||||
|
||||
import JKPrivacy from '../components/page/JKPrivacy';
|
||||
|
||||
|
||||
const JKPublicRoutes = () => (
|
||||
|
||||
<Switch>
|
||||
<Route path="/privacy" component={JKPrivacy} />
|
||||
{/*Redirect*/}
|
||||
<Redirect to="/errors/404" />
|
||||
</Switch>
|
||||
);
|
||||
|
||||
|
||||
export default JKPublicRoutes;
|
||||
Loading…
Reference in New Issue