Skip to content

Commit

Permalink
[8.x] [ML] Functional tests - stabilize forecast tests (#192737) (#19…
Browse files Browse the repository at this point in the history
…2861)

# Backport

This will backport the following commits from `main` to `8.x`:
- [[ML] Functional tests - stabilize forecast tests
(#192737)](#192737)

<!--- Backport version: 9.4.3 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Robert
Oskamp","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-09-13T12:48:51Z","message":"[ML]
Functional tests - stabilize forecast tests (#192737)\n\n##
Summary\r\n\r\nThis PR stabilizes and re-enables the forecast tests in
the ML\r\npermission and results view test suites by waiting for global
loading to\r\nfinish before checking the forecast `Run` button
state.\r\n\r\n### Details\r\n\r\nI was able to reproduce the original
failures by running the test suites\r\nin my local browser with network
speed throttled to `3G`: the forecast\r\nmodal opened and the `Run`
button was disabled during global page\r\nloading, so the enabled check
failed. Introducing the global loading\r\nwait fixed the tests for the
throttled local runs.\r\n\r\nCloses #189565\r\nCloses #189537\r\nCloses
#164381","sha":"e528c8bd8e49ec928df8f08a219d7b4df79c81cb","branchLabelMapping":{"^v9.0.0$":"main","^v8.16.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":[":ml","Feature:Anomaly
Detection","release_note:skip","v9.0.0","backport:prev-minor","v8.16.0"],"title":"[ML]
Functional tests - stabilize forecast
tests","number":192737,"url":"https://github.com/elastic/kibana/pull/192737","mergeCommit":{"message":"[ML]
Functional tests - stabilize forecast tests (#192737)\n\n##
Summary\r\n\r\nThis PR stabilizes and re-enables the forecast tests in
the ML\r\npermission and results view test suites by waiting for global
loading to\r\nfinish before checking the forecast `Run` button
state.\r\n\r\n### Details\r\n\r\nI was able to reproduce the original
failures by running the test suites\r\nin my local browser with network
speed throttled to `3G`: the forecast\r\nmodal opened and the `Run`
button was disabled during global page\r\nloading, so the enabled check
failed. Introducing the global loading\r\nwait fixed the tests for the
throttled local runs.\r\n\r\nCloses #189565\r\nCloses #189537\r\nCloses
#164381","sha":"e528c8bd8e49ec928df8f08a219d7b4df79c81cb"}},"sourceBranch":"main","suggestedTargetBranches":["8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/192737","number":192737,"mergeCommit":{"message":"[ML]
Functional tests - stabilize forecast tests (#192737)\n\n##
Summary\r\n\r\nThis PR stabilizes and re-enables the forecast tests in
the ML\r\npermission and results view test suites by waiting for global
loading to\r\nfinish before checking the forecast `Run` button
state.\r\n\r\n### Details\r\n\r\nI was able to reproduce the original
failures by running the test suites\r\nin my local browser with network
speed throttled to `3G`: the forecast\r\nmodal opened and the `Run`
button was disabled during global page\r\nloading, so the enabled check
failed. Introducing the global loading\r\nwait fixed the tests for the
throttled local runs.\r\n\r\nCloses #189565\r\nCloses #189537\r\nCloses
#164381","sha":"e528c8bd8e49ec928df8f08a219d7b4df79c81cb"}},{"branch":"8.x","label":"v8.16.0","branchLabelMappingKey":"^v8.16.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Robert Oskamp <[email protected]>
  • Loading branch information
kibanamachine and pheyos authored Sep 13, 2024
1 parent 2c14450 commit ce00858
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@ export default function ({ getService }: FtrProviderContext) {
describe('forecasts', function () {
this.tags(['ml']);

// FLAKY: https://github.com/elastic/kibana/issues/164381
describe.skip('with single metric job', function () {
describe('with single metric job', function () {
before(async () => {
await esArchiver.loadIfNeeded('x-pack/test/functional/es_archives/ml/farequote');
await ml.testResources.createDataViewIfNeeded('ft_farequote', '@timestamp');
Expand Down
4 changes: 1 addition & 3 deletions x-pack/test/functional/apps/ml/permissions/full_ml_access.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,9 +176,7 @@ export default function ({ getService }: FtrProviderContext) {
});

for (const testUser of testUsers) {
// FLAKY: https://github.com/elastic/kibana/issues/189565
// FLAKY: https://github.com/elastic/kibana/issues/189537
describe.skip(`(${testUser.user})`, function () {
describe(`(${testUser.user})`, function () {
before(async () => {
await ml.securityUI.loginAs(testUser.user);
});
Expand Down
4 changes: 3 additions & 1 deletion x-pack/test/functional/services/ml/forecast.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ import expect from '@kbn/expect';

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

export function MachineLearningForecastProvider({ getService }: FtrProviderContext) {
export function MachineLearningForecastProvider({ getPageObject, getService }: FtrProviderContext) {
const testSubjects = getService('testSubjects');
const retry = getService('retry');
const headerPage = getPageObject('header');

return {
async assertForecastButtonExists() {
Expand Down Expand Up @@ -102,6 +103,7 @@ export function MachineLearningForecastProvider({ getService }: FtrProviderConte
},

async assertForecastModalRunButtonEnabled(expectedValue: boolean) {
await headerPage.waitUntilLoadingHasFinished();
const isEnabled = await testSubjects.isEnabled('mlModalForecast > mlModalForecastButtonRun');
expect(isEnabled).to.eql(
expectedValue,
Expand Down

0 comments on commit ce00858

Please sign in to comment.