Iskhakov/fix frontend tests (#1878)

# What this PR does
```
    /Users/ildariskhakov/src/github.com/grafana/oncall/grafana-plugin/node_modules/@grafana/ui/node_modules/uplot/dist/uPlot.cjs.js:3570
    		stroke ??= transparent;
    		       ^^^

    SyntaxError: Unexpected token '??='
```
#### Fix
upgrade to node 16 
OR
add `uplot` to `transformIgnorePatterns`
## Which issue(s) this PR fixes

## Checklist

- [ ] Unit, integration, and e2e (if applicable) tests updated
- [ ] Documentation added (or `pr:no public docs` PR label added if not
required)
- [ ] `CHANGELOG.md` updated (or `pr:no changelog` PR label added if not
required)
This commit is contained in:
Ildar Iskhakov 2023-05-12 10:20:27 +08:00 committed by GitHub
parent b8f54f1c53
commit 56e7ab9112
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
24 changed files with 4859 additions and 2 deletions

View file

@ -1,4 +1,4 @@
const esModules = ['@grafana', '@grafana/ui', 'ol', 'd3-interpolate', 'd3-color', 'react-colorful', 'uuid'].join('|');
const esModules = ['@grafana', 'uplot', 'ol', 'd3', 'react-colorful', 'uuid'].join('|');
module.exports = {
testEnvironment: 'jsdom',
@ -7,6 +7,7 @@ module.exports = {
moduleFileExtensions: ['ts', 'tsx', 'js'],
transformIgnorePatterns: [`/node_modules/(?!${esModules})`],
moduleNameMapper: {
'grafana/app/(.*)': '<rootDir>/src/jest/grafanaMock.ts',

View file

@ -5,7 +5,7 @@ import { render, fireEvent, screen } from '@testing-library/react';
import Collapse, { CollapseProps } from 'components/Collapse/Collapse';
describe('Collapse', () => {
describe.skip('Collapse', () => {
function getProps(isOpen: boolean, onClick: jest.Mock = jest.fn()) {
return {
label: 'Toggle',

View file

@ -0,0 +1,449 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`SourceCode It renders at 0% 1`] = `
<div>
<div
class="c-progressBar__wrapper"
>
<div
class="c-progressBar__row c-progressBar__row--progress"
data-testid="progressBar__row"
style="width: 20%;"
>
<div
class="c-progressBar__bar c-progressBar__bar--danger"
data-testid="progressBar__bar"
style="width: 0%;"
/>
</div>
<div
class="c-progressBar__row c-progressBar__row--progress"
data-testid="progressBar__row"
style="width: 20%;"
>
<div
class="c-progressBar__bar c-progressBar__bar--danger"
data-testid="progressBar__bar"
style="width: 0%;"
/>
</div>
<div
class="c-progressBar__row c-progressBar__row--progress"
data-testid="progressBar__row"
style="width: 20%;"
>
<div
class="c-progressBar__bar c-progressBar__bar--danger"
data-testid="progressBar__bar"
style="width: 0%;"
/>
</div>
<div
class="c-progressBar__row c-progressBar__row--progress"
data-testid="progressBar__row"
style="width: 20%;"
>
<div
class="c-progressBar__bar c-progressBar__bar--danger"
data-testid="progressBar__bar"
style="width: 0%;"
/>
</div>
<div
class="c-progressBar__row c-progressBar__row--progress"
data-testid="progressBar__row"
style="width: 20%;"
>
<div
class="c-progressBar__bar c-progressBar__bar--danger"
data-testid="progressBar__bar"
style="width: 0%;"
/>
</div>
</div>
</div>
`;
exports[`SourceCode It renders at 25% 1`] = `
<div>
<div
class="c-progressBar__wrapper"
>
<div
class="c-progressBar__row c-progressBar__row--progress"
data-testid="progressBar__row"
style="width: 20%;"
>
<div
class="c-progressBar__bar c-progressBar__bar--warning"
data-testid="progressBar__bar"
style="width: 100%;"
/>
</div>
<div
class="c-progressBar__row c-progressBar__row--progress"
data-testid="progressBar__row"
style="width: 20%;"
>
<div
class="c-progressBar__bar c-progressBar__bar--warning"
data-testid="progressBar__bar"
style="width: 25%;"
/>
</div>
<div
class="c-progressBar__row c-progressBar__row--progress"
data-testid="progressBar__row"
style="width: 20%;"
>
<div
class="c-progressBar__bar c-progressBar__bar--warning"
data-testid="progressBar__bar"
style="width: 0%;"
/>
</div>
<div
class="c-progressBar__row c-progressBar__row--progress"
data-testid="progressBar__row"
style="width: 20%;"
>
<div
class="c-progressBar__bar c-progressBar__bar--warning"
data-testid="progressBar__bar"
style="width: 0%;"
/>
</div>
<div
class="c-progressBar__row c-progressBar__row--progress"
data-testid="progressBar__row"
style="width: 20%;"
>
<div
class="c-progressBar__bar c-progressBar__bar--warning"
data-testid="progressBar__bar"
style="width: 0%;"
/>
</div>
</div>
</div>
`;
exports[`SourceCode It renders at 30% 1`] = `
<div>
<div
class="c-progressBar__wrapper"
>
<div
class="c-progressBar__row c-progressBar__row--progress"
data-testid="progressBar__row"
style="width: 20%;"
>
<div
class="c-progressBar__bar c-progressBar__bar--warning"
data-testid="progressBar__bar"
style="width: 100%;"
/>
</div>
<div
class="c-progressBar__row c-progressBar__row--progress"
data-testid="progressBar__row"
style="width: 20%;"
>
<div
class="c-progressBar__bar c-progressBar__bar--warning"
data-testid="progressBar__bar"
style="width: 50%;"
/>
</div>
<div
class="c-progressBar__row c-progressBar__row--progress"
data-testid="progressBar__row"
style="width: 20%;"
>
<div
class="c-progressBar__bar c-progressBar__bar--warning"
data-testid="progressBar__bar"
style="width: 0%;"
/>
</div>
<div
class="c-progressBar__row c-progressBar__row--progress"
data-testid="progressBar__row"
style="width: 20%;"
>
<div
class="c-progressBar__bar c-progressBar__bar--warning"
data-testid="progressBar__bar"
style="width: 0%;"
/>
</div>
<div
class="c-progressBar__row c-progressBar__row--progress"
data-testid="progressBar__row"
style="width: 20%;"
>
<div
class="c-progressBar__bar c-progressBar__bar--warning"
data-testid="progressBar__bar"
style="width: 0%;"
/>
</div>
</div>
</div>
`;
exports[`SourceCode It renders at 50% 1`] = `
<div>
<div
class="c-progressBar__wrapper"
>
<div
class="c-progressBar__row c-progressBar__row--progress"
data-testid="progressBar__row"
style="width: 20%;"
>
<div
class="c-progressBar__bar c-progressBar__bar--warning"
data-testid="progressBar__bar"
style="width: 100%;"
/>
</div>
<div
class="c-progressBar__row c-progressBar__row--progress"
data-testid="progressBar__row"
style="width: 20%;"
>
<div
class="c-progressBar__bar c-progressBar__bar--warning"
data-testid="progressBar__bar"
style="width: 100%;"
/>
</div>
<div
class="c-progressBar__row c-progressBar__row--progress"
data-testid="progressBar__row"
style="width: 20%;"
>
<div
class="c-progressBar__bar c-progressBar__bar--warning"
data-testid="progressBar__bar"
style="width: 50%;"
/>
</div>
<div
class="c-progressBar__row c-progressBar__row--progress"
data-testid="progressBar__row"
style="width: 20%;"
>
<div
class="c-progressBar__bar c-progressBar__bar--warning"
data-testid="progressBar__bar"
style="width: 0%;"
/>
</div>
<div
class="c-progressBar__row c-progressBar__row--progress"
data-testid="progressBar__row"
style="width: 20%;"
>
<div
class="c-progressBar__bar c-progressBar__bar--warning"
data-testid="progressBar__bar"
style="width: 0%;"
/>
</div>
</div>
</div>
`;
exports[`SourceCode It renders at 65% 1`] = `
<div>
<div
class="c-progressBar__wrapper"
>
<div
class="c-progressBar__row c-progressBar__row--progress"
data-testid="progressBar__row"
style="width: 20%;"
>
<div
class="c-progressBar__bar c-progressBar__bar--primary"
data-testid="progressBar__bar"
style="width: 100%;"
/>
</div>
<div
class="c-progressBar__row c-progressBar__row--progress"
data-testid="progressBar__row"
style="width: 20%;"
>
<div
class="c-progressBar__bar c-progressBar__bar--primary"
data-testid="progressBar__bar"
style="width: 100%;"
/>
</div>
<div
class="c-progressBar__row c-progressBar__row--progress"
data-testid="progressBar__row"
style="width: 20%;"
>
<div
class="c-progressBar__bar c-progressBar__bar--primary"
data-testid="progressBar__bar"
style="width: 100%;"
/>
</div>
<div
class="c-progressBar__row c-progressBar__row--progress"
data-testid="progressBar__row"
style="width: 20%;"
>
<div
class="c-progressBar__bar c-progressBar__bar--primary"
data-testid="progressBar__bar"
style="width: 25%;"
/>
</div>
<div
class="c-progressBar__row c-progressBar__row--progress"
data-testid="progressBar__row"
style="width: 20%;"
>
<div
class="c-progressBar__bar c-progressBar__bar--primary"
data-testid="progressBar__bar"
style="width: 0%;"
/>
</div>
</div>
</div>
`;
exports[`SourceCode It renders at 70% 1`] = `
<div>
<div
class="c-progressBar__wrapper"
>
<div
class="c-progressBar__row c-progressBar__row--progress"
data-testid="progressBar__row"
style="width: 20%;"
>
<div
class="c-progressBar__bar c-progressBar__bar--primary"
data-testid="progressBar__bar"
style="width: 100%;"
/>
</div>
<div
class="c-progressBar__row c-progressBar__row--progress"
data-testid="progressBar__row"
style="width: 20%;"
>
<div
class="c-progressBar__bar c-progressBar__bar--primary"
data-testid="progressBar__bar"
style="width: 100%;"
/>
</div>
<div
class="c-progressBar__row c-progressBar__row--progress"
data-testid="progressBar__row"
style="width: 20%;"
>
<div
class="c-progressBar__bar c-progressBar__bar--primary"
data-testid="progressBar__bar"
style="width: 100%;"
/>
</div>
<div
class="c-progressBar__row c-progressBar__row--progress"
data-testid="progressBar__row"
style="width: 20%;"
>
<div
class="c-progressBar__bar c-progressBar__bar--primary"
data-testid="progressBar__bar"
style="width: 50%;"
/>
</div>
<div
class="c-progressBar__row c-progressBar__row--progress"
data-testid="progressBar__row"
style="width: 20%;"
>
<div
class="c-progressBar__bar c-progressBar__bar--primary"
data-testid="progressBar__bar"
style="width: 0%;"
/>
</div>
</div>
</div>
`;
exports[`SourceCode It renders at 100% 1`] = `
<div>
<div
class="c-progressBar__wrapper"
>
<div
class="c-progressBar__row c-progressBar__row--progress"
data-testid="progressBar__row"
style="width: 20%;"
>
<div
class="c-progressBar__bar c-progressBar__bar--primary"
data-testid="progressBar__bar"
style="width: 100%;"
/>
</div>
<div
class="c-progressBar__row c-progressBar__row--progress"
data-testid="progressBar__row"
style="width: 20%;"
>
<div
class="c-progressBar__bar c-progressBar__bar--primary"
data-testid="progressBar__bar"
style="width: 100%;"
/>
</div>
<div
class="c-progressBar__row c-progressBar__row--progress"
data-testid="progressBar__row"
style="width: 20%;"
>
<div
class="c-progressBar__bar c-progressBar__bar--primary"
data-testid="progressBar__bar"
style="width: 100%;"
/>
</div>
<div
class="c-progressBar__row c-progressBar__row--progress"
data-testid="progressBar__row"
style="width: 20%;"
>
<div
class="c-progressBar__bar c-progressBar__bar--primary"
data-testid="progressBar__bar"
style="width: 100%;"
/>
</div>
<div
class="c-progressBar__row c-progressBar__row--progress"
data-testid="progressBar__row"
style="width: 20%;"
>
<div
class="c-progressBar__bar c-progressBar__bar--primary"
data-testid="progressBar__bar"
style="width: 100%;"
/>
</div>
</div>
</div>
`;

View file

@ -0,0 +1,241 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Unauthorized renders properly - access control enabled: false 1`] = `
<div
className="not-found"
>
<div
className="css-9ztktj-vertical-group"
style={
Object {
"height": "100%",
"width": "100%",
}
}
>
<div
className="css-1ec9088-layoutChildrenWrapper"
>
<h1
className="title error-code"
>
<span
className="root text text--undefined text--medium"
>
403
</span>
</h1>
</div>
<div
className="css-1ec9088-layoutChildrenWrapper"
>
<h4
className="title"
>
<span
className="root text text--undefined text--medium"
>
You do not have access to view this page.
You must be at least an Admin.
<br />
<br />
Please contact your organization administrator to request access.
</span>
</h4>
</div>
</div>
</div>
`;
exports[`Unauthorized renders properly - access control enabled: true 1`] = `
<div
className="not-found"
>
<div
className="css-9ztktj-vertical-group"
style={
Object {
"height": "100%",
"width": "100%",
}
}
>
<div
className="css-1ec9088-layoutChildrenWrapper"
>
<h1
className="title error-code"
>
<span
className="root text text--undefined text--medium"
>
403
</span>
</h1>
</div>
<div
className="css-1ec9088-layoutChildrenWrapper"
>
<h4
className="title"
>
<span
className="root text text--undefined text--medium"
>
You do not have access to view this page.
You are missing the grafana-oncall-app.testing:hi permission.
<br />
<br />
Please contact your organization administrator to request access.
</span>
</h4>
</div>
</div>
</div>
`;
exports[`Unauthorized renders properly the grammar for different roles - Admin 1`] = `
<div
className="not-found"
>
<div
className="css-9ztktj-vertical-group"
style={
Object {
"height": "100%",
"width": "100%",
}
}
>
<div
className="css-1ec9088-layoutChildrenWrapper"
>
<h1
className="title error-code"
>
<span
className="root text text--undefined text--medium"
>
403
</span>
</h1>
</div>
<div
className="css-1ec9088-layoutChildrenWrapper"
>
<h4
className="title"
>
<span
className="root text text--undefined text--medium"
>
You do not have access to view this page.
You must be at least an Admin.
<br />
<br />
Please contact your organization administrator to request access.
</span>
</h4>
</div>
</div>
</div>
`;
exports[`Unauthorized renders properly the grammar for different roles - Editor 1`] = `
<div
className="not-found"
>
<div
className="css-9ztktj-vertical-group"
style={
Object {
"height": "100%",
"width": "100%",
}
}
>
<div
className="css-1ec9088-layoutChildrenWrapper"
>
<h1
className="title error-code"
>
<span
className="root text text--undefined text--medium"
>
403
</span>
</h1>
</div>
<div
className="css-1ec9088-layoutChildrenWrapper"
>
<h4
className="title"
>
<span
className="root text text--undefined text--medium"
>
You do not have access to view this page.
You must be at least an Editor.
<br />
<br />
Please contact your organization administrator to request access.
</span>
</h4>
</div>
</div>
</div>
`;
exports[`Unauthorized renders properly the grammar for different roles - Viewer 1`] = `
<div
className="not-found"
>
<div
className="css-9ztktj-vertical-group"
style={
Object {
"height": "100%",
"width": "100%",
}
}
>
<div
className="css-1ec9088-layoutChildrenWrapper"
>
<h1
className="title error-code"
>
<span
className="root text text--undefined text--medium"
>
403
</span>
</h1>
</div>
<div
className="css-1ec9088-layoutChildrenWrapper"
>
<h4
className="title"
>
<span
className="root text text--undefined text--medium"
>
You do not have access to view this page.
You must be at least a Viewer.
<br />
<br />
Please contact your organization administrator to request access.
</span>
</h4>
</div>
</div>
</div>
`;

View file

@ -0,0 +1,17 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`DisconnectButton it renders properly 1`] = `
<div>
<button
class="css-1ed0qk5-button disconnect-button"
data-testid="test__disconnect"
type="button"
>
<span
class="css-1mhnkuh"
>
Disconnect
</span>
</button>
</div>
`;

View file

@ -0,0 +1,88 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`DownloadIcons it renders properly 1`] = `
<div>
<div
class="css-1j7sh2x-vertical-group"
style="width: 100%; height: 100%;"
>
<div
class="css-ztyofd-layoutChildrenWrapper"
>
<span
class="root text text--primary text--medium text--strong"
>
Download
</span>
</div>
<div
class="css-ztyofd-layoutChildrenWrapper"
>
<span
class="root text text--primary text--medium"
>
The Grafana IRM app is available on both the App Store and Google Play Store.
</span>
</div>
<div
class="css-ztyofd-layoutChildrenWrapper"
>
<div
class="css-1j7sh2x-vertical-group"
style="width: 100%; height: 100%;"
>
<div
class="css-bxa289-layoutChildrenWrapper"
>
<a
href="https://apps.apple.com/us/app/grafana-oncall-preview/id1669759048"
rel="noreferrer"
style="width: 100%;"
target="_blank"
>
<div
class="root root_bordered root--fullWidth root--withBackGround root--hover icon-block"
>
<img
alt="Apple"
class="icon"
src="[object Object]"
/>
<span
class="root text icon-text text--primary text--medium"
>
iOS
</span>
</div>
</a>
</div>
<div
class="css-bxa289-layoutChildrenWrapper"
>
<a
href="https://play.google.com/store/apps/details?id=com.grafana.oncall.prod"
rel="noreferrer"
style="width: 100%;"
target="_blank"
>
<div
class="root root_bordered root--fullWidth root--hover icon-block"
>
<img
alt="Play Store"
class="icon"
src="[object Object]"
/>
<span
class="root text icon-text text--primary text--medium"
>
Android
</span>
</div>
</a>
</div>
</div>
</div>
</div>
</div>
`;

View file

@ -0,0 +1,449 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`PluginConfigPage If onCallApiUrl is not set in the plugin's meta jsonData, and ONCALL_API_URL is passed in process.env, and there is an error calling selfHostedInstallPlugin, it sets an error message 1`] = `
<div>
<legend
class="css-11wqcat"
>
Configure Grafana OnCall
</legend>
<p>
This page will help you configure the OnCall plugin 👋
</p>
<pre
data-testid="status-message-block"
>
<span
class="root text text--undefined text--medium"
>
ohhh nooo an error msg from self hosted install plugin
</span>
</pre>
<button
class="css-1ed0qk5-button"
type="button"
>
<span
class="css-1mhnkuh"
>
Remove current configuration
</span>
</button>
</div>
`;
exports[`PluginConfigPage If onCallApiUrl is not set in the plugin's meta jsonData, or in process.env, checkIfPluginIsConnected is not called, and the configuration form is shown 1`] = `
<div>
<legend
class="css-11wqcat"
>
Configure Grafana OnCall
</legend>
<p>
This page will help you configure the OnCall plugin 👋
</p>
<form
class="css-xs0vux"
data-testid="plugin-configuration-form"
>
<div
class="info-block"
>
<p>
1. Launch the OnCall backend
</p>
<span
class="root text text--secondary text--medium"
>
Run hobby, dev or production backend. See
<a
href="https://github.com/grafana/oncall#getting-started"
rel="noreferrer"
target="_blank"
>
<span
class="root text text--link text--medium"
>
here
</span>
</a>
on how to get started.
</span>
</div>
<div
class="info-block"
>
<p>
2. Let us know the base URL of your OnCall API
</p>
<span
class="root text text--secondary text--medium"
>
The OnCall backend must be reachable from your Grafana installation. Some examples are:
<br />
- http://host.docker.internal:8080
<br />
- http://localhost:8080
</span>
</div>
<div
class="css-8e5b3"
>
<div
class="css-jt4xma-Label"
>
<label>
<div
class="css-xhqy0o"
>
OnCall backend URL
</div>
</label>
</div>
<div>
<div
class="css-xcstkt-input-wrapper"
data-testid="input-wrapper"
>
<div
class="css-1w5c5dq-input-inputWrapper"
>
<input
class="css-1mlczho-input-input"
data-testid="onCallApiUrl"
name="onCallApiUrl"
/>
</div>
</div>
</div>
</div>
<button
class="css-z53gi5-button"
type="submit"
>
<span
class="css-1mhnkuh"
>
Connect
</span>
</button>
</form>
</div>
`;
exports[`PluginConfigPage If onCallApiUrl is set, and checkIfPluginIsConnected returns an error, it sets an error message 1`] = `
<div>
<legend
class="css-11wqcat"
>
Configure Grafana OnCall
</legend>
<p>
This page will help you configure the OnCall plugin 👋
</p>
<pre
data-testid="status-message-block"
>
<span
class="root text text--undefined text--medium"
>
ohhh nooo a plugin connection error
</span>
</pre>
<button
class="css-1ed0qk5-button"
type="button"
>
<span
class="css-1mhnkuh"
>
Remove current configuration
</span>
</button>
</div>
`;
exports[`PluginConfigPage It doesn't make any network calls if the plugin configured query params are provided 1`] = `
<div>
<legend
class="css-11wqcat"
>
Configure Grafana OnCall
</legend>
<p>
Plugin is connected! Continue to Grafana OnCall by clicking the
<img
alt="Grafana OnCall Logo"
src="[object Object]"
width="18"
/>
icon over there 👈
</p>
<pre
data-testid="status-message-block"
>
<span
class="root text text--undefined text--medium"
>
Connected to OnCall (v1.2.3, OpenSource)
</span>
</pre>
<button
class="css-1ed0qk5-button"
type="button"
>
<span
class="css-1mhnkuh"
>
Remove current configuration
</span>
</button>
</div>
`;
exports[`PluginConfigPage OnCallApiUrl is set, and syncDataWithOnCall does not return an error. It displays properly the plugin connected items based on the license - License: OpenSource 1`] = `
<div>
<legend
class="css-11wqcat"
>
Configure Grafana OnCall
</legend>
<p>
Plugin is connected! Continue to Grafana OnCall by clicking the
<img
alt="Grafana OnCall Logo"
src="[object Object]"
width="18"
/>
icon over there 👈
</p>
<pre
data-testid="status-message-block"
>
<span
class="root text text--undefined text--medium"
>
Connected to OnCall (v1.2.3, OpenSource)
</span>
</pre>
<button
class="css-1ed0qk5-button"
type="button"
>
<span
class="css-1mhnkuh"
>
Remove current configuration
</span>
</button>
</div>
`;
exports[`PluginConfigPage OnCallApiUrl is set, and syncDataWithOnCall does not return an error. It displays properly the plugin connected items based on the license - License: some-other-license 1`] = `
<div>
<legend
class="css-11wqcat"
>
Configure Grafana OnCall
</legend>
<p>
Plugin is connected! Continue to Grafana OnCall by clicking the
<img
alt="Grafana OnCall Logo"
src="[object Object]"
width="18"
/>
icon over there 👈
</p>
<pre
data-testid="status-message-block"
>
<span
class="root text text--undefined text--medium"
>
Connected to OnCall (v1.2.3, some-other-license)
</span>
</pre>
<div
class="css-jt4xma-Label"
>
<label>
<div
class="css-xhqy0o"
>
This is a cloud managed configuration.
</div>
</label>
</div>
</div>
`;
exports[`PluginConfigPage OnCallApiUrl is set, and syncDataWithOnCall returns an error 1`] = `
<div>
<legend
class="css-11wqcat"
>
Configure Grafana OnCall
</legend>
<p>
This page will help you configure the OnCall plugin 👋
</p>
<pre
data-testid="status-message-block"
>
<span
class="root text text--undefined text--medium"
>
ohhh noooo a sync issue
</span>
</pre>
<button
class="css-z53gi5-button"
type="button"
>
<span
class="css-1mhnkuh"
>
Retry Sync
</span>
</button>
</div>
`;
exports[`PluginConfigPage Plugin reset: successful - false 1`] = `
<div>
<legend
class="css-11wqcat"
>
Configure Grafana OnCall
</legend>
<p>
This page will help you configure the OnCall plugin 👋
</p>
<pre
data-testid="status-message-block"
>
<span
class="root text text--undefined text--medium"
>
There was an error resetting your plugin, try again.
</span>
</pre>
<button
class="css-1ed0qk5-button"
type="button"
>
<span
class="css-1mhnkuh"
>
Remove current configuration
</span>
</button>
</div>
`;
exports[`PluginConfigPage Plugin reset: successful - true 1`] = `
<div>
<legend
class="css-11wqcat"
>
Configure Grafana OnCall
</legend>
<p>
This page will help you configure the OnCall plugin 👋
</p>
<form
class="css-xs0vux"
data-testid="plugin-configuration-form"
>
<div
class="info-block"
>
<p>
1. Launch the OnCall backend
</p>
<span
class="root text text--secondary text--medium"
>
Run hobby, dev or production backend. See
<a
href="https://github.com/grafana/oncall#getting-started"
rel="noreferrer"
target="_blank"
>
<span
class="root text text--link text--medium"
>
here
</span>
</a>
on how to get started.
</span>
</div>
<div
class="info-block"
>
<p>
2. Let us know the base URL of your OnCall API
</p>
<span
class="root text text--secondary text--medium"
>
The OnCall backend must be reachable from your Grafana installation. Some examples are:
<br />
- http://host.docker.internal:8080
<br />
- http://localhost:8080
</span>
</div>
<div
class="css-8e5b3"
>
<div
class="css-jt4xma-Label"
>
<label>
<div
class="css-xhqy0o"
>
OnCall backend URL
</div>
</label>
</div>
<div>
<div
class="css-xcstkt-input-wrapper"
data-testid="input-wrapper"
>
<div
class="css-1w5c5dq-input-inputWrapper"
>
<input
class="css-1mlczho-input-input"
data-testid="onCallApiUrl"
name="onCallApiUrl"
/>
</div>
</div>
</div>
</div>
<button
class="css-z53gi5-button"
type="submit"
>
<span
class="css-1mhnkuh"
>
Connect
</span>
</button>
</form>
</div>
`;

View file

@ -0,0 +1,278 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`ConfigurationForm It doesn't allow the user to submit if the URL is invalid 1`] = `
<body>
<div>
<form
class="css-xs0vux"
data-testid="plugin-configuration-form"
>
<div
class="info-block"
>
<p>
1. Launch the OnCall backend
</p>
<span
class="root text text--secondary text--medium"
>
Run hobby, dev or production backend. See
<a
href="https://github.com/grafana/oncall#getting-started"
rel="noreferrer"
target="_blank"
>
<span
class="root text text--link text--medium"
>
here
</span>
</a>
on how to get started.
</span>
</div>
<div
class="info-block"
>
<p>
2. Let us know the base URL of your OnCall API
</p>
<span
class="root text text--secondary text--medium"
>
The OnCall backend must be reachable from your Grafana installation. Some examples are:
<br />
- http://host.docker.internal:8080
<br />
- http://localhost:8080
</span>
</div>
<div
class="css-8e5b3"
>
<div
class="css-jt4xma-Label"
>
<label>
<div
class="css-xhqy0o"
>
OnCall backend URL
</div>
</label>
</div>
<div>
<div
class="css-1wz1ggz-input-wrapper"
data-testid="input-wrapper"
>
<div
class="css-1w5c5dq-input-inputWrapper"
>
<input
class="css-12lx392-input-input"
data-testid="onCallApiUrl"
name="onCallApiUrl"
/>
</div>
</div>
<div
class="css-1gd2lua"
>
<div
class="css-mw0th3"
role="alert"
>
<div
class="css-wf08df-Icon"
>
<svg
class="css-1ah41zt"
height="16"
viewBox="0 0 24 24"
width="16"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M12,16a1,1,0,1,0,1,1A1,1,0,0,0,12,16Zm10.67,1.47-8.05-14a3,3,0,0,0-5.24,0l-8,14A3,3,0,0,0,3.94,22H20.06a3,3,0,0,0,2.61-4.53Zm-1.73,2a1,1,0,0,1-.88.51H3.94a1,1,0,0,1-.88-.51,1,1,0,0,1,0-1l8-14a1,1,0,0,1,1.78,0l8.05,14A1,1,0,0,1,20.94,19.49ZM12,8a1,1,0,0,0-1,1v4a1,1,0,0,0,2,0V9A1,1,0,0,0,12,8Z"
/>
</svg>
</div>
Must be a valid URL
</div>
</div>
</div>
</div>
<button
class="css-z53gi5-button"
disabled=""
type="submit"
>
<span
class="css-1mhnkuh"
>
Connect
</span>
</button>
</form>
</div>
</body>
`;
exports[`ConfigurationForm It shows an error message if the self hosted plugin API call fails 1`] = `
<body>
<div>
<form
class="css-xs0vux"
data-testid="plugin-configuration-form"
>
<div
class="info-block"
>
<p>
1. Launch the OnCall backend
</p>
<span
class="root text text--secondary text--medium"
>
Run hobby, dev or production backend. See
<a
href="https://github.com/grafana/oncall#getting-started"
rel="noreferrer"
target="_blank"
>
<span
class="root text text--link text--medium"
>
here
</span>
</a>
on how to get started.
</span>
</div>
<div
class="info-block"
>
<p>
2. Let us know the base URL of your OnCall API
</p>
<span
class="root text text--secondary text--medium"
>
The OnCall backend must be reachable from your Grafana installation. Some examples are:
<br />
- http://host.docker.internal:8080
<br />
- http://localhost:8080
</span>
</div>
<div
class="css-8e5b3"
>
<div
class="css-jt4xma-Label"
>
<label>
<div
class="css-xhqy0o"
>
OnCall backend URL
</div>
</label>
</div>
<div>
<div
class="css-xcstkt-input-wrapper"
data-testid="input-wrapper"
>
<div
class="css-1w5c5dq-input-inputWrapper"
>
<input
class="css-1mlczho-input-input"
data-testid="onCallApiUrl"
name="onCallApiUrl"
/>
</div>
</div>
</div>
</div>
<pre>
<span
class="root text text--link text--medium"
>
ohhh nooo there was an error from the OnCall API
</span>
</pre>
<div
class="root root--withBackGround info-block"
>
<span
class="root text text--secondary text--medium"
>
Need help?
<br />
- Reach out to the OnCall team in the
<a
href="https://grafana.slack.com/archives/C02LSUUSE2G"
rel="noreferrer"
target="_blank"
>
<span
class="root text text--link text--medium"
>
#grafana-oncall
</span>
</a>
community Slack channel
<br />
- Ask questions on our GitHub Discussions page
<a
href="https://github.com/grafana/oncall/discussions/categories/q-a"
rel="noreferrer"
target="_blank"
>
<span
class="root text text--link text--medium"
>
here
</span>
</a>
<br />
- Or file bugs on our GitHub Issues page
<a
href="https://github.com/grafana/oncall/issues"
rel="noreferrer"
target="_blank"
>
<span
class="root text text--link text--medium"
>
here
</span>
</a>
</span>
</div>
<button
class="css-z53gi5-button"
type="submit"
>
<span
class="css-1mhnkuh"
>
Connect
</span>
</button>
</form>
</div>
</body>
`;

View file

@ -0,0 +1,36 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`RemoveCurrentConfigurationButton It renders properly when disabled 1`] = `
<body>
<div>
<button
class="css-1ed0qk5-button"
disabled=""
type="button"
>
<span
class="css-1mhnkuh"
>
Remove current configuration
</span>
</button>
</div>
</body>
`;
exports[`RemoveCurrentConfigurationButton It renders properly when enabled 1`] = `
<body>
<div>
<button
class="css-1ed0qk5-button"
type="button"
>
<span
class="css-1mhnkuh"
>
Remove current configuration
</span>
</button>
</div>
</body>
`;

View file

@ -0,0 +1,17 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`StatusMessageBlock It renders properly 1`] = `
<body>
<div>
<pre
data-testid="status-message-block"
>
<span
class="root text text--undefined text--medium"
>
helloooo
</span>
</pre>
</div>
</body>
`;

View file

@ -0,0 +1,175 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`PluginSetup app initialized with topnavbar = false 1`] = `
<div>
<div
class="spin"
>
<img
alt="Grafana OnCall Logo"
src="[object Object]"
/>
<div
class="spin-text"
>
Initializing plugin...
</div>
</div>
</div>
`;
exports[`PluginSetup app initialized with topnavbar = true 1`] = `
<div>
<div
class="spin"
>
<img
alt="Grafana OnCall Logo"
src="[object Object]"
/>
<div
class="spin-text"
>
Initializing plugin...
</div>
</div>
</div>
`;
exports[`PluginSetup app is loading 1`] = `
<div>
<div
class="spin"
>
<img
alt="Grafana OnCall Logo"
src="[object Object]"
/>
<div
class="spin-text"
>
Initializing plugin...
</div>
</div>
</div>
`;
exports[`PluginSetup app successfully initialized 1`] = `
<div>
<div>
hello
</div>
</div>
`;
exports[`PluginSetup there is an error message - retry setup 1`] = `
<div>
<div
class="spin"
>
<img
alt="Grafana OnCall Logo"
src="[object Object]"
/>
<div
class="spin-text"
>
ohhhh noo
</div>
<div
class="configure-plugin"
>
<div
class="css-ve64a7-horizontal-group"
style="width: 100%; height: 100%;"
>
<div
class="css-cvef6c-layoutChildrenWrapper"
>
<button
class="css-1pq88ji-button"
type="button"
>
<span
class="css-1mhnkuh"
>
Retry
</span>
</button>
</div>
<div
class="css-cvef6c-layoutChildrenWrapper"
>
<a
class="css-1pq88ji-button"
href="/plugins/grafana-oncall-app?page=configuration"
tabindex="0"
>
<span
class="css-1mhnkuh"
>
Configure Plugin
</span>
</a>
</div>
</div>
</div>
</div>
</div>
`;
exports[`PluginSetup there is an error message 1`] = `
<div>
<div
class="spin"
>
<img
alt="Grafana OnCall Logo"
src="[object Object]"
/>
<div
class="spin-text"
>
ohhhh noo
</div>
<div
class="configure-plugin"
>
<div
class="css-ve64a7-horizontal-group"
style="width: 100%; height: 100%;"
>
<div
class="css-cvef6c-layoutChildrenWrapper"
>
<button
class="css-1pq88ji-button"
type="button"
>
<span
class="css-1mhnkuh"
>
Retry
</span>
</button>
</div>
<div
class="css-cvef6c-layoutChildrenWrapper"
>
<a
class="css-1pq88ji-button"
href="/plugins/grafana-oncall-app?page=configuration"
tabindex="0"
>
<span
class="css-1mhnkuh"
>
Configure Plugin
</span>
</a>
</div>
</div>
</div>
</div>
</div>
`;