mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
Use setValue with clearing via keyboard
This commit is contained in:
parent
eba3c17ef7
commit
8019844732
2 changed files with 22 additions and 6 deletions
|
@ -27,6 +27,10 @@ interface ExistsOptions {
|
|||
allowHidden?: boolean;
|
||||
}
|
||||
|
||||
interface ClearOptions {
|
||||
withKeyboard: boolean;
|
||||
}
|
||||
|
||||
export function TestSubjectsProvider({ getService }: FtrProviderContext) {
|
||||
const log = getService('log');
|
||||
const retry = getService('retry');
|
||||
|
@ -151,7 +155,11 @@ export function TestSubjectsProvider({ getService }: FtrProviderContext) {
|
|||
});
|
||||
}
|
||||
|
||||
public async setValue(selector: string, text: string): Promise<void> {
|
||||
public async setValue(
|
||||
selector: string,
|
||||
text: string,
|
||||
options: ClearOptions = { withKeyboard: false }
|
||||
): Promise<void> {
|
||||
return await retry.try(async () => {
|
||||
log.debug(`TestSubjects.setValue(${selector}, ${text})`);
|
||||
await this.click(selector);
|
||||
|
@ -159,7 +167,11 @@ export function TestSubjectsProvider({ getService }: FtrProviderContext) {
|
|||
// call clearValue() and type() on the element that is focused after
|
||||
// clicking on the testSubject
|
||||
const input = await find.activeElement();
|
||||
await input.clearValue();
|
||||
if (options.withKeyboard === true) {
|
||||
await input.clearValueWithKeyboard();
|
||||
} else {
|
||||
await input.clearValue();
|
||||
}
|
||||
await input.type(text);
|
||||
});
|
||||
}
|
||||
|
|
|
@ -181,15 +181,17 @@ export function MachineLearningJobWizardCommonProvider({ getService }: FtrProvid
|
|||
},
|
||||
|
||||
async setBucketSpan(bucketSpan: string) {
|
||||
await testSubjects.setValue('mlJobWizardInputBucketSpan', bucketSpan);
|
||||
await testSubjects.setValue('mlJobWizardInputBucketSpan', bucketSpan, { withKeyboard: true });
|
||||
},
|
||||
|
||||
async setJobId(jobId: string) {
|
||||
await testSubjects.setValue('mlJobWizardInputJobId', jobId);
|
||||
await testSubjects.setValue('mlJobWizardInputJobId', jobId, { withKeyboard: true });
|
||||
},
|
||||
|
||||
async setJobDescription(jobDescription: string) {
|
||||
await testSubjects.setValue('mlJobWizardInputJobDescription', jobDescription);
|
||||
await testSubjects.setValue('mlJobWizardInputJobDescription', jobDescription, {
|
||||
withKeyboard: true,
|
||||
});
|
||||
},
|
||||
|
||||
async addJobGroup(jobGroup: string) {
|
||||
|
@ -216,7 +218,9 @@ export function MachineLearningJobWizardCommonProvider({ getService }: FtrProvid
|
|||
},
|
||||
|
||||
async setModelMemoryLimit(modelMemoryLimit: string) {
|
||||
await testSubjects.setValue('mlJobWizardInputModelMemoryLimit', modelMemoryLimit);
|
||||
await testSubjects.setValue('mlJobWizardInputModelMemoryLimit', modelMemoryLimit, {
|
||||
withKeyboard: true,
|
||||
});
|
||||
},
|
||||
|
||||
async createJobAndWaitForCompletion() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue