Skip to content

Commit

Permalink
Add E2E Cypress testing (#43)
Browse files Browse the repository at this point in the history
  • Loading branch information
mikhail-vl authored Jun 5, 2023
1 parent f463057 commit f678dc0
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 0 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: E2E

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
tests:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Setup Node.js environment
uses: actions/setup-node@v3
with:
node-version: '18'
cache: 'npm'

- name: Install dependencies
run: npm install

- name: Build
run: npm run build

- name: Start Grafana
run: docker-compose up -d

- name: Run e2e tests
run: npm run e2e

- name: Stop Grafana
run: docker-compose down

- uses: actions/upload-artifact@v3
if: failure()
with:
path: |
cypress/videos
cypress/screenshots/actual
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
- Update to Grafana 9.5.2 (#41)
- Migrate to Plugin Tools 1.5.2 (#42)
- Update to Node 18 and npm (#42)
- Add E2E Cypress testing (#43)

## 2.2.0 (2023-03-27)

Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

![Grafana 9](https://img.shields.io/badge/Grafana-9.5.2-orange)
![CI](https://github.com/volkovlabs/volkovlabs-static-datasource/workflows/CI/badge.svg)
![E2E](https://github.com/volkovlabs/volkovlabs-static-datasource/workflows/E2E/badge.svg)
[![codecov](https://codecov.io/gh/VolkovLabs/volkovlabs-static-datasource/branch/main/graph/badge.svg?token=0m6f0ktUar)](https://codecov.io/gh/VolkovLabs/volkovlabs-static-datasource)
[![CodeQL](https://github.com/VolkovLabs/volkovlabs-static-datasource/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/VolkovLabs/volkovlabs-static-datasource/actions/workflows/codeql-analysis.yml)

Expand Down
23 changes: 23 additions & 0 deletions cypress/integration/01-view-panel.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { e2e } from '@grafana/e2e';

/**
* Dashboard
*/
const json = require('../../provisioning/dashboards/panels.json');
const testedPanel = json.panels[0];

/**
* Panel
*/
describe('Viewing a panel with a Logs from Static Data', () => {
beforeEach(() => {
e2e.flows.openDashboard({
uid: json.uid,
});
});

it('Should display a Logs Panel with Static Data', () => {
const currentPanel = e2e.components.Panels.Panel.title(testedPanel.title);
currentPanel.should('be.visible');
});
});
5 changes: 5 additions & 0 deletions cypress/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"compilerOptions": {
"types": ["cypress"]
}
}

0 comments on commit f678dc0

Please sign in to comment.