diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml new file mode 100644 index 0000000..88a347e --- /dev/null +++ b/.github/workflows/e2e.yml @@ -0,0 +1,53 @@ +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 (latest version) + run: docker-compose up -d + + - name: Run e2e tests + run: npm run e2e + + - name: Stop Grafana + run: docker-compose down + + - name: Start Grafana (minimum required version) + run: docker-compose -f docker-compose-min.yml up -d + + - name: Run e2e tests + run: npm run e2e + + - name: Stop Grafana + run: docker-compose -f docker-compose-min.yml down + + - uses: actions/upload-artifact@v3 + if: failure() + with: + path: | + cypress/videos + cypress/screenshots/actual diff --git a/CHANGELOG.md b/CHANGELOG.md index b06710a..81510e4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,10 @@ # Changelog -## 2.5.0 (2023-06-25) +## 3.0.0 (2023-06-25) + +### Breaking changes + +- Requires Grafana 9 and Grafana 10 ### Features / Enhancements @@ -8,6 +12,8 @@ - Migrate to Plugin Tools 1.5.2 (#28) - Update to Node 18 and npm (#28) - Update to Grafana 10.0.0 (#28) +- Add E2E Cypress testing (#29) +- Remove Grafana 8.5 support (#29) ## 2.4.0 (2023-05-13) diff --git a/README.md b/README.md index f940b3d..190add8 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,7 @@ ![Grafana](https://img.shields.io/badge/Grafana-10.0.0-orange) ![CI](https://github.com/volkovlabs/volkovlabs-env-datasource/workflows/CI/badge.svg) +![E2E](https://github.com/volkovlabs/volkovlabs-env-datasource/workflows/E2E/badge.svg) [![codecov](https://codecov.io/gh/VolkovLabs/volkovlabs-env-datasource/branch/main/graph/badge.svg?token=2W9VR0PG5N)](https://codecov.io/gh/VolkovLabs/volkovlabs-env-datasource) [![CodeQL](https://github.com/VolkovLabs/volkovlabs-env-datasource/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/VolkovLabs/volkovlabs-env-datasource/actions/workflows/codeql-analysis.yml) @@ -15,16 +16,16 @@ The Environment Data Source is a plugin for Grafana that returns environment var ## Requirements -- **Grafana 10** is supported. -- **Grafana 8.5+**, **Grafana 9.0+** is required for major version 2. -- **Grafana 8.0+** is required for major version 1. +- **Grafana 9**, and **Grafana 10** are required for major version 3. +- **Grafana 8.5+** and **Grafana 9** are required for major version 2. +- **Grafana 8** is required for major version 1. ## Getting Started -Environment Data Source is not included in the Grafana Catalog. It can be installed from our Private Repository or downloaded directly from GitHub. +Environment Data Source is not included in the Grafana Catalog. It can be installed directly from GitHub. ```bash -grafana-cli --repo https://volkovlabs.io/plugins plugins install volkovlabs-env-datasource +grafana cli --pluginUrl https://github.com/VolkovLabs/volkovlabs-env-datasource/releases/download/v3.0.0/volkovlabs-env-datasource-3.0.0.zip plugins install volkovlabs-env-datasource ``` ## Highlights @@ -38,15 +39,10 @@ grafana-cli --repo https://volkovlabs.io/plugins plugins install volkovlabs-env- | Section | Description | | ---------------------------- | ------------------------------------------------------------ | | [Deployment](https://volkovlabs.io/plugins/volkovlabs-env-datasource/deployment/) | Explains deployment options for the data source. | +| [Features](https://volkovlabs.io/plugins/volkovlabs-env-datasource/features/) | Demonstrates data source features. | | [Provisioning](https://volkovlabs.io/plugins/volkovlabs-env-datasource/provisioning/) | Demonstrates how to automatically provision the data Source. | | [Release Notes](https://volkovlabs.io/plugins/volkovlabs-env-datasource/release/) | Stay up to date with the latest features and updates. | -### Features - -| Section | Description | -| -------------------------------- | -------------------------------------------- | -| [Dashboard Variables](https://volkovlabs.io/plugins/volkovlabs-env-datasource/variables/) | Demonstrates how to use Dashboard variables. | - ## Support We provide GitHub Discussions and Premium tier support for the development plugins available via [GitHub Sponsor](https://github.com/sponsors/VolkovLabs). diff --git a/cypress/integration/01-view-panel.test.ts b/cypress/integration/01-view-panel.test.ts new file mode 100644 index 0000000..fe03c11 --- /dev/null +++ b/cypress/integration/01-view-panel.test.ts @@ -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 Data Source', () => { + beforeEach(() => { + e2e.flows.openDashboard({ + uid: json.uid, + }); + }); + + it('Should display a Table with Environment Variables', () => { + const currentPanel = e2e.components.Panels.Panel.title(testedPanel.title); + currentPanel.should('be.visible'); + }); +}); diff --git a/cypress/tsconfig.json b/cypress/tsconfig.json new file mode 100644 index 0000000..0756916 --- /dev/null +++ b/cypress/tsconfig.json @@ -0,0 +1,5 @@ +{ + "compilerOptions": { + "types": ["cypress"] + } +} diff --git a/docker-compose-min.yml b/docker-compose-min.yml new file mode 100644 index 0000000..10388da --- /dev/null +++ b/docker-compose-min.yml @@ -0,0 +1,15 @@ +version: '3.4' + +services: + grafana: + container_name: grafana + image: grafana/grafana:9.0.0 + ports: + - 3000:3000 + environment: + - GF_AUTH_ANONYMOUS_ENABLED=true + - GF_DEFAULT_APP_MODE=development + - GF_DASHBOARDS_DEFAULT_HOME_DASHBOARD_PATH=/etc/grafana/provisioning/dashboards/panels.json + volumes: + - ./dist:/var/lib/grafana/plugins/volkovlabs-env-datasource + - ./provisioning:/etc/grafana/provisioning diff --git a/docker-compose-nginx.yml b/docker-compose-nginx.yml index f2b79ca..bee018c 100644 --- a/docker-compose-nginx.yml +++ b/docker-compose-nginx.yml @@ -7,7 +7,7 @@ services: ports: - 3000:3000/tcp environment: - - GF_INSTALL_PLUGINS=https://github.com/VolkovLabs/volkovlabs-env-datasource/releases/download/v2.4.0/volkovlabs-env-datasource-2.4.0.zip;volkovlabs-env-datasource + - GF_INSTALL_PLUGINS=https://github.com/VolkovLabs/volkovlabs-env-datasource/releases/download/v3.0.0/volkovlabs-env-datasource-3.0.0.zip;volkovlabs-env-datasource volumes: - ./provisioning:/etc/grafana/provisioning diff --git a/package.json b/package.json index 60f3d1c..26abbb6 100644 --- a/package.json +++ b/package.json @@ -71,5 +71,5 @@ "test:ci": "jest --maxWorkers 4 --coverage", "upgrade": "npm upgrade --save" }, - "version": "2.5.0" + "version": "3.0.0" } diff --git a/src/img/dashboard.png b/src/img/dashboard.png index 5927491..85091ee 100644 Binary files a/src/img/dashboard.png and b/src/img/dashboard.png differ diff --git a/src/plugin.json b/src/plugin.json index f24fb66..af5c962 100644 --- a/src/plugin.json +++ b/src/plugin.json @@ -2,7 +2,7 @@ "$schema": "https://raw.githubusercontent.com/grafana/grafana/master/docs/sources/developers/plugins/plugin.schema.json", "backend": true, "dependencies": { - "grafanaDependency": ">=8.5.0", + "grafanaDependency": ">=9.0.0", "plugins": [] }, "executable": "env_datasource_backend",