Skip to content

Commit

Permalink
Unskip add runtime field test (#118303)
Browse files Browse the repository at this point in the history
  • Loading branch information
Dosant authored Nov 11, 2021
1 parent 553db0b commit a906706
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 21 deletions.
5 changes: 2 additions & 3 deletions test/functional/apps/management/_runtime_fields.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ export default function ({ getService, getPageObjects }) {
const PageObjects = getPageObjects(['settings']);
const testSubjects = getService('testSubjects');

// FLAKY: https://github.com/elastic/kibana/issues/95376
describe.skip('runtime fields', function () {
describe('runtime fields', function () {
this.tags(['skipFirefox']);

before(async function () {
Expand Down Expand Up @@ -60,7 +59,7 @@ export default function ({ getService, getPageObjects }) {
await PageObjects.settings.filterField(fieldName);
await testSubjects.click('editFieldFormat');
await PageObjects.settings.setFieldType('Long');
await PageObjects.settings.changeFieldScript('emit(6);');
await PageObjects.settings.setFieldScript('emit(6);');
await testSubjects.find('changeWarning');
await PageObjects.settings.clickSaveField();
await PageObjects.settings.confirmSave();
Expand Down
20 changes: 3 additions & 17 deletions test/functional/page_objects/settings_page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -628,23 +628,9 @@ export class SettingsPageObject extends FtrService {

async setFieldScript(script: string) {
this.log.debug('set script = ' + script);
const valueRow = await this.toggleRow('valueRow');
const getMonacoTextArea = async () => (await valueRow.findAllByCssSelector('textarea'))[0];
this.retry.waitFor('monaco editor is ready', async () => !!(await getMonacoTextArea()));
const monacoTextArea = await getMonacoTextArea();
await monacoTextArea.focus();
this.browser.pressKeys(script);
}

async changeFieldScript(script: string) {
this.log.debug('set script = ' + script);
const valueRow = await this.testSubjects.find('valueRow');
const getMonacoTextArea = async () => (await valueRow.findAllByCssSelector('textarea'))[0];
this.retry.waitFor('monaco editor is ready', async () => !!(await getMonacoTextArea()));
const monacoTextArea = await getMonacoTextArea();
await monacoTextArea.focus();
this.browser.pressKeys(this.browser.keys.DELETE.repeat(30));
this.browser.pressKeys(script);
await this.toggleRow('valueRow');
await this.monacoEditor.waitCodeEditorReady('valueRow');
await this.monacoEditor.setCodeEditorValue(script);
}

async clickAddScriptedField() {
Expand Down
6 changes: 5 additions & 1 deletion test/functional/services/monaco_editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ export class MonacoEditorService extends FtrService {
private readonly browser = this.ctx.getService('browser');
private readonly testSubjects = this.ctx.getService('testSubjects');

public async waitCodeEditorReady(containerTestSubjId: string) {
const editorContainer = await this.testSubjects.find(containerTestSubjId);
await editorContainer.findByCssSelector('textarea');
}

public async getCodeEditorValue(nthIndex: number = 0) {
let values: string[] = [];

Expand All @@ -31,7 +36,6 @@ export class MonacoEditorService extends FtrService {
public async typeCodeEditorValue(value: string, testSubjId: string) {
const editor = await this.testSubjects.find(testSubjId);
const textarea = await editor.findByCssSelector('textarea');

await textarea.type(value);
}

Expand Down

0 comments on commit a906706

Please sign in to comment.