8000 5.1 release by melil02 · Pull Request #32 · CAAPIM/APIHub · GitHub
[go: up one dir, main page]

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,5 @@ packages/healthcare/public/config.js

# cypress
cypress/screenshots
/.idea/
/apihub.iml
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
dist: xenial
language: node_js
node_js:
- 'lts/*'
- '12.16.3'
addons:
chrome: stable
firefox: latest
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ Use the following commands to set up you local development environment.

Before setting up your local development environment, ensure that you have completed the following:
- You have installed [Yarn](https://yarnpkg.com/).
- You have installed Make.
- You have installed GNU Make 3.81 or later.
- You have installed Node v12.16.3.

### Install the JavaScript Dependencies

Expand Down
194 changes: 193 additions & 1 deletion cypress/integration/user.js
C941
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ describe('User', () => {
cy.saveLocalStorageCache();
});

// User Profile
// User Profile update for admin

it('should display and edit the user profile', () => {
cy.loadData();
Expand Down Expand Up @@ -58,6 +58,120 @@ describe('User', () => {

// First Name

cy.findByLabelText('First Name *')
.clear()
.type('Borter');

cy.findByText('Save').click();

// Discard notification
cy.findByText('My Profile').click();
cy.wait(250);

// Open the user profile show view
checkUserProfileDetails({
username: 'portalAdmin',
lastName: 'Hertz',
firstName: 'Borter',
email: 'Porter.Mertz52@example.com',
});
});

// User profile update for non-admin

it('Non-admin users cannot update email field', () => {
cy.loadData();

login('orgPublisher', 'Password@1');

openUserProfile();

// Open the user profile show view

checkUserProfileDetails({
username: 'orgPublisher',
lastName: 'Kulas',
firstName: 'Darby',
email: 'Darby.Kulas@example.com',
});

// Open the user profile edit view

cy.findByText('Edit').click();

checkUserProfileEditDetails({
username: 'orgPublisher',
lastName: 'Kulas',
firstName: 'Darby',
email: 'Darby.Kulas@example.com',
});

// Last Name

cy.findByLabelText('Last Name *')
.clear()
.type('Mertz');

// First Name

cy.findByLabelText('First Name *')
.clear()
.type('Porter');

// email field should be in disabled state
cy.findByLabelText('Email *').should('be.disabled');

cy.findByText('Save').click();

// Discard notification
cy.findByText('My Profile').click();
cy.wait(250);

// Open the user profile show view
checkUserProfileDetails({
username: 'orgPublisher',
lastName: 'Mertz',
firstName: 'Porter',
email: 'Darby.Kulas@example.com',
});
});

// Updating email-id requires password
it('should prompt for password on email update', () => {
cy.loadData();

login('portalAdmin', 'Password@1');

openUserProfile();

// Open the user profile show view

checkUserProfileDetails({
username: 'portalAdmin',
lastName: 'Mertz',
firstName: 'Porter',
email: 'Porter.Mertz52@example.com',
});

// Open the user profile edit view

cy.findByText('Edit').click();

checkUserProfileEditDetails({
username: 'portalAdmin',
lastName: 'Mertz',
firstName: 'Porter',
email: 'Porter.Mertz52@example.com',
});

// Last Name

cy.findByLabelText('Last Name *')
.clear()
.type('Hertz');

// First Name

cy.findByLabelText('First Name *')
.clear()
.type('Borter');
Expand All @@ -70,6 +184,12 @@ describe('User', () => {

cy.findByText('Save').click();

cy.findByLabelText('Enter Current Password')
.clear()
.type('Password@1');

cy.findByText('Submit').click();

// Discard notification
cy.findByText('My Profile').click();
cy.wait(250);
Expand All @@ -83,6 +203,78 @@ describe('User', () => {
});
});

// Setting new password should prompt for existing password
// admin user
it('admin: should prompt for existing password if user is changing password', () => {
cy.loadData();

login('portalAdmin', 'Password@1');

openUserProfile();

// Open the user profile show view

checkUserProfileDetails({
username: 'portalAdmin',
lastName: 'Mertz',
firstName: 'Porter',
email: 'Porter.Mertz52@example.com',
});

// Open the user profile edit view

cy.findByText('Edit').click();

checkUserProfileEditDetails({
username: 'portalAdmin',
lastName: 'Mertz',
firstName: 'Porter',
email: 'Porter.Mertz52@example.com',
});

// Last Name

cy.findByLabelText('Last Name *')
.clear()
.type('Hertz');

// First Name

cy.findByLabelText('First Name *')
.clear()
.type('Borter');

cy.findByText('Update password').click();

cy.get('[data-testid="new-password"] input')
.clear()
.type('Password@1');

cy.get('[data-testid="confirm-new-password"] input')
.clear()
.type('Password@1');

cy.findByText('Save').click();

cy.findByLabelText('Enter Current Password')
.clear()
.type('Password@1');

cy.findByText('Submit').click();

// Discard notification
cy.findByText('My Profile').click();
cy.wait(250);

// Open the user profile show view
checkUserProfileDetails({
username: 'portalAdmin',
lastName: 'Hertz',
firstName: 'Borter',
email: 'Porter.Mertz52@example.com',
});
});

// User Organization

it('should switch the organization and stay on the same page', () => {
Expand Down
85 changes: 4 additions & 81 deletions packages/example/src/authentication/AuthenticationLayout.js
Original file line number Diff line number Diff line change
@@ -1,92 +1,15 @@
import React from 'react';
import {
ThemeProvider,
createMuiTheme,
makeStyles,
} from '@material-ui/core/styles';
import { Notification } from 'react-admin';
import { ThemeProvider, createMuiTheme } from '@material-ui/core/styles';

import { useTheme } from '../theme';
import { Header, Footer } from '../ui';
import { SideContent } from './SideContent';
import { ThemedAuthenticationLayout } from './ThemedAuthenticationLayout';

export const AuthenticationLayout = props => {
const theme = useTheme();
const { theme } = useTheme();

return (
<ThemeProvider theme={createMuiTheme(theme)}>
<ThemedAuthenticationLayout {...props} />
</ThemeProvider>
);
};

// This component exists for theming only. Indeed, we must call the useStyles hook AFTER
// the ThemeProvider has been initialized with the specified theme
const ThemedAuthenticationLayout = ({ children }) => {
const classes = useStyles();

return (
<div className={classes.root}>
<Header />
<div className={classes.container}>
<div className={classes.columns}>{children}</div>
<div className={classes.columns}>
<SideContent />
</div>
</div>
<Footer />
<Notification />
</div>
);
};

const useStyles = makeStyles(theme => ({
root: {
backgroundColor: theme.palette.background.default,
position: 'fixed',
top: 0,
bottom: 0,
left: 0,
right: 0,
padding: theme.spacing(4),
display: 'flex',
flexDirection: 'column',
overflow: 'auto',
},
container: {
display: 'flex',
flexWrap: 'wrap',
fl 427F exGrow: 1,
},
columns: {
display: 'flex',
flexDirection: 'column',
padding: theme.spacing(4),
[theme.breakpoints.down('sm')]: {
padding: theme.spacing(3),
},
'&:first-child': {
minWidth: '250px',
maxWidth: '30%',
[theme.breakpoints.down('sm')]: {
maxWidth: '100%',
width: '100%',
},
},
'&:not(:first-child)': {
borderStyle: 'solid',
borderColor: theme.palette.divider,
borderWidth: '0px 0px 0px 1px',
marginLeft: theme.spacing(4),
maxWidth: `calc(50% - ${theme.spacing(4)}px)`,
[theme.breakpoints.down('sm')]: {
borderWidth: '1px 0px 0px 0px',
marginLeft: '0px',
maxWidth: '100%',
width: '100%',
},
},
'&:last-child': {
flexGrow: 1,
},
},
}));
Loading
0