Skip to content

Commit e13501e

Browse files
authored
Add E2E Cypress testing (#53)
1 parent fe920a8 commit e13501e

File tree

4 files changed

+73
-0
lines changed

4 files changed

+73
-0
lines changed

.github/workflows/e2e.yml

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: E2E
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
11+
jobs:
12+
tests:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- uses: actions/checkout@v3
17+
18+
- name: Setup Node.js environment
19+
uses: actions/setup-node@v3
20+
with:
21+
node-version: '18'
22+
cache: 'npm'
23+
24+
- name: Install dependencies
25+
run: npm install
26+
27+
- name: Build
28+
run: npm run build
29+
30+
- name: Start Grafana
31+
run: docker-compose up -d
32+
33+
- name: Run e2e tests
34+
run: npm run e2e
35+
36+
- name: Stop Grafana
37+
run: docker-compose down
38+
39+
- uses: actions/upload-artifact@v3
40+
if: failure()
41+
with:
42+
path: |
43+
cypress/videos
44+
cypress/screenshots/actual

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
- Migrate to Plugin Tools 1.5.2 (#51)
99
- Update to Node 18 and npm (#51)
1010
- Update to Grafana 10.0.0 (#51)
11+
- Add E2E Cypress testing (#52)
1112

1213
## 2.4.0 (2023-04-08)
1314

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import { e2e } from '@grafana/e2e';
2+
3+
/**
4+
* Dashboard
5+
*/
6+
const json = require('../../provisioning/dashboards/panels.json');
7+
const testedPanel = json.panels[0];
8+
9+
/**
10+
* Panel
11+
*/
12+
describe('Viewing a panel with a Data Source', () => {
13+
beforeEach(() => {
14+
e2e.flows.openDashboard({
15+
uid: json.uid,
16+
});
17+
});
18+
19+
it('Should display a Dynamic Text with Data Source', () => {
20+
const currentPanel = e2e.components.Panels.Panel.title(testedPanel.title);
21+
currentPanel.should('be.visible');
22+
});
23+
});

cypress/tsconfig.json

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"compilerOptions": {
3+
"types": ["cypress"]
4+
}
5+
}

0 commit comments

Comments
 (0)