2d0b32a40a
* [Discover] Updating a functional test * [Discover] Support for edit operation * Fix unit tests * Fix typescript * Fixing failing functional test * Fixing wrongly commented line * Uncomment accidentally commented line * Reintroducing accidnetally removed unit test * Trigger data refetch onSave * Remove refreshAppState variable * Bundling observers together * Clean state before refetch * Update formatting in data grid * [Discover] Updating a functional test * Adding a functional test * Fixing package.json * Reset fieldCount after data fetch * [Discover] Updating a functional test * Don't allow editing of unmapped fields * Fix issues with mobile display * Allow editing if it's a runtime field * [Discover] Updating a functional test Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
57 lines
1.9 KiB
TypeScript
57 lines
1.9 KiB
TypeScript
/*
|
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
* Side Public License, v 1.
|
|
*/
|
|
|
|
import { FtrProviderContext } from '../ftr_provider_context';
|
|
|
|
export function FieldEditorProvider({ getService }: FtrProviderContext) {
|
|
const browser = getService('browser');
|
|
const testSubjects = getService('testSubjects');
|
|
|
|
class FieldEditor {
|
|
public async setName(name: string) {
|
|
await testSubjects.setValue('nameField > input', name);
|
|
}
|
|
public async enableCustomLabel() {
|
|
await testSubjects.setEuiSwitch('customLabelRow > toggle', 'check');
|
|
}
|
|
public async setCustomLabel(name: string) {
|
|
await testSubjects.setValue('customLabelRow > input', name);
|
|
}
|
|
public async enableValue() {
|
|
await testSubjects.setEuiSwitch('valueRow > toggle', 'check');
|
|
}
|
|
public async disableValue() {
|
|
await testSubjects.setEuiSwitch('valueRow > toggle', 'uncheck');
|
|
}
|
|
public async typeScript(script: string) {
|
|
const editor = await (await testSubjects.find('valueRow')).findByClassName(
|
|
'react-monaco-editor-container'
|
|
);
|
|
const textarea = await editor.findByClassName('monaco-mouse-cursor-text');
|
|
|
|
await textarea.click();
|
|
await browser.pressKeys(script);
|
|
}
|
|
public async save() {
|
|
await testSubjects.click('fieldSaveButton');
|
|
}
|
|
|
|
public async confirmSave() {
|
|
await testSubjects.setValue('saveModalConfirmText', 'change');
|
|
await testSubjects.click('confirmModalConfirmButton');
|
|
}
|
|
|
|
public async confirmDelete() {
|
|
await testSubjects.setValue('deleteModalConfirmText', 'remove');
|
|
await testSubjects.click('confirmModalConfirmButton');
|
|
}
|
|
}
|
|
|
|
return new FieldEditor();
|
|
}
|