Skip to content

Commit

Permalink
Add E2E Cypress testing (#74)
Browse files Browse the repository at this point in the history
* Add E2E Cypress testing

* Update logo and screenshot

* Add News to the Mega Menu
  • Loading branch information
mikhail-vl authored Jun 17, 2023
1 parent b4e5dfb commit 9b4d5ad
Show file tree
Hide file tree
Showing 12 changed files with 104 additions and 34 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
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Change Log

## 2.5.0 (IN PROGRESS)
## 2.5.0 (2023-06-17)

### Features / Enhancements

Expand All @@ -10,6 +10,7 @@
- Update to Node 18 and npm (#71)
- Update Docker image 10.0.0 (#72)
- Add Application Router (#73)
- Add E2E Cypress testing (#74)

## 2.4.0 (2023-04-29)

Expand Down
8 changes: 7 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ USER root
COPY img/fav32.png /usr/share/grafana/public/img

## Replace Logo
COPY src/img/logo.svg /usr/share/grafana/public/img/grafana_icon.svg
COPY img/logo.svg /usr/share/grafana/public/img/grafana_icon.svg

## Update Background
COPY img/background.svg /usr/share/grafana/public/img/g8_login_dark.svg
Expand All @@ -75,6 +75,12 @@ RUN sed -i "s|\[\[.NavTree\]\],|nav,|g; \
window.grafanaBootData = {|g" \
/usr/share/grafana/public/views/index.html

## Add News to the Mega Menu
RUN sed -i "s|window.grafanaBootData = {| \
nav.push({\"id\":\"my-dashboard\",\"text\":\"Volkov Labs News\",\"icon\":\"play\",\"url\":\"/d/O4tc_E6Gz\",\"sortWeight\":-2000}); \
window.grafanaBootData = {|g" \
/usr/share/grafana/public/views/index.html

## Update Title
RUN find /usr/share/grafana/public/build/ -name *.js -exec sed -i 's|AppTitle="Grafana"|AppTitle="Volkov Labs"|g' {} \;

Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@

![Application](https://raw.githubusercontent.com/volkovlabs/volkovlabs-app/main/img/app.png)

![Grafana 9](https://img.shields.io/badge/Grafana-9.5.2-orange)
![Grafana 10](https://img.shields.io/badge/Grafana-10.0.0-orange)
[![YouTube](https://img.shields.io/badge/YouTube-Channel-red)](https://youtube.com/@volkovlabs)
![CI](https://github.com/volkovlabs/volkovlabs-app/workflows/CI/badge.svg)
![E2E](https://github.com/volkovlabs/volkovlabs-app/workflows/E2E/badge.svg)
[![codecov](https://codecov.io/gh/VolkovLabs/volkovlabs-app/branch/main/graph/badge.svg)](https://codecov.io/gh/VolkovLabs/volkovlabs-app)
[![CodeQL](https://github.com/VolkovLabs/volkovlabs-app/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/VolkovLabs/volkovlabs-app/actions/workflows/codeql-analysis.yml)

Expand Down
23 changes: 23 additions & 0 deletions cypress/integration/01-view-news.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/news.json');
const testedPanel = json.panels[0];

/**
* Panel
*/
describe('Viewing the News dashboard', () => {
beforeEach(() => {
e2e.flows.openDashboard({
uid: json.uid,
});
});

it('Should display a Dynamic Text Panel', () => {
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"]
}
}
Binary file modified img/app.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 16 additions & 0 deletions img/logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 0 additions & 3 deletions src/constants/tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ export const TestIds = {
config: {
root: 'data-testid config',
},
rootPage: {
loadingIndicator: 'data-testid root-page loading-indicator',
},
community: {
root: 'data-testid root-page community',
},
Expand Down
5 changes: 0 additions & 5 deletions src/img/app-logo.svg

This file was deleted.

17 changes: 3 additions & 14 deletions src/img/logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 2 additions & 9 deletions src/plugin.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
}
],
"logos": {
"large": "img/app-logo.svg",
"small": "img/app-logo.svg"
"large": "img/logo.svg",
"small": "img/logo.svg"
},
"screenshots": [],
"updated": "%TODAY%",
Expand All @@ -47,13 +47,6 @@
"role": "Viewer",
"icon": "fire",
"type": "page"
},
{
"addToNav": true,
"name": "News",
"path": "/d/O4tc_E6Gz",
"role": "Viewer",
"type": "page"
}
],
"autoEnabled": true,
Expand Down

0 comments on commit 9b4d5ad

Please sign in to comment.