-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* 5.1 release
- Loading branch information
Showing
47 changed files
with
1,536 additions
and
1,443 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,3 +32,5 @@ packages/healthcare/public/config.js | |
|
||
# cypress | ||
cypress/screenshots | ||
/.idea/ | ||
/apihub.iml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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(); | ||
|
@@ -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: '[email protected]', | ||
}); | ||
}); | ||
|
||
// 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: '[email protected]', | ||
}); | ||
|
||
// Open the user profile edit view | ||
|
||
cy.findByText('Edit').click(); | ||
|
||
checkUserProfileEditDetails({ | ||
username: 'orgPublisher', | ||
lastName: 'Kulas', | ||
firstName: 'Darby', | ||
email: '[email protected]', | ||
}); | ||
|
||
// 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: '[email protected]', | ||
}); | ||
}); | ||
|
||
// 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: '[email protected]', | ||
}); | ||
|
||
// Open the user profile edit view | ||
|
||
cy.findByText('Edit').click(); | ||
|
||
checkUserProfileEditDetails({ | ||
username: 'portalAdmin', | ||
lastName: 'Mertz', | ||
firstName: 'Porter', | ||
email: '[email protected]', | ||
}); | ||
|
||
// Last Name | ||
|
||
cy.findByLabelText('Last Name *') | ||
.clear() | ||
.type('Hertz'); | ||
|
||
// First Name | ||
|
||
cy.findByLabelText('First Name *') | ||
.clear() | ||
.type('Borter'); | ||
|
@@ -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); | ||
|
@@ -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: '[email protected]', | ||
}); | ||
|
||
// Open the user profile edit view | ||
|
||
cy.findByText('Edit').click(); | ||
|
||
checkUserProfileEditDetails({ | ||
username: 'portalAdmin', | ||
lastName: 'Mertz', | ||
firstName: 'Porter', | ||
email: '[email protected]', | ||
}); | ||
|
||
// 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: '[email protected]', | ||
}); | ||
}); | ||
|
||
// User Organization | ||
|
||
it('should switch the organization and stay on the same page', () => { | ||
|
85 changes: 4 additions & 81 deletions
85
packages/example/src/authentication/AuthenticationLayout.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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', | ||
flexGrow: 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, | ||
}, | ||
}, | ||
})); |
Oops, something went wrong.