+ Triggers that emit context
+
+ The trigger above did not emit any context, but a trigger can, and if it does, it will be
+ passed to the action when it is executed. This is helpful for dynamic data that is only
+ known at the time the trigger is emitted. Lets explore a use case where the is dynamic. The
+ following data grid emits a few triggers, each with a some actions attached.
+
+
+ {},
+ }}
+ />
+
+ );
+}
diff --git a/examples/ui_actions_explorer/tsconfig.json b/examples/ui_actions_explorer/tsconfig.json
new file mode 100644
index 0000000000000..199fbe1fcfa26
--- /dev/null
+++ b/examples/ui_actions_explorer/tsconfig.json
@@ -0,0 +1,14 @@
+{
+ "extends": "../../tsconfig.json",
+ "compilerOptions": {
+ "outDir": "./target",
+ "skipLibCheck": true
+ },
+ "include": [
+ "index.ts",
+ "public/**/*.ts",
+ "public/**/*.tsx",
+ "../../typings/**/*",
+ ],
+ "exclude": []
+}
diff --git a/test/examples/config.js b/test/examples/config.js
index f747a7fab5bb9..d9411be267930 100644
--- a/test/examples/config.js
+++ b/test/examples/config.js
@@ -24,7 +24,11 @@ export default async function({ readConfigFile }) {
const functionalConfig = await readConfigFile(require.resolve('../functional/config'));
return {
- testFiles: [require.resolve('./search'), require.resolve('./embeddables')],
+ testFiles: [
+ require.resolve('./search'),
+ require.resolve('./embeddables'),
+ require.resolve('./ui_actions'),
+ ],
services: {
...functionalConfig.get('services'),
...services,
diff --git a/test/examples/ui_actions/index.ts b/test/examples/ui_actions/index.ts
new file mode 100644
index 0000000000000..d69e6a876cfa2
--- /dev/null
+++ b/test/examples/ui_actions/index.ts
@@ -0,0 +1,41 @@
+/*
+ * Licensed to Elasticsearch B.V. under one or more contributor
+ * license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright
+ * ownership. Elasticsearch B.V. licenses this file to you under
+ * the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import { PluginFunctionalProviderContext } from 'test/plugin_functional/services';
+
+// eslint-disable-next-line import/no-default-export
+export default function({
+ getService,
+ getPageObjects,
+ loadTestFile,
+}: PluginFunctionalProviderContext) {
+ const browser = getService('browser');
+ const appsMenu = getService('appsMenu');
+ const PageObjects = getPageObjects(['common', 'header']);
+
+ describe('ui actions explorer', function() {
+ before(async () => {
+ await browser.setWindowSize(1300, 900);
+ await PageObjects.common.navigateToApp('settings');
+ await appsMenu.clickLink('Ui Actions Explorer');
+ });
+
+ loadTestFile(require.resolve('./ui_actions'));
+ });
+}
diff --git a/test/examples/ui_actions/ui_actions.ts b/test/examples/ui_actions/ui_actions.ts
new file mode 100644
index 0000000000000..f047bfa333d88
--- /dev/null
+++ b/test/examples/ui_actions/ui_actions.ts
@@ -0,0 +1,53 @@
+/*
+ * Licensed to Elasticsearch B.V. under one or more contributor
+ * license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright
+ * ownership. Elasticsearch B.V. licenses this file to you under
+ * the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import expect from '@kbn/expect';
+
+import { PluginFunctionalProviderContext } from 'test/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('', () => {
+ it('hello world action', async () => {
+ await testSubjects.click('emitHelloWorldTrigger');
+ await retry.try(async () => {
+ const text = await testSubjects.getVisibleText('helloWorldActionText');
+ expect(text).to.be('Hello world!');
+ });
+
+ await testSubjects.click('closeModal');
+ });
+
+ it('dynamic hello world action', async () => {
+ await testSubjects.click('addDynamicAction');
+ await retry.try(async () => {
+ await testSubjects.click('emitHelloWorldTrigger');
+ await testSubjects.click('embeddablePanelAction-HELLO_WORLD_ACTION_TYPE-Waldo');
+ });
+ await retry.try(async () => {
+ const text = await testSubjects.getVisibleText('dynamicHelloWorldActionText');
+ expect(text).to.be('Hello Waldo');
+ });
+ await testSubjects.click('closeModal');
+ });
+ });
+}