-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ML] Advanced wizard functional UI tests #49480
Conversation
Pinging @elastic/ml-ui (:ml) |
@@ -166,3 +172,7 @@ const DuplicateDetectorsWarning: FC<{ validation: Validation }> = ({ validation | |||
</Fragment> | |||
); | |||
}; | |||
|
|||
const DetectorIdentifier: FC<{ detector: Detector }> = ({ detector }) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i'm not sure about the name DetectorIdentifier
.
It's not obvious what it'll produce.
The component produces a string describing the detector. something like StringifiedDetector
is closer to what it's doing, but that's not great either.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Renamed in f32ca31
@@ -8,10 +8,24 @@ import expect from '@kbn/expect'; | |||
import { isEmpty } from 'lodash'; | |||
import { FtrProviderContext } from '../../ftr_provider_context'; | |||
|
|||
export enum JobState { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are const enums in ML which could be used instead of defining your own.
https://github.com/elastic/kibana/blob/master/x-pack/legacy/plugins/ml/common/constants/states.ts
If it's not possible to import from ML like that, i'd suggest you copy the style and make these constants upper case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great hint, thanks! Changed it in f32ca31
@@ -8,10 +8,24 @@ import expect from '@kbn/expect'; | |||
import { isEmpty } from 'lodash'; | |||
import { FtrProviderContext } from '../../ftr_provider_context'; | |||
|
|||
export enum JobState { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are const enums in ML which could be used instead of defining your own.
https://github.com/elastic/kibana/blob/master/x-pack/legacy/plugins/ml/common/constants/states.ts
If it's not possible to import from ML like that, i'd suggest you copy the style and make these constants upper case.
.then((res: any) => res.body); | ||
|
||
expect(jobStats.jobs).to.have.length(1); | ||
const state = jobStats.jobs[0].state as JobState; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
type assertion isn't needed here. this could be:
const state: JobState = jobStats.jobs[0].state;
or const state: JOB_STATE = jobStats.jobs[0].state;
if the previous suggested change is made.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in f32ca31
.then((res: any) => res.body); | ||
|
||
expect(datafeedStats.datafeeds).to.have.length(1); | ||
const state = datafeedStats.datafeeds[0].state as DatafeedState; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same suggestion as before about removing the as
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in f32ca31
💚 Build Succeeded |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall, LGTM - approving to avoid being a blocker once the enum and typescript changes have been done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, just added suggestions/questions about some subject namings.
<EuiPanel paddingSize="m"> | ||
<EuiFlexGroup> | ||
<EuiFlexItem> | ||
{d.detector_description !== undefined ? ( | ||
<div style={{ fontWeight: 'bold' }}>{d.detector_description}</div> | ||
<div style={{ fontWeight: 'bold' }} data-test-subj="detectorDescription"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this subject be mlDetectorDescription
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was originally planned to be nested subject only as it's not necessarily unique on its own, i.e. it's currently used as
mlAdvancedDetector ${detectorIndex} > detectorIdentifier
but it makes sense to keep our ml
namespace here as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Renamed in dfe2e17
@@ -166,3 +172,7 @@ const DuplicateDetectorsWarning: FC<{ validation: Validation }> = ({ validation | |||
</Fragment> | |||
); | |||
}; | |||
|
|||
const StringifiedDetector: FC<{ detector: Detector }> = ({ detector }) => { | |||
return <div data-test-subj="detectorIdentifier">{detectorToString(detector)}</div>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this subject be mlDetectorIdentifier
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See above, renamed in dfe2e17
💔 Build Failed |
💚 Build Succeeded |
This PR adds tests for the ML advanced wizard.
This PR adds tests for the ML advanced wizard.
Summary
This PR adds tests for the ML advanced wizard.
High level test steps
These steps are executed for two jobs:
one with a couple metric detectors to cover some functions and the different the usage of field / by field / over field / partition field
high_count
mean("products.base_price") by "category.keyword
sum("products.discount_amount") over customer_id
median(total_quantity) partition_field_name=customer_gender
max(total_quantity) by "geoip.continent_name" over customer_id partition_field_name=customer_gender
one with a categorization field and a corresponding detector
count by mlcategory
Other changes
data-test-subj
attributes to the ML UI