E2E: Add plugin-e2e scenario verification tests (#79969)

* add playwright test and plugin-e2e

* run tests in ci

* add ds config tests

* add panel edit tests

* add annotation test

* add variable edit page tests

* add explore page tests

* add panel plugin tests

* add readme

* remove comments

* fix broken test

* remove user.json

* remove newline in starlark

* fix lint issue

* ignore failure of playwright tests

* update code owners

* add detailed error messages in every expect

* update message frame

* fix link

* upload report to gcp

* echo url

* add playwright developer guide

* bump plugin-e2e

* add custom provisioning dir

* update plugin-e2e

* remove not used imports

* fix typo

* minor fixes

* use latest version of plugin-e2e

* fix broken link

* use latest plugin-e2e

* add feature toggle scenario verification tests

* bump version

* use auth file from package

* fix type error

* add panel data assertions

* rename parent dir and bump version

* fix codeowners

* reset files

* remove not used file

* update plugin-e2e

* separate tests per role

* pass prov dir

* skip using provisioning fixture

* wip

* fix permission test

* move to e2e dir

* fix path to readme

* post comment with report url

* format starlark

* post comment with report url

* post comment with report url

* fix token

* make test fail

* fix exit code

* bump version

* bump to latest plugin-e2e

* revert reporting message

* remove comments

* readding report comment

* change exit code

* format starlark

* force test to fail

* add new step that posts comment

* fix link

* use latest playwright image

* fix failing test

* format starlark

* remove unused fixture

Co-authored-by: Marcus Andersson <marcus.andersson@grafana.com>

---------

Co-authored-by: Marcus Andersson <marcus.andersson@grafana.com>
This commit is contained in:
Erik Sundell
2024-02-23 12:39:30 +01:00
committed by GitHub
co-authored by Marcus Andersson
parent b25667223c
commit 3e456127cb
22 changed files with 2347 additions and 212 deletions
+111 -1
View File
@@ -653,6 +653,60 @@ steps:
- e2e/cloud-plugins-suite/azure-monitor.spec.ts
repo:
- grafana/grafana
- commands:
- sleep 10s
- yarn e2e:playwright
depends_on:
- grafana-server
environment:
HOST: grafana-server
PORT: "3001"
PROV_DIR: /grafana/scripts/grafana-server/tmp/conf/provisioning
failure: ignore
image: mcr.microsoft.com/playwright:v1.41.2-jammy
name: playwright-plugin-e2e
- commands:
- apt-get update
- apt-get install -yq zip
- printenv GCP_GRAFANA_UPLOAD_ARTIFACTS_KEY > /tmp/gcpkey_upload_artifacts.json
- gcloud auth activate-service-account --key-file=/tmp/gcpkey_upload_artifacts.json
- gsutil cp -r ./playwright-report/. gs://releng-pipeline-artifacts-dev/${DRONE_BUILD_NUMBER}/playwright-report
- export E2E_PLAYWRIGHT_REPORT_URL=https://storage.googleapis.com/releng-pipeline-artifacts-dev/${DRONE_BUILD_NUMBER}/playwright-report/index.html
- "echo \"E2E Playwright report uploaded to: \n $${E2E_PLAYWRIGHT_REPORT_URL}\""
depends_on:
- playwright-plugin-e2e
environment:
GCP_GRAFANA_UPLOAD_ARTIFACTS_KEY:
from_secret: gcp_upload_artifacts_key
failure: ignore
image: google/cloud-sdk:431.0.0
name: playwright-e2e-report-upload
when:
status:
- success
- failure
- commands:
- if [ ! -d ./playwright-report/trace ]; then echo 'all tests passed'; exit 0; fi
- export E2E_PLAYWRIGHT_REPORT_URL=https://storage.googleapis.com/releng-pipeline-artifacts-dev/${DRONE_BUILD_NUMBER}/playwright-report/index.html
- 'curl -L -X POST https://api.github.com/repos/grafana/grafana/issues/${DRONE_PULL_REQUEST}/comments
-H "Accept: application/vnd.github+json" -H "Authorization: Bearer $${GITHUB_TOKEN}"
-H "X-GitHub-Api-Version: 2022-11-28" -d "{\"body\":\"❌ Failed to run Playwright
plugin e2e tests. <br /> <br /> Click [here]($${E2E_PLAYWRIGHT_REPORT_URL}) to
browse the Playwright report and trace viewer. <br /> For information on how to
run Playwright tests locally, refer to the [Developer guide](https://github.com/grafana/grafana/blob/main/contribute/developer-guide.md#to-run-the-playwright-tests).
\"}"'
depends_on:
- playwright-e2e-report-upload
environment:
GITHUB_TOKEN:
from_secret: github_token
failure: ignore
image: byrnedo/alpine-curl:0.1.8
name: playwright-e2e-report-post-link
when:
status:
- success
- failure
- commands:
- if [ -z `find ./e2e -type f -name *spec.ts.mp4` ]; then echo 'missing videos';
false; fi
@@ -1929,6 +1983,60 @@ steps:
- e2e/cloud-plugins-suite/azure-monitor.spec.ts
repo:
- grafana/grafana
- commands:
- sleep 10s
- yarn e2e:playwright
depends_on:
- grafana-server
environment:
HOST: grafana-server
PORT: "3001"
PROV_DIR: /grafana/scripts/grafana-server/tmp/conf/provisioning
failure: ignore
image: mcr.microsoft.com/playwright:v1.41.2-jammy
name: playwright-plugin-e2e
- commands:
- apt-get update
- apt-get install -yq zip
- printenv GCP_GRAFANA_UPLOAD_ARTIFACTS_KEY > /tmp/gcpkey_upload_artifacts.json
- gcloud auth activate-service-account --key-file=/tmp/gcpkey_upload_artifacts.json
- gsutil cp -r ./playwright-report/. gs://releng-pipeline-artifacts-dev/${DRONE_BUILD_NUMBER}/playwright-report
- export E2E_PLAYWRIGHT_REPORT_URL=https://storage.googleapis.com/releng-pipeline-artifacts-dev/${DRONE_BUILD_NUMBER}/playwright-report/index.html
- "echo \"E2E Playwright report uploaded to: \n $${E2E_PLAYWRIGHT_REPORT_URL}\""
depends_on:
- playwright-plugin-e2e
environment:
GCP_GRAFANA_UPLOAD_ARTIFACTS_KEY:
from_secret: gcp_upload_artifacts_key
failure: ignore
image: google/cloud-sdk:431.0.0
name: playwright-e2e-report-upload
when:
status:
- success
- failure
- commands:
- if [ ! -d ./playwright-report/trace ]; then echo 'all tests passed'; exit 0; fi
- export E2E_PLAYWRIGHT_REPORT_URL=https://storage.googleapis.com/releng-pipeline-artifacts-dev/${DRONE_BUILD_NUMBER}/playwright-report/index.html
- 'curl -L -X POST https://api.github.com/repos/grafana/grafana/issues/${DRONE_PULL_REQUEST}/comments
-H "Accept: application/vnd.github+json" -H "Authorization: Bearer $${GITHUB_TOKEN}"
-H "X-GitHub-Api-Version: 2022-11-28" -d "{\"body\":\"❌ Failed to run Playwright
plugin e2e tests. <br /> <br /> Click [here]($${E2E_PLAYWRIGHT_REPORT_URL}) to
browse the Playwright report and trace viewer. <br /> For information on how to
run Playwright tests locally, refer to the [Developer guide](https://github.com/grafana/grafana/blob/main/contribute/developer-guide.md#to-run-the-playwright-tests).
\"}"'
depends_on:
- playwright-e2e-report-upload
environment:
GITHUB_TOKEN:
from_secret: github_token
failure: ignore
image: byrnedo/alpine-curl:0.1.8
name: playwright-e2e-report-post-link
when:
status:
- success
- failure
- commands:
- if [ -z `find ./e2e -type f -name *spec.ts.mp4` ]; then echo 'missing videos';
false; fi
@@ -4539,6 +4647,7 @@ steps:
- trivy --exit-code 0 --severity UNKNOWN,LOW,MEDIUM cypress/included:13.1.0
- trivy --exit-code 0 --severity UNKNOWN,LOW,MEDIUM jwilder/dockerize:0.6.1
- trivy --exit-code 0 --severity UNKNOWN,LOW,MEDIUM koalaman/shellcheck:stable
- trivy --exit-code 0 --severity UNKNOWN,LOW,MEDIUM mcr.microsoft.com/playwright:v1.41.2-jammy
depends_on:
- authenticate-gcr
image: aquasec/trivy:0.21.0
@@ -4573,6 +4682,7 @@ steps:
- trivy --exit-code 1 --severity HIGH,CRITICAL cypress/included:13.1.0
- trivy --exit-code 1 --severity HIGH,CRITICAL jwilder/dockerize:0.6.1
- trivy --exit-code 1 --severity HIGH,CRITICAL koalaman/shellcheck:stable
- trivy --exit-code 1 --severity HIGH,CRITICAL mcr.microsoft.com/playwright:v1.41.2-jammy
depends_on:
- authenticate-gcr
environment:
@@ -4804,6 +4914,6 @@ kind: secret
name: gcr_credentials
---
kind: signature
hmac: 043eca32327fd48d9b479c3a51549b30f3825553c55df6220581def9bd22f513
hmac: bce7b2ac72349019ec0c2ffbdca13c0591110ee53a3bfc72261df0ed05ca025a
...