kibana/test/examples/embeddables/todo_embeddable.ts
Nathan Reese d3d0cdba73
[Presentation] Migrate all usages of EuiPage*_Deprecated (#161496)
closes https://github.com/elastic/kibana/issues/161428

PR also updates examples title. Instead of naming the embeddable used,
the title now reflects what the example demonstrates.
* "Hello world embeddable" -> "Render embeddable"
* "Todo embeddable" -> "Update embeddable state"
* "List container embeddable" -> "Groups of embeddables"
* "Dynamically adding children to a container" -> "Context menu"

There is a lot more that could be done to enhance these examples, but I
did not want to get more side tracked then I already did.

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2023-07-10 12:28:30 -06:00

43 lines
1.6 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 expect from '@kbn/expect';
import { PluginFunctionalProviderContext } from '../../plugin_functional/services';
// eslint-disable-next-line import/no-default-export
export default function ({ getService }: PluginFunctionalProviderContext) {
const testSubjects = getService('testSubjects');
const retry = getService('retry');
describe('todo embeddable', () => {
before(async () => {
await testSubjects.click('todoEmbeddableSection');
});
it('todo embeddable renders', async () => {
await retry.try(async () => {
const title = await testSubjects.getVisibleText('todoEmbeddableTitle');
expect(title).to.be('Trash');
const task = await testSubjects.getVisibleText('todoEmbeddableTask');
expect(task).to.be('Take out the trash');
});
});
it('todo embeddable updates', async () => {
await testSubjects.setValue('taskTodo', 'read a book');
await testSubjects.setValue('titleTodo', 'Learn');
await retry.try(async () => {
const title = await testSubjects.getVisibleText('todoEmbeddableTitle');
expect(title).to.be('Learn');
const task = await testSubjects.getVisibleText('todoEmbeddableTask');
expect(task).to.be('read a book');
});
});
});
}