Add cypress id attribute only in test mode (#1566)

* Add function for test attribute

Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>

* Adjust components

Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>

* Fix naming of attribute

Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>

* Rename method

Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>

* Rename method, interface, attribute and use interface

Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>

* Lint and format fix

Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
This commit is contained in:
Tilman Vatteroth 2021-10-17 21:20:23 +02:00 committed by GitHub
parent 2abe40ef1d
commit a398660c18
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
48 changed files with 229 additions and 167 deletions

View file

@ -10,6 +10,7 @@ import { CommonModal } from '../modals/common-modal'
import { Trans, useTranslation } from 'react-i18next'
import { useApplicationState } from '../../../hooks/common/use-application-state'
import { dismissMotd } from '../../../redux/motd/methods'
import { cypressId } from '../../../utils/cypress-attribute'
/**
* Reads the motd from the global application state and shows it in a modal.
@ -47,10 +48,10 @@ export const MotdModal: React.FC = () => {
return null
} else {
return (
<CommonModal data-cy={'motd'} show={!!motdState} titleI18nKey={'motd.title'}>
<CommonModal {...cypressId('motd')} show={!!motdState} titleI18nKey={'motd.title'}>
<Modal.Body>{domContent}</Modal.Body>
<Modal.Footer>
<Button variant={'success'} onClick={dismiss} data-cy={'motd-dismiss'}>
<Button variant={'success'} onClick={dismiss} {...cypressId('motd-dismiss')}>
<Trans i18nKey={'common.dismiss'} />
</Button>
</Modal.Footer>