chore: add data-test attributes
parent
376e488df9
commit
ce9ce5b3ab
|
@ -168,6 +168,7 @@ class DashboardHeader extends Component<Props, State> {
|
||||||
icon={IconFont.AddCell}
|
icon={IconFont.AddCell}
|
||||||
onClick={onAddCell}
|
onClick={onAddCell}
|
||||||
titleText="Add a Cell to Dashboard"
|
titleText="Add a Cell to Dashboard"
|
||||||
|
dataTest="add-cell"
|
||||||
/>
|
/>
|
||||||
</Authorized>
|
</Authorized>
|
||||||
)
|
)
|
||||||
|
@ -186,13 +187,17 @@ class DashboardHeader extends Component<Props, State> {
|
||||||
if (dashboard) {
|
if (dashboard) {
|
||||||
let variablesTooltip = 'Show Template Variables Controls'
|
let variablesTooltip = 'Show Template Variables Controls'
|
||||||
let annotationsTooltip = 'Show Annotations Controls'
|
let annotationsTooltip = 'Show Annotations Controls'
|
||||||
|
let variablesDataTest = 'show-variables--button'
|
||||||
|
let annotationsDataTest = 'show-annotations--button'
|
||||||
|
|
||||||
if (showTempVarControls) {
|
if (showTempVarControls) {
|
||||||
variablesTooltip = 'Hide Template Variables Controls'
|
variablesTooltip = 'Hide Template Variables Controls'
|
||||||
|
variablesDataTest = 'hide-variables--button'
|
||||||
}
|
}
|
||||||
|
|
||||||
if (showAnnotationControls) {
|
if (showAnnotationControls) {
|
||||||
annotationsTooltip = 'Hide Annotations Controls'
|
annotationsTooltip = 'Hide Annotations Controls'
|
||||||
|
annotationsDataTest = 'hide-annotations--button'
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -203,6 +208,7 @@ class DashboardHeader extends Component<Props, State> {
|
||||||
onClick={onToggleShowTempVarControls}
|
onClick={onToggleShowTempVarControls}
|
||||||
active={showTempVarControls}
|
active={showTempVarControls}
|
||||||
titleText={variablesTooltip}
|
titleText={variablesTooltip}
|
||||||
|
dataTest={variablesDataTest}
|
||||||
/>
|
/>
|
||||||
<Button
|
<Button
|
||||||
text="Annotations"
|
text="Annotations"
|
||||||
|
@ -210,6 +216,7 @@ class DashboardHeader extends Component<Props, State> {
|
||||||
onClick={onToggleShowAnnotationControls}
|
onClick={onToggleShowAnnotationControls}
|
||||||
active={showAnnotationControls}
|
active={showAnnotationControls}
|
||||||
titleText={annotationsTooltip}
|
titleText={annotationsTooltip}
|
||||||
|
dataTest={annotationsDataTest}
|
||||||
/>
|
/>
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
|
|
|
@ -83,6 +83,7 @@ class DashboardsPageContents extends Component<Props, State> {
|
||||||
<SearchBar
|
<SearchBar
|
||||||
placeholder="Filter by Name..."
|
placeholder="Filter by Name..."
|
||||||
onSearch={this.filterDashboards}
|
onSearch={this.filterDashboards}
|
||||||
|
dataTest="dashboard-filter--input"
|
||||||
/>
|
/>
|
||||||
<Authorized requiredRole={EDITOR_ROLE}>
|
<Authorized requiredRole={EDITOR_ROLE}>
|
||||||
<>
|
<>
|
||||||
|
@ -90,12 +91,14 @@ class DashboardsPageContents extends Component<Props, State> {
|
||||||
text="Import Dashboard"
|
text="Import Dashboard"
|
||||||
icon={IconFont.Import}
|
icon={IconFont.Import}
|
||||||
onClick={this.handleToggleOverlay}
|
onClick={this.handleToggleOverlay}
|
||||||
|
dataTest="import-dashboard--button"
|
||||||
/>
|
/>
|
||||||
<Button
|
<Button
|
||||||
text="Create Dashboard"
|
text="Create Dashboard"
|
||||||
icon={IconFont.Plus}
|
icon={IconFont.Plus}
|
||||||
onClick={onCreateDashboard}
|
onClick={onCreateDashboard}
|
||||||
color={ComponentColor.Primary}
|
color={ComponentColor.Primary}
|
||||||
|
dataTest="create-dashboard-button"
|
||||||
/>
|
/>
|
||||||
</>
|
</>
|
||||||
</Authorized>
|
</Authorized>
|
||||||
|
|
|
@ -60,7 +60,10 @@ class DashboardsTable extends PureComponent<Props> {
|
||||||
{_.sortBy(dashboards, d => d.name.toLowerCase()).map(dashboard => (
|
{_.sortBy(dashboards, d => d.name.toLowerCase()).map(dashboard => (
|
||||||
<tr key={dashboard.id}>
|
<tr key={dashboard.id}>
|
||||||
<td>
|
<td>
|
||||||
<Link to={`${dashboardLink}/dashboards/${dashboard.id}`}>
|
<Link
|
||||||
|
to={`${dashboardLink}/dashboards/${dashboard.id}`}
|
||||||
|
data-test={`${dashboard.name}`}
|
||||||
|
>
|
||||||
{dashboard.name}
|
{dashboard.name}
|
||||||
</Link>
|
</Link>
|
||||||
</td>
|
</td>
|
||||||
|
|
|
@ -9,6 +9,7 @@ interface Props {
|
||||||
width?: number
|
width?: number
|
||||||
placeholder: string
|
placeholder: string
|
||||||
onSearch: (searchTerm: string) => void
|
onSearch: (searchTerm: string) => void
|
||||||
|
dataTest?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
interface State {
|
interface State {
|
||||||
|
@ -35,7 +36,7 @@ class SearchBar extends PureComponent<Props, State> {
|
||||||
}
|
}
|
||||||
|
|
||||||
public render() {
|
public render() {
|
||||||
const {placeholder, width} = this.props
|
const {placeholder, width, dataTest} = this.props
|
||||||
return (
|
return (
|
||||||
<div className="search-widget" style={{width: `${width}px`}}>
|
<div className="search-widget" style={{width: `${width}px`}}>
|
||||||
<input
|
<input
|
||||||
|
@ -43,6 +44,7 @@ class SearchBar extends PureComponent<Props, State> {
|
||||||
className="form-control input-sm"
|
className="form-control input-sm"
|
||||||
placeholder={placeholder}
|
placeholder={placeholder}
|
||||||
onChange={this.handleChange}
|
onChange={this.handleChange}
|
||||||
|
data-test={dataTest}
|
||||||
/>
|
/>
|
||||||
<span className="icon search" />
|
<span className="icon search" />
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -25,6 +25,7 @@ interface Props {
|
||||||
active?: boolean
|
active?: boolean
|
||||||
tabIndex?: number
|
tabIndex?: number
|
||||||
customClass?: string
|
customClass?: string
|
||||||
|
dataTest?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
@ErrorHandling
|
@ErrorHandling
|
||||||
|
@ -38,7 +39,7 @@ class Button extends Component<Props> {
|
||||||
}
|
}
|
||||||
|
|
||||||
public render() {
|
public render() {
|
||||||
const {onClick, text, titleText, tabIndex} = this.props
|
const {onClick, text, titleText, tabIndex, dataTest} = this.props
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<button
|
<button
|
||||||
|
@ -47,6 +48,7 @@ class Button extends Component<Props> {
|
||||||
onClick={onClick}
|
onClick={onClick}
|
||||||
title={titleText || text}
|
title={titleText || text}
|
||||||
tabIndex={tabIndex ? tabIndex : 0}
|
tabIndex={tabIndex ? tabIndex : 0}
|
||||||
|
data-test={dataTest}
|
||||||
>
|
>
|
||||||
{this.icon}
|
{this.icon}
|
||||||
{this.text}
|
{this.text}
|
||||||
|
|
|
@ -37,12 +37,14 @@ const AddAnnotationToggle: FunctionComponent<Props> = props => {
|
||||||
let buttonContent = 'Annotate'
|
let buttonContent = 'Annotate'
|
||||||
let buttonColor = ComponentColor.Primary
|
let buttonColor = ComponentColor.Primary
|
||||||
let buttonIcon = IconFont.AnnotatePlus
|
let buttonIcon = IconFont.AnnotatePlus
|
||||||
|
let buttonDataTest = 'add-annotation--button'
|
||||||
|
|
||||||
if (isAddingAnnotation) {
|
if (isAddingAnnotation) {
|
||||||
onToggle = onDismissAddingAnnotation
|
onToggle = onDismissAddingAnnotation
|
||||||
buttonContent = 'Cancel Annotate'
|
buttonContent = 'Cancel Annotate'
|
||||||
buttonColor = ComponentColor.Default
|
buttonColor = ComponentColor.Default
|
||||||
buttonIcon = IconFont.Remove
|
buttonIcon = IconFont.Remove
|
||||||
|
buttonDataTest = 'cancel-annotation--button'
|
||||||
} else {
|
} else {
|
||||||
onToggle = onAddingAnnotation
|
onToggle = onAddingAnnotation
|
||||||
}
|
}
|
||||||
|
@ -53,6 +55,7 @@ const AddAnnotationToggle: FunctionComponent<Props> = props => {
|
||||||
color={buttonColor}
|
color={buttonColor}
|
||||||
text={buttonContent}
|
text={buttonContent}
|
||||||
onClick={onToggle}
|
onClick={onToggle}
|
||||||
|
dataTest={buttonDataTest}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,6 +70,7 @@ class AnnotationControlBar extends PureComponent<Props> {
|
||||||
color={ComponentColor.Primary}
|
color={ComponentColor.Primary}
|
||||||
text={'Filter'}
|
text={'Filter'}
|
||||||
titleText={'Add New Annotation Tag Filter'}
|
titleText={'Add New Annotation Tag Filter'}
|
||||||
|
dataTest={'add-annotation-filter--button'}
|
||||||
/>
|
/>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
|
|
|
@ -71,7 +71,7 @@ class SideNav extends PureComponent<Props> {
|
||||||
const hostPageIsEnabled = !env.hostPageDisabled
|
const hostPageIsEnabled = !env.hostPageDisabled
|
||||||
|
|
||||||
return isHidden ? null : (
|
return isHidden ? null : (
|
||||||
<nav className="sidebar">
|
<nav className="sidebar" data-test="sidebar">
|
||||||
<div
|
<div
|
||||||
className={isDefaultPage ? 'sidebar--item active' : 'sidebar--item'}
|
className={isDefaultPage ? 'sidebar--item active' : 'sidebar--item'}
|
||||||
>
|
>
|
||||||
|
|
|
@ -134,6 +134,7 @@ class DashboardStep extends Component<Props, State> {
|
||||||
<SearchBar
|
<SearchBar
|
||||||
placeholder="Filter by name..."
|
placeholder="Filter by name..."
|
||||||
onSearch={this.setSearchTerm}
|
onSearch={this.setSearchTerm}
|
||||||
|
dataTest="filter-dashboards--input"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
{this.suggestedDashboardCards}
|
{this.suggestedDashboardCards}
|
||||||
|
|
Loading…
Reference in New Issue