-
Notifications
You must be signed in to change notification settings - Fork 178
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[RHOAIENG-1154]: Apply modal to alert user error
check for 403 status code add cypress test update test title format format format remove it.only fix relative import PR feedback from Christian, WIP Cypress throwing error on shouldBeOpen fix tests, fix linting issues revert find() function revert find, update comment format
- Loading branch information
Showing
7 changed files
with
108 additions
and
6 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
20 changes: 20 additions & 0 deletions
20
frontend/src/__tests__/cypress/cypress/pages/loginDialog.ts
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,20 @@ | ||
import { Modal } from '~/__tests__/cypress/cypress/pages/components/Modal'; | ||
|
||
class LoginDialog extends Modal { | ||
protected testId; | ||
|
||
constructor(title: string, testId: string) { | ||
super(title); | ||
this.testId = testId; | ||
} | ||
|
||
find() { | ||
return cy.findByTestId(this.testId); | ||
} | ||
|
||
findLoginButton() { | ||
return this.findFooter().findByTestId('modal-login-button'); | ||
} | ||
} | ||
|
||
export const loginDialog = new LoginDialog('Session Expired', 'session-expired-modal'); |
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
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,42 @@ | ||
import React from 'react'; | ||
|
||
import { | ||
Modal, | ||
ModalVariant, | ||
ModalHeader, | ||
ModalBody, | ||
ModalFooter, | ||
Button, | ||
} from '@patternfly/react-core'; | ||
import { logout } from './appUtils'; | ||
|
||
const SessionExpiredModal: React.FC = () => ( | ||
<Modal | ||
data-testid="session-expired-modal" | ||
variant={ModalVariant.small} | ||
isOpen | ||
ouiaId="BasicModal" | ||
aria-labelledby="session-expired-modal-title" | ||
> | ||
<ModalHeader | ||
title="Session Expired" | ||
titleIconVariant="warning" | ||
labelId="session-expired-modal-title" | ||
/> | ||
<ModalBody data-testid="timeout-text"> | ||
Your session timed out. To continue working, log in. | ||
</ModalBody> | ||
<ModalFooter> | ||
<Button | ||
data-testid="modal-login-button" | ||
key="confirm" | ||
variant="primary" | ||
onClick={() => logout().then(() => window.location.reload())} | ||
> | ||
Log in | ||
</Button> | ||
</ModalFooter> | ||
</Modal> | ||
); | ||
|
||
export default SessionExpiredModal; |
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