chore(ui): adjust testId attributes

pull/5982/head
k3yi0 2022-07-12 12:06:36 +02:00
parent 0a8f5d2bf6
commit adbb1720f6
5 changed files with 35 additions and 3 deletions

View File

@ -10,6 +10,7 @@ interface Props {
lastStep?: boolean
onClickPrevious: () => void
onClickNext: () => void
testId?: {previousLabel: string; nextLabel: string}
}
@ErrorHandling
@ -26,17 +27,23 @@ class WizardButtonBar extends PureComponent<Props> {
nextLabel,
onClickPrevious,
onClickNext,
testId,
} = this.props
return (
<div className="wizard-button-bar">
{decrement && (
<button className="btn btn-md btn-default" onClick={onClickPrevious}>
<button
className="btn btn-md btn-default"
onClick={onClickPrevious}
data-test={testId.previousLabel}
>
{previousLabel}
</button>
)}
<button
className={`btn btn-md ${this.buttonColor}`}
onClick={onClickNext}
data-test={testId.nextLabel}
>
{nextLabel}
</button>

View File

@ -26,6 +26,7 @@ export interface WizardStepProps {
nextLabel?: string
previousLabel?: string
lastStep?: boolean
testId?: {previousLabel: string; nextLabel: string}
}
@ErrorHandling
@ -38,7 +39,14 @@ class WizardStep extends PureComponent<WizardStepProps> {
private scrollMaxHeight = window.innerHeight * 0.45
public render() {
const {children, decrement, nextLabel, previousLabel, lastStep} = this.props
const {
children,
decrement,
nextLabel,
previousLabel,
lastStep,
testId,
} = this.props
return (
<>
@ -59,6 +67,7 @@ class WizardStep extends PureComponent<WizardStepProps> {
onClickPrevious={this.handleClickPrevious}
onClickNext={this.handleClickNext}
lastStep={lastStep}
testId={testId}
/>
</>
)

View File

@ -93,6 +93,10 @@ class ConnectionWizard extends PureComponent<Props & WithRouterProps, State> {
onNext={this.handleSourceNext}
nextLabel={source ? 'Update Connection' : 'Add Connection'}
previousLabel="Cancel"
testId={{
previousLabel: 'cancel--button',
nextLabel: source ? 'update-connection--button' : 'add-connection--button',
}}
>
<SourceStep
ref={c => (this.sourceStepRef = c)}
@ -109,6 +113,7 @@ class ConnectionWizard extends PureComponent<Props & WithRouterProps, State> {
nextLabel={this.dashboardNextLabel}
onNext={this.handleDashboardNext}
previousLabel="Go Back"
testId={{previousLabel: 'go-back--button', nextLabel: 'next--button'}}
>
<DashboardStep
ref={c => (this.dashboardStepRef = c)}
@ -127,6 +132,10 @@ class ConnectionWizard extends PureComponent<Props & WithRouterProps, State> {
onPrevious={this.handleKapacitorPrev}
nextLabel="Continue"
previousLabel="Go Back"
testId={{
previousLabel: 'go-back--button',
nextLabel: 'continue--button',
}}
>
<KapacitorStep
ref={c => (this.kapacitorStepRef = c)}
@ -147,6 +156,10 @@ class ConnectionWizard extends PureComponent<Props & WithRouterProps, State> {
onPrevious={this.handleCompletionPrev}
nextLabel="Finish"
previousLabel="Go Back"
testId={{
previousLabel: 'go-back--button',
nextLabel: 'finish--button',
}}
>
<CompletionStep ref={c => (this.completionStepRef = c)} />
</WizardStep>

View File

@ -54,6 +54,7 @@ class InfluxTable extends PureComponent<Props> {
deleteKapacitor={deleteKapacitor}
setActiveKapacitor={setActiveKapacitor}
toggleWizard={toggleWizard}
testId="connection-row"
/>
)
})}

View File

@ -18,6 +18,7 @@ interface Props {
setActiveKapacitor: (kapacitor: Kapacitor) => void
deleteKapacitor: (kapacitor: Kapacitor) => void
toggleWizard: ToggleWizard
testId?: string
}
class InfluxTableRow extends PureComponent<Props & WithRouterProps> {
@ -36,10 +37,11 @@ class InfluxTableRow extends PureComponent<Props & WithRouterProps> {
setActiveKapacitor,
deleteKapacitor,
toggleWizard,
testId,
} = this.props
return (
<tr className={this.className}>
<tr className={this.className} data-test={testId}>
<td>{this.connectButton}</td>
<td>
<ConnectionLink