-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ENH] Implemented OIDC flow that results in a query sent to the f-API (…
…#205) * Renamed `NBDialog` component to `GetDataDialog` * Added `react-oauth/google` and `jwt-decode` to dependencies * Wrapped the app with `GoogleOAuthProvider` * Updated import statement * Implemented `AuthDialog` component * Implemented Avatar for user profile pic * Updated request config to include ID token * Implemented action to dismiss notificaitons * Implemented profile menu * Implemented logout functionality * Small clean ups * Implemented `NB_ENABLE_AUTH` and `NB_QUERY_CLIENT_ID` env vars * Set a conditional to render auth related components and elements * Updated README.md * Changed the default for `NB_ENABLE_AUTH` from `true` to `false` * Implemented check for `NB_QUERY_CLIENT_ID` * Fixed typo in README.md * Implemented component test for `AuthDialog` * Added missing props to `Navbar` component test * [FIX] auth-component test failed in Germany Interesting behaviour for the oauth prompt: it is written in the local language from where the request is sent. So from Germany it's in German. I changed the string check and also the login prompt language --------- Co-authored-by: Sebastian Urchs <[email protected]> Co-authored-by: Sebastian Urchs <[email protected]>
- Loading branch information
1 parent
c34240c
commit 7b16bba
Showing
17 changed files
with
306 additions
and
57 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
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 |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { GoogleOAuthProvider } from '@react-oauth/google'; | ||
import AuthDialog from '../../src/components/AuthDialog'; | ||
|
||
const props = { | ||
isLoggedIn: false, | ||
onAuth: () => {}, | ||
}; | ||
|
||
describe('ContinuousField', () => { | ||
it('Displays a MUI dialog with the title and "sing in with google" button', () => { | ||
cy.mount( | ||
<GoogleOAuthProvider clientId="mock-client-id"> | ||
{' '} | ||
<AuthDialog isLoggedIn={props.isLoggedIn} onAuth={props.onAuth} /> | ||
</GoogleOAuthProvider> | ||
); | ||
cy.get('[data-cy="auth-dialog"]').should('be.visible'); | ||
cy.get('[data-cy="auth-dialog"]').should('contain', 'You must log in'); | ||
cy.get('[data-cy="auth-dialog"]').within(() => { | ||
cy.contains('Google'); | ||
}); | ||
}); | ||
}); |
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 |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import GetDataDialog from '../../src/components/GetDataDialog'; | ||
|
||
const props = { | ||
open: true, | ||
onClose: () => {}, | ||
}; | ||
|
||
describe('GetDataDialog', () => { | ||
it('Displays a MUI Diaglog with the title and content', () => { | ||
cy.mount(<GetDataDialog open={props.open} onClose={props.onClose} />); | ||
cy.get('[data-cy="get-data-dialog"]').should('be.visible'); | ||
cy.get('[data-cy="get-data-dialog"] h2').should('contain', 'Example usage'); | ||
cy.get('[data-cy="get-data-dialog"] p').should( | ||
'contain', | ||
'The command for automatically getting the data currently only applies to datasets available through datalad.' | ||
); | ||
}); | ||
it("Doesn't display the dialog when open prop is set to false", () => { | ||
cy.mount(<GetDataDialog open={false} onClose={props.onClose} />); | ||
cy.get('[data-cy="get-data-dialog"]').should('not.exist'); | ||
}); | ||
it('Fires onClose event handler when the close button is clicked', () => { | ||
const onCloseSpy = cy.spy().as('onCloseSpy'); | ||
cy.mount(<GetDataDialog open={props.open} onClose={onCloseSpy} />); | ||
cy.get('[data-cy="get-data-dialog"] button').click(); | ||
cy.get('@onCloseSpy').should('have.been.called'); | ||
}); | ||
}); |
This file was deleted.
Oops, something went wrong.
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Oops, something went wrong.