grafana/e2e/custom-plugins/frontend-sandbox-app-test/module.js
Esteban Beltran 665dc1fa44
Sandbox: e2e tests for apps running inside the frontend sandbox (#76357)
* Sandbox: Add tests for apps inside the sandbox

* Force type to prevent flawky test
2023-10-12 09:43:59 +02:00

42 lines
1009 B
JavaScript

/*
* This is a dummy plugin to test the frontend sandbox
* It is not meant to be used in any other way
* This file doesn't require any compilation
*/
define(['react', '@grafana/data', 'react-router-dom'], function (React, grafanaData, ReactRouterDom) {
const { AppPlugin } = grafanaData;
const { Switch, Route } = ReactRouterDom;
function PageOne() {
return React.createElement(
'div',
{
'data-testid': 'sandbox-app-test-page-one',
},
'This is a page one'
);
}
function App() {
return React.createElement(Switch, null, React.createElement(Route, { component: PageOne }));
}
function AppConfig() {
return React.createElement(
'div',
{
'data-testid': 'sandbox-app-test-config-page',
},
'This is a config page'
);
}
const plugin = new AppPlugin().setRootPage(App).addConfigPage({
title: 'Configuration',
icon: 'cog',
body: AppConfig,
id: 'configuration',
});
return { plugin };
});