Skip to content

Commit

Permalink
[ML] Functional tests - stabilize waiting for AD, DFA, TFM job list r…
Browse files Browse the repository at this point in the history
…efresh (#74064)

With this PR, the job list refresh for anomaly detection, data frame analytics and transforms is waiting for the refresh loading indicator to disappear before moving on.
  • Loading branch information
pheyos authored Aug 3, 2020
1 parent 426651e commit a25feb6
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export const RefreshAnalyticsListButton: FC = () => {
const { refresh } = useRefreshAnalyticsList({ isLoading: setIsLoading });
return (
<EuiButtonEmpty
data-test-subj="mlAnalyticsRefreshListButton"
data-test-subj={`mlAnalyticsRefreshListButton${isLoading ? ' loading' : ' loaded'}`}
onClick={refresh}
isLoading={isLoading}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { FormattedMessage } from '@kbn/i18n/react';

export const RefreshJobsListButton = ({ onRefreshClick, isRefreshing }) => (
<EuiButtonEmpty
data-test-subj="mlRefreshJobListButton"
data-test-subj={`mlRefreshJobListButton${isRefreshing ? ' loading' : ' loaded'}`}
onClick={onRefreshClick}
isLoading={isRefreshing}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export const RefreshTransformListButton: FC<RefreshTransformListButton> = ({
<EuiButton
color="secondary"
iconType="refresh"
data-test-subj="transformRefreshTransformListButton"
data-test-subj={`transformRefreshTransformListButton${isLoading ? ' loading' : ' loaded'}`}
onClick={onClick}
isLoading={isLoading}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,15 @@ export function MachineLearningDataFrameAnalyticsTableProvider({ getService }: F
return rows;
}

public async waitForRefreshButtonLoaded() {
await testSubjects.existOrFail('~mlAnalyticsRefreshListButton', { timeout: 10 * 1000 });
await testSubjects.existOrFail('mlAnalyticsRefreshListButton loaded', { timeout: 30 * 1000 });
}

public async refreshAnalyticsTable() {
await testSubjects.click('mlAnalyticsRefreshListButton');
await this.waitForRefreshButtonLoaded();
await testSubjects.click('~mlAnalyticsRefreshListButton');
await this.waitForRefreshButtonLoaded();
await this.waitForAnalyticsToLoad();
}

Expand Down
9 changes: 8 additions & 1 deletion x-pack/test/functional/services/ml/job_table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,15 @@ export function MachineLearningJobTableProvider({ getService }: FtrProviderConte
});
}

public async waitForRefreshButtonLoaded() {
await testSubjects.existOrFail('~mlRefreshJobListButton', { timeout: 10 * 1000 });
await testSubjects.existOrFail('mlRefreshJobListButton loaded', { timeout: 30 * 1000 });
}

public async refreshJobList() {
await testSubjects.click('mlRefreshJobListButton');
await this.waitForRefreshButtonLoaded();
await testSubjects.click('~mlRefreshJobListButton');
await this.waitForRefreshButtonLoaded();
await this.waitForJobsToLoad();
}

Expand Down
13 changes: 12 additions & 1 deletion x-pack/test/functional/services/transform/transform_table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,19 @@ export function TransformTableProvider({ getService }: FtrProviderContext) {
});
}

public async waitForRefreshButtonLoaded() {
await testSubjects.existOrFail('~transformRefreshTransformListButton', {
timeout: 10 * 1000,
});
await testSubjects.existOrFail('transformRefreshTransformListButton loaded', {
timeout: 30 * 1000,
});
}

public async refreshTransformList() {
await testSubjects.click('transformRefreshTransformListButton');
await this.waitForRefreshButtonLoaded();
await testSubjects.click('~transformRefreshTransformListButton');
await this.waitForRefreshButtonLoaded();
await this.waitForTransformsToLoad();
}

Expand Down

0 comments on commit a25feb6

Please sign in to comment.