-
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 apply PR comments from review format remove response param uncomment simulate login button remove it.only reorder apply PR feedback from Christian remove find
- Loading branch information
Showing
8 changed files
with
107 additions
and
15 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
23 changes: 23 additions & 0 deletions
23
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,23 @@ | ||
import { Modal } from '~/__tests__/cypress/cypress/pages/components/Modal'; | ||
|
||
class LoginDialog extends Modal { | ||
constructor() { | ||
super(/Session Expired/); | ||
} | ||
|
||
// FIXME Remove once PF version is upgraded to 6.1.0. | ||
// https://issues.redhat.com/browse/RHOAIENG-11946 | ||
// https://github.com/patternfly/patternfly-react/issues/11041 | ||
shouldBeOpen(open = true): void { | ||
if (open) { | ||
this.find(); | ||
} else { | ||
this.find().should('not.exist'); | ||
} | ||
} | ||
|
||
findLoginButton() { | ||
return this.findFooter().findByTestId('modal-login-button'); | ||
} | ||
} | ||
export const loginDialog = new LoginDialog(); |
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
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,39 @@ | ||
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 | ||
aria-labelledby="session-expired-modal-title" | ||
> | ||
<ModalHeader | ||
title="Session Expired" | ||
titleIconVariant="warning" | ||
labelId="session-expired-modal-title" | ||
/> | ||
<ModalBody>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