Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ML] Functional tests - stabilize 'typing with checks' service method #81338

Merged
merged 1 commit into from
Oct 22, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions x-pack/test/functional/services/ml/common_ui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export function MachineLearningCommonUIProvider({ getService }: FtrProviderConte
// clicking on the testSubject
const input = await find.activeElement();

// make sure that clearing the element's value works
await retry.tryForTime(5000, async () => {
let currentValue = await input.getAttribute('value');
if (currentValue !== '') {
Expand All @@ -53,6 +54,7 @@ export function MachineLearningCommonUIProvider({ getService }: FtrProviderConte
}
});

// make sure that typing a character really adds that character to the input value
for (const chr of text) {
await retry.tryForTime(5000, async () => {
const oldValue = await input.getAttribute('value');
Expand All @@ -70,6 +72,16 @@ export function MachineLearningCommonUIProvider({ getService }: FtrProviderConte
});
});
}

// make sure that finally the complete text is entered
// this is needed because sometimes the field value is reset while typing
// and the above character checking might not catch it due to bad timing
const currentValue = await input.getAttribute('value');
if (currentValue !== text) {
throw new Error(
`Expected input '${selector}' to have the value '${text}' (got ${currentValue})`
);
}
});
},

Expand Down