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
This commit is contained in:
Esteban Beltran
2023-10-12 09:43:59 +02:00
committed by GitHub
parent fbbf9b1a8f
commit 665dc1fa44
6 changed files with 165 additions and 2 deletions
@@ -0,0 +1 @@
<?xml version="1.0" encoding="UTF-8"?><svg xmlns="http://www.w3.org/2000/svg" width="1" height="1"/>

After

Width:  |  Height:  |  Size: 100 B

@@ -0,0 +1,41 @@
/*
* 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 };
});
@@ -0,0 +1,35 @@
{
"$schema": "https://raw.githubusercontent.com/grafana/grafana/master/docs/sources/developers/plugins/plugin.schema.json",
"type": "app",
"name": "Sandbox app test plugin",
"id": "sandbox-app-test",
"info": {
"keywords": ["app", "sandbox"],
"description": "",
"author": {
"name": "Grafana"
},
"logos": {
"small": "img/logo.svg",
"large": "img/logo.svg"
},
"links": [],
"screenshots": [],
"version": "1.0.0",
"updated": "2023-06-27"
},
"includes": [
{
"type": "page",
"icon": "cog",
"name": "Sandbox App Page",
"path": "/plugins/sandbox-app-test",
"role": "Admin",
"addToNav": true
}
],
"dependencies": {
"grafanaDependency": ">=10.0",
"plugins": []
}
}
@@ -0,0 +1 @@
<?xml version="1.0" encoding="UTF-8"?><svg xmlns="http://www.w3.org/2000/svg" width="1" height="1"/>

After

Width:  |  Height:  |  Size: 100 B