Merge pull request #12267 from influxdata/tests(explorer)/filter-functions
test(explorer): add end-to-end testing for filtering functions by namepull/12270/head
commit
cd992cd644
|
@ -50,4 +50,11 @@ describe('DataExplorer', () => {
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('can filter aggregation functions by name from script editor mode', () => {
|
||||||
|
cy.getByTestID('switch-to-script-editor').click()
|
||||||
|
|
||||||
|
cy.get('.input-field').type('covariance')
|
||||||
|
cy.getByTestID('toolbar-function').should('have.length', 1)
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
|
@ -49,7 +49,7 @@ class TimeMachineFluxEditor extends PureComponent<Props, State> {
|
||||||
super(props)
|
super(props)
|
||||||
|
|
||||||
this.state = {
|
this.state = {
|
||||||
displayFluxFunctions: false,
|
displayFluxFunctions: true,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -83,16 +83,16 @@ class TimeMachineFluxEditor extends PureComponent<Props, State> {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<div className="toolbar-tab-container">
|
<div className="toolbar-tab-container">
|
||||||
<ToolbarTab
|
|
||||||
onSetActive={this.hideFluxFunctions}
|
|
||||||
name={'Variables'}
|
|
||||||
active={!this.state.displayFluxFunctions}
|
|
||||||
/>
|
|
||||||
<ToolbarTab
|
<ToolbarTab
|
||||||
onSetActive={this.showFluxFunctions}
|
onSetActive={this.showFluxFunctions}
|
||||||
name={'Functions'}
|
name={'Functions'}
|
||||||
active={this.state.displayFluxFunctions}
|
active={this.state.displayFluxFunctions}
|
||||||
/>
|
/>
|
||||||
|
<ToolbarTab
|
||||||
|
onSetActive={this.hideFluxFunctions}
|
||||||
|
name={'Variables'}
|
||||||
|
active={!this.state.displayFluxFunctions}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
{this.rightDivision}
|
{this.rightDivision}
|
||||||
</>
|
</>
|
||||||
|
|
|
@ -24,6 +24,7 @@ const FunctionCategory: SFC<Props> = props => {
|
||||||
onClickFunction={onClickFunction}
|
onClickFunction={onClickFunction}
|
||||||
key={func.name}
|
key={func.name}
|
||||||
func={func}
|
func={func}
|
||||||
|
testID="toolbar-function"
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
</dl>
|
</dl>
|
||||||
|
|
|
@ -10,6 +10,7 @@ import {FluxToolbarFunction} from 'src/types/shared'
|
||||||
interface Props {
|
interface Props {
|
||||||
func: FluxToolbarFunction
|
func: FluxToolbarFunction
|
||||||
onClickFunction: (name: string, example: string) => void
|
onClickFunction: (name: string, example: string) => void
|
||||||
|
testID?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
interface State {
|
interface State {
|
||||||
|
@ -18,11 +19,14 @@ interface State {
|
||||||
}
|
}
|
||||||
|
|
||||||
class ToolbarFunction extends PureComponent<Props, State> {
|
class ToolbarFunction extends PureComponent<Props, State> {
|
||||||
|
public static defaultProps: Partial<Props> = {
|
||||||
|
testID: 'toolbar-function',
|
||||||
|
}
|
||||||
public state: State = {isActive: false, hoverPosition: undefined}
|
public state: State = {isActive: false, hoverPosition: undefined}
|
||||||
private functionRef = createRef<HTMLDivElement>()
|
private functionRef = createRef<HTMLDivElement>()
|
||||||
|
|
||||||
public render() {
|
public render() {
|
||||||
const {func} = this.props
|
const {func, testID} = this.props
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
|
@ -30,6 +34,7 @@ class ToolbarFunction extends PureComponent<Props, State> {
|
||||||
ref={this.functionRef}
|
ref={this.functionRef}
|
||||||
onMouseEnter={this.handleHover}
|
onMouseEnter={this.handleHover}
|
||||||
onMouseLeave={this.handleStopHover}
|
onMouseLeave={this.handleStopHover}
|
||||||
|
data-testid={testID}
|
||||||
>
|
>
|
||||||
{this.tooltip}
|
{this.tooltip}
|
||||||
<dd onClick={this.handleClickFunction}>
|
<dd onClick={this.handleClickFunction}>
|
||||||
|
|
Loading…
Reference in New Issue