Skip to content

Commit

Permalink
[ML] Tweak functional tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
walterra committed Apr 26, 2021
1 parent a150df4 commit 2616008
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
10 changes: 8 additions & 2 deletions x-pack/test/functional/services/transform/discover.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,21 @@ export function TransformDiscoverProvider({ getService }: FtrProviderContext) {

const actualDiscoverQueryHits = await testSubjects.getVisibleText('discoverQueryHits');

expect(actualDiscoverQueryHits).to.be(expectedDiscoverQueryHits);
expect(actualDiscoverQueryHits).to.eql(
expectedDiscoverQueryHits,
`Discover query hits should be ${expectedDiscoverQueryHits}, got ${actualDiscoverQueryHits}`
);
},

async assertNoResults(expectedDestinationIndex: string) {
// Discover should use the destination index pattern
const actualIndexPatternSwitchLinkText = await (
await testSubjects.find('indexPattern-switch-link')
).getVisibleText();
expect(actualIndexPatternSwitchLinkText).to.be(expectedDestinationIndex);
expect(actualIndexPatternSwitchLinkText).to.eql(
expectedDestinationIndex,
`Destination index should be ${expectedDestinationIndex}, got ${expectedDestinationIndex}`
);

await testSubjects.existOrFail('discoverNoResults');
},
Expand Down
8 changes: 5 additions & 3 deletions x-pack/test/functional/services/transform/transform_table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import expect from '@kbn/expect';

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

type TransformRowActionName = 'Clone' | 'Delete' | 'Edit' | 'Start' | 'Stop' | 'Discover';

export function TransformTableProvider({ getService }: FtrProviderContext) {
const retry = getService('retry');
const testSubjects = getService('testSubjects');
Expand Down Expand Up @@ -252,7 +254,7 @@ export function TransformTableProvider({ getService }: FtrProviderContext) {

public async assertTransformRowActionEnabled(
transformId: string,
action: 'Delete' | 'Start' | 'Stop' | 'Clone' | 'Edit',
action: TransformRowActionName,
expectedValue: boolean
) {
const selector = `transformAction${action}`;
Expand All @@ -275,7 +277,7 @@ export function TransformTableProvider({ getService }: FtrProviderContext) {

public async clickTransformRowActionWithRetry(
transformId: string,
action: 'Clone' | 'Delete' | 'Edit' | 'Start' | 'Stop' | 'Discover'
action: TransformRowActionName
) {
await retry.tryForTime(30 * 1000, async () => {
await browser.pressKeys(browser.keys.ESCAPE);
Expand All @@ -286,7 +288,7 @@ export function TransformTableProvider({ getService }: FtrProviderContext) {
});
}

public async clickTransformRowAction(action: string) {
public async clickTransformRowAction(action: TransformRowActionName) {
await testSubjects.click(`transformAction${action}`);
}

Expand Down

0 comments on commit 2616008

Please sign in to comment.