chore(ui): add testId attributes

pull/5982/head
k3yi0 2022-07-12 10:02:23 +02:00
parent 54293a1632
commit 0b70f7dcb7
6 changed files with 19 additions and 5 deletions

View File

@ -14,7 +14,7 @@ interface Props {
color?: ComponentColor color?: ComponentColor
disabled?: boolean disabled?: boolean
tooltipText?: string tooltipText?: string
dataTest?: string test?: string
} }
@ErrorHandling @ErrorHandling
@ -27,14 +27,14 @@ class SlideToggle extends Component<Props> {
} }
public render() { public render() {
const {tooltipText, dataTest} = this.props const {tooltipText, testId} = this.props
return ( return (
<div <div
className={this.className} className={this.className}
onClick={this.handleClick} onClick={this.handleClick}
title={tooltipText} title={tooltipText}
data-test={dataTest} data-test={testId}
> >
<div className="slide-toggle--knob" /> <div className="slide-toggle--knob" />
</div> </div>

View File

@ -9,12 +9,13 @@ interface Props {
subtext?: string subtext?: string
onChange: (isChecked: boolean) => void onChange: (isChecked: boolean) => void
halfWidth?: boolean halfWidth?: boolean
testId?: string
} }
@ErrorHandling @ErrorHandling
class WizardCheckbox extends PureComponent<Props> { class WizardCheckbox extends PureComponent<Props> {
public render() { public render() {
const {text, isChecked, subtext, halfWidth} = this.props const {text, isChecked, subtext, halfWidth, testId} = this.props
return ( return (
<div className={'form-group ' + (halfWidth ? 'col-xs-6' : 'col-xs-12')}> <div className={'form-group ' + (halfWidth ? 'col-xs-6' : 'col-xs-12')}>
@ -25,6 +26,7 @@ class WizardCheckbox extends PureComponent<Props> {
active={isChecked} active={isChecked}
onChange={this.onChangeSlideToggle} onChange={this.onChangeSlideToggle}
tooltipText={text} tooltipText={text}
dataTest={testId}
/> />
<span <span
className="wizard-checkbox--label" className="wizard-checkbox--label"

View File

@ -17,6 +17,7 @@ interface Props {
placeholder?: string placeholder?: string
autoFocus?: boolean autoFocus?: boolean
type?: string type?: string
testId?: string
} }
interface State { interface State {
@ -55,6 +56,7 @@ class WizardTextInput extends PureComponent<Props, State> {
autoFocus, autoFocus,
label, label,
type, type,
testId,
} = this.props } = this.props
let inputClass = '' let inputClass = ''
@ -81,6 +83,7 @@ class WizardTextInput extends PureComponent<Props, State> {
autoFocus={autoFocus} autoFocus={autoFocus}
spellCheck={false} spellCheck={false}
autoComplete={'off'} autoComplete={'off'}
data-test={testId}
/> />
{errorText} {errorText}
</div> </div>

View File

@ -19,7 +19,7 @@ class InfluxTableHeader extends PureComponent<Props> {
<div className="panel-heading"> <div className="panel-heading">
<h2 className="panel-title">{this.title}</h2> <h2 className="panel-title">{this.title}</h2>
<Authorized requiredRole={EDITOR_ROLE}> <Authorized requiredRole={EDITOR_ROLE}>
<div onClick={toggleWizard(true)} className="btn btn-sm btn-primary"> <div onClick={toggleWizard(true)} className="btn btn-sm btn-primary" data-test="add-connection--button">
<span className="icon plus" /> Add Connection <span className="icon plus" /> Add Connection
</div> </div>
</Authorized> </Authorized>

View File

@ -58,6 +58,7 @@ class InfluxTableRow extends PureComponent<Props & WithRouterProps> {
text="Delete Connection" text="Delete Connection"
confirmAction={this.handleDeleteSource} confirmAction={this.handleDeleteSource}
customClass="delete-source table--show-on-row-hover" customClass="delete-source table--show-on-row-hover"
testId="delete-connection--button"
/> />
</Authorized> </Authorized>
</td> </td>

View File

@ -116,17 +116,20 @@ class SourceStep extends PureComponent<Props, State> {
onChange={this.onChangeInput('url')} onChange={this.onChangeInput('url')}
valueModifier={this.URLModifier} valueModifier={this.URLModifier}
onSubmit={this.handleSubmitUrl} onSubmit={this.handleSubmitUrl}
testId="connection-url--input"
/> />
<WizardTextInput <WizardTextInput
value={source.name} value={source.name}
label="Connection Name" label="Connection Name"
onChange={this.onChangeInput('name')} onChange={this.onChangeInput('name')}
testId="connection-name--input"
/> />
<WizardTextInput <WizardTextInput
value={source.username} value={source.username}
label={sourceIsV2 ? 'Organization' : 'Username'} label={sourceIsV2 ? 'Organization' : 'Username'}
onChange={this.onChangeInput('username')} onChange={this.onChangeInput('username')}
onSubmit={this.handleSubmitUsername} onSubmit={this.handleSubmitUsername}
testId="connection-username--input"
/> />
<WizardTextInput <WizardTextInput
value={source.password} value={source.password}
@ -135,11 +138,13 @@ class SourceStep extends PureComponent<Props, State> {
type="password" type="password"
onChange={this.onChangeInput('password')} onChange={this.onChangeInput('password')}
onSubmit={this.handleSubmitPassword} onSubmit={this.handleSubmitPassword}
testId="connection-password--input"
/> />
<WizardTextInput <WizardTextInput
value={source.telegraf} value={source.telegraf}
label="Telegraf Database Name" label="Telegraf Database Name"
onChange={this.onChangeInput('telegraf')} onChange={this.onChangeInput('telegraf')}
testId="connection-"
/> />
<WizardTextInput <WizardTextInput
value={source.defaultRP} value={source.defaultRP}
@ -151,6 +156,7 @@ class SourceStep extends PureComponent<Props, State> {
value={source.metaUrl} value={source.metaUrl}
label="Meta Service Connection URL" label="Meta Service Connection URL"
onChange={this.onChangeInput('metaUrl')} onChange={this.onChangeInput('metaUrl')}
testId="meta-service-connection-url--input"
/> />
)} )}
{!onBoarding && ( {!onBoarding && (
@ -159,6 +165,7 @@ class SourceStep extends PureComponent<Props, State> {
isChecked={source.default} isChecked={source.default}
text={'Default connection'} text={'Default connection'}
onChange={this.onChangeInput('default')} onChange={this.onChangeInput('default')}
testId="default-connection--checkbox"
/> />
)} )}
<WizardCheckbox <WizardCheckbox
@ -174,6 +181,7 @@ class SourceStep extends PureComponent<Props, State> {
text={`Unsafe SSL`} text={`Unsafe SSL`}
onChange={this.onChangeInput('insecureSkipVerify')} onChange={this.onChangeInput('insecureSkipVerify')}
subtext={insecureSkipVerifyText} subtext={insecureSkipVerifyText}
testId="unsafe-ssl--checkbox"
/> />
)} )}
</> </>