-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #27 from grafana/bohandley/integration-tests
Bohandley/integration tests
- Loading branch information
Showing
20 changed files
with
3,009 additions
and
1,532 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
name: E2E Tests | ||
on: | ||
pull_request: | ||
paths-ignore: | ||
- 'docs/**' | ||
push: | ||
paths-ignore: | ||
- 'docs/**' | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | ||
cancel-in-progress: true | ||
jobs: | ||
test: | ||
timeout-minutes: 60 | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Setup Go environment | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: '1.21.6' | ||
check-latest: true | ||
cache-dependency-path: "**/*.sum" | ||
# NOT TESTING THE BACKEND YET | ||
# - name: Test backend | ||
# uses: magefile/mage-action@v2 | ||
# with: | ||
# version: latest | ||
# args: coverage | ||
- name: Build backend | ||
uses: magefile/mage-action@v2 | ||
with: | ||
version: latest | ||
args: buildAll | ||
- name: Setup Node | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 20 | ||
check-latest: true | ||
cache: 'yarn' | ||
- name: Install dependencies | ||
run: npm install -g yarn && yarn install --frozen-lockfile; | ||
- name: Build Frontend | ||
run: | | ||
yarn build; | ||
- name: Start the docker container for E2E | ||
run: | | ||
docker compose -f docker-compose-debug.yaml pull | ||
docker compose -f docker-compose-debug.yaml up -d | ||
- name: Wait for prometheus to start | ||
uses: nev7n/wait_for_response@v1 | ||
with: | ||
url: 'http://localhost:9090/-/ready' | ||
responseCode: 200 | ||
timeout: 20000 | ||
interval: 500 | ||
- name: Wait for grafana to start | ||
uses: nev7n/wait_for_response@v1 | ||
with: | ||
url: 'http://localhost:3099/' | ||
responseCode: 200 | ||
timeout: 20000 | ||
interval: 500 | ||
- name: Install Playwright Browsers | ||
run: yarn playwright install --with-deps | ||
- name: Run E2E tests | ||
run: yarn test:e2e | ||
- name: Run E2E report | ||
uses: actions/upload-artifact@v3 | ||
if: always() | ||
with: | ||
name: playwright-report | ||
path: playwright-report/ | ||
retention-days: 30 | ||
- name: Run E2E videos | ||
uses: actions/upload-artifact@v3 | ||
if: always() | ||
with: | ||
name: test-results | ||
path: test-results/ | ||
retention-days: 30 | ||
- name: Stop the docker container | ||
if: always() | ||
run: docker-compose -f docker-compose-debug.yaml down |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
version: "3.7" | ||
services: | ||
prometheus: | ||
image: prom/prometheus:v2.45.0 | ||
container_name: prometheus-debug | ||
command: | ||
- '--config.file=/etc/prometheus/prometheus.yml' | ||
ports: | ||
- 9090:9090 | ||
restart: unless-stopped | ||
volumes: | ||
- ./prometheus:/etc/prometheus | ||
- prom_data:/prometheus | ||
grafana: | ||
image: grafana/grafana-enterprise:${GF_VERSION:-main} | ||
container_name: grafana-prometheus-amazon-debug | ||
ports: | ||
- 3099:3099 | ||
restart: unless-stopped | ||
environment: | ||
- GF_DEFAULT_APP_MODE=development | ||
# - GF_AUTH_ANONYMOUS_ORG_ROLE=Admin | ||
# - GF_AUTH_ANONYMOUS_ENABLED=true | ||
- GF_AUTH_BASIC_ENABLED=false | ||
- GF_SERVER_HTTP_PORT=3099 | ||
volumes: | ||
- ./provisioning/datasources:/etc/grafana/provisioning/datasources | ||
- ./dist:/var/lib/grafana/plugins/prometheus-amazon | ||
depends_on: | ||
prometheus: | ||
condition: service_started | ||
volumes: | ||
prom_data: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { DataSourcePluginOptionsEditorProps } from '@grafana/data'; | ||
import { selectors } from '@grafana/e2e-selectors'; | ||
import { test, expect } from '@grafana/plugin-e2e'; | ||
import { PromOptions } from '@grafana/prometheus'; | ||
|
||
test.describe('Prometheus annotation query editor', () => { | ||
test('Check that the editor uses the code editor', async ({ | ||
readProvisionedDataSource, | ||
annotationEditPage, | ||
page, | ||
}) => { | ||
const ds = await readProvisionedDataSource<DataSourcePluginOptionsEditorProps<PromOptions>>({ fileName: 'datasources.yml' }); | ||
|
||
await page.getByTestId('data-testid Select a data source').click(); | ||
|
||
await page.getByTestId('data-testid Select a data source').fill(ds.name); | ||
|
||
await page.getByRole('button', { name: `${ds.name} Prometheus` }).click(); | ||
|
||
await expect(annotationEditPage | ||
.getByTestIdOrAriaLabel(selectors.components.DataSource.Prometheus.queryEditor.code.queryField)).toBeVisible(); | ||
}); | ||
}); |
Oops, something went wrong.