2020-02-19 21:16:58 +01:00
|
|
|
/*
|
2021-01-20 02:52:56 +01:00
|
|
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
|
|
* or more contributor license agreements. Licensed under the Elastic License
|
2021-02-04 03:12:39 +01:00
|
|
|
* 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.
|
2020-02-19 21:16:58 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
import expect from '@kbn/expect';
|
|
|
|
import { PluginFunctionalProviderContext } from 'test/plugin_functional/services';
|
|
|
|
|
|
|
|
// eslint-disable-next-line import/no-default-export
|
2020-05-22 09:08:58 +02:00
|
|
|
export default function ({ getService }: PluginFunctionalProviderContext) {
|
2020-02-19 21:16:58 +01:00
|
|
|
const testSubjects = getService('testSubjects');
|
2020-04-15 17:10:20 +02:00
|
|
|
const flyout = getService('flyout');
|
2020-06-16 10:42:37 +02:00
|
|
|
const retry = getService('retry');
|
2020-02-19 21:16:58 +01:00
|
|
|
|
2020-06-08 15:01:55 +02:00
|
|
|
describe('creating and adding children', () => {
|
2020-02-19 21:16:58 +01:00
|
|
|
before(async () => {
|
2020-06-15 17:13:31 +02:00
|
|
|
await testSubjects.click('embeddablePanelExample');
|
2020-02-19 21:16:58 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
it('Can create a new child', async () => {
|
|
|
|
await testSubjects.click('embeddablePanelToggleMenuIcon');
|
2020-03-04 16:27:14 +01:00
|
|
|
await testSubjects.click('embeddablePanelAction-ACTION_ADD_PANEL');
|
2020-06-16 10:42:37 +02:00
|
|
|
|
|
|
|
// this seem like an overkill, but clicking this button which opens context menu was flaky
|
|
|
|
await testSubjects.waitForEnabled('createNew');
|
|
|
|
await retry.waitFor('createNew popover opened', async () => {
|
|
|
|
await testSubjects.click('createNew');
|
|
|
|
return await testSubjects.exists('createNew-TODO_EMBEDDABLE');
|
|
|
|
});
|
2020-02-19 21:16:58 +01:00
|
|
|
await testSubjects.click('createNew-TODO_EMBEDDABLE');
|
2020-06-16 10:42:37 +02:00
|
|
|
|
2020-02-19 21:16:58 +01:00
|
|
|
await testSubjects.setValue('taskInputField', 'new task');
|
|
|
|
await testSubjects.click('createTodoEmbeddable');
|
|
|
|
const tasks = await testSubjects.getVisibleTextAll('todoEmbeddableTask');
|
|
|
|
expect(tasks).to.eql(['Goes out on Wednesdays!', 'new task']);
|
|
|
|
});
|
2020-04-15 17:10:20 +02:00
|
|
|
|
|
|
|
it('Can add a child backed off a saved object', async () => {
|
|
|
|
await testSubjects.click('embeddablePanelToggleMenuIcon');
|
|
|
|
await testSubjects.click('embeddablePanelAction-ACTION_ADD_PANEL');
|
2020-06-16 10:42:37 +02:00
|
|
|
await testSubjects.waitForDeleted('savedObjectFinderLoadingIndicator');
|
2020-04-15 17:10:20 +02:00
|
|
|
await testSubjects.click('savedObjectTitleGarbage');
|
|
|
|
await testSubjects.moveMouseTo('euiFlyoutCloseButton');
|
|
|
|
await flyout.ensureClosed('dashboardAddPanel');
|
|
|
|
const tasks = await testSubjects.getVisibleTextAll('todoEmbeddableTask');
|
|
|
|
expect(tasks).to.eql(['Goes out on Wednesdays!', 'new task', 'Take the garbage out']);
|
|
|
|
});
|
2020-02-19 21:16:58 +01:00
|
|
|
});
|
|
|
|
}
|