mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-29 06:15:29 -04:00
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:
parent
2abe40ef1d
commit
a398660c18
48 changed files with 229 additions and 167 deletions
|
@ -8,6 +8,7 @@ import React, { Fragment, useCallback, useState } from 'react'
|
|||
import { Trans } from 'react-i18next'
|
||||
import { Link } from 'react-router-dom'
|
||||
import { VersionInfoModal } from './version-info-modal'
|
||||
import { cypressId } from '../../../../utils/cypress-attribute'
|
||||
|
||||
export const VersionInfoLink: React.FC = () => {
|
||||
const [show, setShow] = useState(false)
|
||||
|
@ -16,7 +17,7 @@ export const VersionInfoLink: React.FC = () => {
|
|||
|
||||
return (
|
||||
<Fragment>
|
||||
<Link data-cy={'show-version-modal'} to={'#'} className={'text-light'} onClick={showModal}>
|
||||
<Link {...cypressId('show-version-modal')} to={'#'} className={'text-light'} onClick={showModal}>
|
||||
<Trans i18nKey={'landing.versionInfo.versionInfo'} />
|
||||
</Link>
|
||||
<VersionInfoModal onHide={closeModal} show={show} />
|
||||
|
|
|
@ -13,6 +13,7 @@ import frontendVersion from '../../../../version.json'
|
|||
import links from '../../../../links.json'
|
||||
import type { BackendVersion } from '../../../../api/config/types'
|
||||
import { useApplicationState } from '../../../../hooks/common/use-application-state'
|
||||
import { cypressId } from '../../../../utils/cypress-attribute'
|
||||
|
||||
export const VersionInfoModal: React.FC<CommonModalProps> = ({ onHide, show }) => {
|
||||
const serverVersion: BackendVersion = useApplicationState((state) => state.config.version)
|
||||
|
@ -31,7 +32,7 @@ export const VersionInfoModal: React.FC<CommonModalProps> = ({ onHide, show }) =
|
|||
|
||||
return (
|
||||
<CommonModal
|
||||
data-cy={'version-modal'}
|
||||
{...cypressId('version-modal')}
|
||||
show={show}
|
||||
onHide={onHide}
|
||||
closeButton={true}
|
||||
|
|
|
@ -13,6 +13,7 @@ import { ShowIf } from '../../common/show-if/show-if'
|
|||
import { getApiUrl } from '../../../api/utils'
|
||||
import { INTERACTIVE_LOGIN_METHODS } from '../../../api/auth'
|
||||
import { useApplicationState } from '../../../hooks/common/use-application-state'
|
||||
import { cypressId } from '../../../utils/cypress-attribute'
|
||||
|
||||
export type SignInButtonProps = Omit<ButtonProps, 'href'>
|
||||
|
||||
|
@ -36,7 +37,7 @@ export const SignInButton: React.FC<SignInButtonProps> = ({ variant, ...props })
|
|||
return (
|
||||
<ShowIf condition={authEnabled}>
|
||||
<LinkContainer to={loginLink} title={t('login.signIn')}>
|
||||
<Button data-cy={'sign-in-button'} variant={variant || 'success'} {...props}>
|
||||
<Button {...cypressId('sign-in-button')} variant={variant || 'success'} {...props}>
|
||||
<Trans i18nKey='login.signIn' />
|
||||
</Button>
|
||||
</LinkContainer>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue