Skip to content

Commit 0148f41

Browse files
committed
[ML] Functional tests: Set sample size to 10000.
1 parent bf91323 commit 0148f41

File tree

7 files changed

+88
-11
lines changed

7 files changed

+88
-11
lines changed

x-pack/plugins/ml/public/application/components/scatterplot_matrix/scatterplot_matrix.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,7 @@ export const ScatterplotMatrix: FC<ScatterplotMatrixProps> = ({
317317
fullWidth
318318
>
319319
<EuiSelect
320+
data-test-subj="mlScatterplotMatrixSampleSizeSelect"
320321
compressed
321322
options={sampleSizeOptions}
322323
value={fetchSize}
@@ -341,7 +342,7 @@ export const ScatterplotMatrix: FC<ScatterplotMatrixProps> = ({
341342
fullWidth
342343
>
343344
<EuiSwitch
344-
data-test-subj={`mlScatterplotMatrixRandomizeQuerySwitch`}
345+
data-test-subj="mlScatterplotMatrixRandomizeQuerySwitch"
345346
name="mlScatterplotMatrixRandomizeQuery"
346347
label={randomizeQuery ? TOGGLE_ON : TOGGLE_OFF}
347348
checked={randomizeQuery}

x-pack/test/functional/apps/ml/data_frame_analytics/classification_creation.ts

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ export default function ({ getService }: FtrProviderContext) {
5454
// tick/grid/axis
5555
{ color: '#DDDDDD', percentage: 8 },
5656
{ color: '#D3DAE6', percentage: 8 },
57-
{ color: '#F5F7FA', percentage: 20 },
57+
{ color: '#F5F7FA', percentage: 15 },
5858
],
5959
row: {
6060
type: 'classification',
@@ -77,6 +77,10 @@ export default function ({ getService }: FtrProviderContext) {
7777
await ml.navigation.navigateToDataFrameAnalytics();
7878

7979
await ml.testExecution.logTestStep('loads the source selection modal');
80+
81+
// Disable anti-aliasing to stabilize canvas image rendering assertions
82+
await ml.commonUI.disableAntiAliasing();
83+
8084
await ml.dataFrameAnalytics.startAnalyticsCreation();
8185

8286
await ml.testExecution.logTestStep(
@@ -105,6 +109,11 @@ export default function ({ getService }: FtrProviderContext) {
105109
await ml.testExecution.logTestStep('displays the include fields selection');
106110
await ml.dataFrameAnalyticsCreation.assertIncludeFieldsSelectionExists();
107111

112+
await ml.testExecution.logTestStep(
113+
'sets the sample size to 10000 for the scatterplot matrix'
114+
);
115+
await ml.dataFrameAnalyticsCreation.setScatterplotMatrixSampleSizeSelectValue('10000');
116+
108117
await ml.testExecution.logTestStep(
109118
'sets the randomize query switch to true for the scatterplot matrix'
110119
);
@@ -258,6 +267,11 @@ export default function ({ getService }: FtrProviderContext) {
258267
20
259268
);
260269

270+
await ml.testExecution.logTestStep(
271+
'sets the sample size to 10000 for the scatterplot matrix'
272+
);
273+
await ml.dataFrameAnalyticsResults.setScatterplotMatrixSampleSizeSelectValue('10000');
274+
261275
await ml.testExecution.logTestStep(
262276
'sets the randomize query switch to true for the scatterplot matrix'
263277
);
@@ -267,6 +281,8 @@ export default function ({ getService }: FtrProviderContext) {
267281
await ml.dataFrameAnalyticsResults.assertScatterplotMatrix(
268282
testData.expected.scatterplotMatrixColorStats
269283
);
284+
285+
await ml.commonUI.resetAntiAliasing();
270286
});
271287

272288
it('displays the analytics job in the map view', async () => {

x-pack/test/functional/apps/ml/data_frame_analytics/outlier_detection_creation.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,11 @@ export default function ({ getService }: FtrProviderContext) {
126126
await ml.testExecution.logTestStep('displays the include fields selection');
127127
await ml.dataFrameAnalyticsCreation.assertIncludeFieldsSelectionExists();
128128

129+
await ml.testExecution.logTestStep(
130+
'sets the sample size to 10000 for the scatterplot matrix'
131+
);
132+
await ml.dataFrameAnalyticsCreation.setScatterplotMatrixSampleSizeSelectValue('10000');
133+
129134
await ml.testExecution.logTestStep(
130135
'sets the randomize query switch to true for the scatterplot matrix'
131136
);
@@ -261,6 +266,11 @@ export default function ({ getService }: FtrProviderContext) {
261266
await ml.dataFrameAnalyticsResults.assertResultsTableNotEmpty();
262267
await ml.dataFrameAnalyticsResults.assertFeatureInfluenceCellNotEmpty();
263268

269+
await ml.testExecution.logTestStep(
270+
'sets the sample size to 10000 for the scatterplot matrix'
271+
);
272+
await ml.dataFrameAnalyticsResults.setScatterplotMatrixSampleSizeSelectValue('10000');
273+
264274
await ml.testExecution.logTestStep(
265275
'sets the randomize query switch to true for the scatterplot matrix'
266276
);
@@ -270,6 +280,8 @@ export default function ({ getService }: FtrProviderContext) {
270280
await ml.dataFrameAnalyticsResults.assertScatterplotMatrix(
271281
testData.expected.scatterplotMatrixColorStatsResults
272282
);
283+
284+
await ml.commonUI.resetAntiAliasing();
273285
});
274286

275287
it('displays the analytics job in the map view', async () => {

x-pack/test/functional/apps/ml/data_frame_analytics/regression_creation.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,10 @@ export default function ({ getService }: FtrProviderContext) {
7171
await ml.navigation.navigateToDataFrameAnalytics();
7272

7373
await ml.testExecution.logTestStep('loads the source selection modal');
74+
75+
// Disable anti-aliasing to stabilize canvas image rendering assertions
76+
await ml.commonUI.disableAntiAliasing();
77+
7478
await ml.dataFrameAnalytics.startAnalyticsCreation();
7579

7680
await ml.testExecution.logTestStep(
@@ -99,6 +103,11 @@ export default function ({ getService }: FtrProviderContext) {
99103
await ml.testExecution.logTestStep('displays the include fields selection');
100104
await ml.dataFrameAnalyticsCreation.assertIncludeFieldsSelectionExists();
101105

106+
await ml.testExecution.logTestStep(
107+
'sets the sample size to 10000 for the scatterplot matrix'
108+
);
109+
await ml.dataFrameAnalyticsCreation.setScatterplotMatrixSampleSizeSelectValue('10000');
110+
102111
await ml.testExecution.logTestStep(
103112
'sets the randomize query switch to true for the scatterplot matrix'
104113
);
@@ -235,6 +244,11 @@ export default function ({ getService }: FtrProviderContext) {
235244
await ml.dataFrameAnalyticsResults.assertResultsTableTrainingFiltersExist();
236245
await ml.dataFrameAnalyticsResults.assertResultsTableNotEmpty();
237246

247+
await ml.testExecution.logTestStep(
248+
'sets the sample size to 10000 for the scatterplot matrix'
249+
);
250+
await ml.dataFrameAnalyticsResults.setScatterplotMatrixSampleSizeSelectValue('10000');
251+
238252
await ml.testExecution.logTestStep(
239253
'sets the randomize query switch to true for the scatterplot matrix'
240254
);
@@ -244,6 +258,8 @@ export default function ({ getService }: FtrProviderContext) {
244258
await ml.dataFrameAnalyticsResults.assertScatterplotMatrix(
245259
testData.expected.scatterplotMatrixColorStats
246260
);
261+
262+
await ml.commonUI.resetAntiAliasing();
247263
});
248264

249265
it('displays the analytics job in the map view', async () => {

x-pack/test/functional/services/ml/common_ui.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { ProvidedType } from '@kbn/test/types/ftr';
1010

1111
import { FtrProviderContext } from '../../ftr_provider_context';
1212

13-
import { CanvasElementColorStats } from '../canvas_element';
13+
import type { CanvasElementColorStats } from '../canvas_element';
1414

1515
interface SetValueOptions {
1616
clearWithKeyboard?: boolean;

x-pack/test/functional/services/ml/data_frame_analytics_creation.ts

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,20 @@ export function MachineLearningDataFrameAnalyticsCreationProvider(
274274
);
275275
},
276276

277+
async setScatterplotMatrixSampleSizeSelectValue(selectValue: string) {
278+
await testSubjects.selectValue('mlScatterplotMatrixSampleSizeSelect', selectValue);
279+
280+
const actualSelectState = await testSubjects.getAttribute(
281+
'mlScatterplotMatrixSampleSizeSelect',
282+
'value'
283+
);
284+
285+
expect(actualSelectState).to.eql(
286+
selectValue,
287+
`Sample size should be '${selectValue}' (got '${actualSelectState}')`
288+
);
289+
},
290+
277291
async getScatterplotMatrixRandomizeQuerySwitchCheckState(): Promise<boolean> {
278292
const state = await testSubjects.getAttribute(
279293
'mlScatterplotMatrixRandomizeQuerySwitch',
@@ -291,10 +305,12 @@ export function MachineLearningDataFrameAnalyticsCreationProvider(
291305
},
292306

293307
async setScatterplotMatrixRandomizeQueryCheckState(checkState: boolean) {
294-
if ((await this.getScatterplotMatrixRandomizeQuerySwitchCheckState()) !== checkState) {
295-
await testSubjects.click('mlScatterplotMatrixRandomizeQuerySwitch');
296-
}
297-
await this.assertScatterplotMatrixRandomizeQueryCheckState(checkState);
308+
await retry.tryForTime(30000, async () => {
309+
if ((await this.getScatterplotMatrixRandomizeQuerySwitchCheckState()) !== checkState) {
310+
await testSubjects.click('mlScatterplotMatrixRandomizeQuerySwitch');
311+
}
312+
await this.assertScatterplotMatrixRandomizeQueryCheckState(checkState);
313+
});
298314
},
299315

300316
async assertTrainingPercentInputExists() {

x-pack/test/functional/services/ml/data_frame_analytics_results.ts

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,20 @@ export function MachineLearningDataFrameAnalyticsResultsProvider(
8585
});
8686
},
8787

88+
async setScatterplotMatrixSampleSizeSelectValue(selectValue: string) {
89+
await testSubjects.selectValue('mlScatterplotMatrixSampleSizeSelect', selectValue);
90+
91+
const actualSelectState = await testSubjects.getAttribute(
92+
'mlScatterplotMatrixSampleSizeSelect',
93+
'value'
94+
);
95+
96+
expect(actualSelectState).to.eql(
97+
selectValue,
98+
`Sample size should be '${selectValue}' (got '${actualSelectState}')`
99+
);
100+
},
101+
88102
async getScatterplotMatrixRandomizeQuerySwitchCheckState(): Promise<boolean> {
89103
const state = await testSubjects.getAttribute(
90104
'mlScatterplotMatrixRandomizeQuerySwitch',
@@ -102,10 +116,12 @@ export function MachineLearningDataFrameAnalyticsResultsProvider(
102116
},
103117

104118
async setScatterplotMatrixRandomizeQueryCheckState(checkState: boolean) {
105-
if ((await this.getScatterplotMatrixRandomizeQuerySwitchCheckState()) !== checkState) {
106-
await testSubjects.click('mlScatterplotMatrixRandomizeQuerySwitch');
107-
}
108-
await this.assertScatterplotMatrixRandomizeQueryCheckState(checkState);
119+
await retry.tryForTime(30000, async () => {
120+
if ((await this.getScatterplotMatrixRandomizeQuerySwitchCheckState()) !== checkState) {
121+
await testSubjects.click('mlScatterplotMatrixRandomizeQuerySwitch');
122+
}
123+
await this.assertScatterplotMatrixRandomizeQueryCheckState(checkState);
124+
});
109125
},
110126

111127
async assertScatterplotMatrix(expectedValue: CanvasElementColorStats) {

0 commit comments

Comments
 (0)