diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index cd0bde5129f..8d87433f7b9 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -791,6 +791,7 @@ embed.go @grafana/grafana-as-code /.github/workflows/publish-kinds-release.yml @grafana/platform-monitoring /.github/workflows/verify-kinds.yml @grafana/platform-monitoring /.github/workflows/dashboards-issue-add-label.yml @grafana/dashboards-squad +/.github/workflows/run-schema-v2-e2e.yml @grafana/dashboards-squad /.github/workflows/ephemeral-instances-pr-comment.yml @grafana/grafana-backend-services-squad /.github/workflows/create-security-patch-from-security-mirror.yml @grafana/grafana-developer-enablement-squad /.github/workflows/core-plugins-build-and-release.yml @grafana/plugins-platform-frontend @grafana/plugins-platform-backend diff --git a/.github/workflows/run-schema-v2-e2e.yml b/.github/workflows/run-schema-v2-e2e.yml new file mode 100644 index 00000000000..8b55aa4c430 --- /dev/null +++ b/.github/workflows/run-schema-v2-e2e.yml @@ -0,0 +1,44 @@ +name: Run dashboard schema v2 e2e + +on: + push: + branches: + - main + pull_request: + branches: + - '**' + +env: + ARCH: linux-amd64 + +jobs: + dashboard-schema-v2-e2e: + runs-on: ubuntu-latest + continue-on-error: true + if: github.event.pull_request.draft == false + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Pin Go version to mod file + uses: actions/setup-go@v5 + with: + go-version-file: 'go.mod' + - run: go version + - uses: actions/setup-node@v4 + with: + node-version: 20 + cache: 'yarn' + - name: Install dependencies + run: yarn install --immutable + - name: Build grafana + run: make build + - name: Install Cypress dependencies + uses: cypress-io/github-action@v6 + with: + runTests: false + - name: Run dashboard scenes e2e + run: yarn e2e:schema-v2 || echo "Test failed but marking as success since schema V2 is behind a feature flag and should not block PRs" + + - name: Always succeed # This is a workaround to make the job pass even if the previous step fails + if: failure() + run: exit 0 \ No newline at end of file diff --git a/e2e/cypress/support/e2e.js b/e2e/cypress/support/e2e.js index 3e03d0f4344..ddd50a58844 100644 --- a/e2e/cypress/support/e2e.js +++ b/e2e/cypress/support/e2e.js @@ -50,4 +50,9 @@ beforeEach(() => { cy.logToConsole('disabling dashboardScene feature toggle in localstorage'); cy.setLocalStorage('grafana.featureToggles', 'dashboardScene=false'); } + + if (Cypress.env('useV2DashboardsAPI')) { + cy.logToConsole('enabling v2 dashboards API in localstorage'); + cy.setLocalStorage('grafana.featureToggles', 'useV2DashboardsAPI=true'); + } }); diff --git a/e2e/run-suite b/e2e/run-suite index 11569b43982..bc0eebd1567 100755 --- a/e2e/run-suite +++ b/e2e/run-suite @@ -28,6 +28,7 @@ declare -A env=( testFilesForSingleSuite="*.spec.ts" rootForEnterpriseSuite="./e2e/extensions-suite" rootForOldArch="./e2e/old-arch" +rootForDashboardsSchemaV2="./e2e/dashboards-suite" declare -A cypressConfig=( [screenshotsFolder]=./e2e/"${args[0]}"/screenshots @@ -111,6 +112,24 @@ case "$1" in cypressConfig[video]=${args[1]} env[DISABLE_SCENES]=true ;; + "dashboards-schema-v2") + env[useV2DashboardsAPI]=true + cypressConfig[specPattern]=$rootForDashboardsSchemaV2/$testFilesForSingleSuite + cypressConfig[video]=false + case "$2" in + "debug") + echo -e "Debug mode" + env[SLOWMO]=1 + PARAMS="--no-exit" + enterpriseSuite=$(basename "${args[2]}") + ;; + "dev") + echo "Dev mode" + CMD="cypress open" + enterpriseSuite=$(basename "${args[2]}") + ;; + esac + ;; "enterprise-smtp") env[SMTP_PLUGIN_ENABLED]=true cypressConfig[specPattern]=./e2e/extensions/enterprise/smtp-suite/$testFilesForSingleSuite diff --git a/package.json b/package.json index d87d9050539..5d19e8cf0d2 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,8 @@ "build:stats": "NODE_ENV=production webpack --progress --config scripts/webpack/webpack.stats.js", "dev": "NODE_ENV=dev nx exec -- webpack --config scripts/webpack/webpack.dev.js", "e2e": "./e2e/start-and-run-suite", - "e2e:scenes": "./e2e/start-and-run-suite scenes", + "e2e:old-arch": "./e2e/start-and-run-suite old-arch", + "e2e:schema-v2": "./e2e/start-and-run-suite dashboards-schema-v2", "e2e:debug": "./e2e/start-and-run-suite debug", "e2e:dev": "./e2e/start-and-run-suite dev", "e2e:benchmark:live": "./e2e/start-and-run-suite benchmark live",