Skip to content

Commit

Permalink
[ML] Functional tests - stabilize forecast tests (elastic#192737)
Browse files Browse the repository at this point in the history
## Summary

This PR stabilizes and re-enables the forecast tests in the ML
permission and results view test suites by waiting for global loading to
finish before checking the forecast `Run` button state.

### Details

I was able to reproduce the original failures by running the test suites
in my local browser with network speed throttled to `3G`: the forecast
modal opened and the `Run` button was disabled during global page
loading, so the enabled check failed. Introducing the global loading
wait fixed the tests for the throttled local runs.

Closes elastic#189565
Closes elastic#189537
Closes elastic#164381
  • Loading branch information
pheyos authored Sep 13, 2024
1 parent 48bbdd8 commit e528c8b
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 e528c8b

Please sign in to comment.