From 626a67ea33bc22e336aa1c3bfb3855d61fa4858d Mon Sep 17 00:00:00 2001 From: Carolina Gonzalez Date: Wed, 26 Jun 2024 11:21:51 -0400 Subject: [PATCH] refactor: remove sentry error reporter test for now --- .env.example | 3 ++ .github/workflows/e2e.yml | 4 +- dev/test-studio/schema/debug/error.tsx | 28 ++++++++++++ dev/test-studio/schema/index.ts | 2 + dev/test-studio/structure/constants.ts | 1 + packages/sanity/package.json | 1 + .../hasSanityPackageInImportMap.ts | 1 + .../error-reporting/errorReporter.spec.ts | 43 +++++++++++++++++++ .../sentryErrorReporter.test.ts | 33 -------------- 9 files changed, 81 insertions(+), 35 deletions(-) create mode 100644 dev/test-studio/schema/debug/error.tsx create mode 100644 test/e2e/tests/error-reporting/errorReporter.spec.ts delete mode 100644 test/e2e/tests/error-reporting/sentryErrorReporter.test.ts diff --git a/.env.example b/.env.example index 8f03c8d450e1..816f64da8315 100644 --- a/.env.example +++ b/.env.example @@ -14,3 +14,6 @@ SANITY_E2E_BASE_URL=http://localhost:3339 # Whether or not to run the end to end tests in headless mode. Defaults to true, but sometimes # you might want to see the browser in action, in which case you can set this to `false`. HEADLESS=true +SANITY_E2E_HEADLESS=true +# In CI, we have to provide some signal of how we've build the studio. Set this to `true` if you're testing an auto-updating build. +SANITY_E2E_IS_AUTO_UPDATING=false diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index c01d075813c7..ed18cf7dbfd2 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -99,7 +99,7 @@ jobs: # Delete `SANITY_E2E_SESSION_TOKEN_NEW` from github SANITY_E2E_SESSION_TOKEN: ${{ secrets.SANITY_E2E_SESSION_TOKEN_NEW }} SANITY_E2E_PROJECT_ID: ${{ secrets.SANITY_E2E_PROJECT_ID }} - SANITY_E2E_DATASET: pr-${{ matrix.project }}-${{ github.event.number }} + SANITY_E2E_DATASET: pr-${{ matrix.project }}-${{ github.event.number }}${{ matrix.config == 'auto-updating' && '-auto-updating' || '' }} SANITY_E2E_IS_AUTO_UPDATING: ${{ matrix.config == 'auto-updating' && 'true' || '' }} run: | if [ "${{ matrix.config }}" == "auto-updating" ]; then @@ -227,7 +227,7 @@ jobs: # Delete `SANITY_E2E_SESSION_TOKEN_NEW` from github SANITY_E2E_SESSION_TOKEN: ${{ secrets.SANITY_E2E_SESSION_TOKEN_NEW }} SANITY_E2E_PROJECT_ID: ${{ secrets.SANITY_E2E_PROJECT_ID }} - SANITY_E2E_DATASET: pr-${{ matrix.project }}-${{ github.event.number }} + SANITY_E2E_DATASET: pr-${{ matrix.project }}-${{ github.event.number }}${{ matrix.config == 'auto-updating' && '-auto-updating' || '' }} SANITY_E2E_IS_AUTO_UPDATING: ${{ matrix.config == 'auto-updating' && 'true' || '' }} run: pnpm test:e2e --project ${{ matrix.project }} --shard ${{ matrix.shardIndex }}/${{ matrix.shardTotal }} diff --git a/dev/test-studio/schema/debug/error.tsx b/dev/test-studio/schema/debug/error.tsx new file mode 100644 index 000000000000..ff92432a09eb --- /dev/null +++ b/dev/test-studio/schema/debug/error.tsx @@ -0,0 +1,28 @@ +import { Button } from '@sanity/ui' +import { defineField, defineType } from 'sanity' + +export default defineType({ + name: 'error', + type: 'document', + title: 'Error', + fields: [ + defineField({ + name: 'title', + title: 'Title', + type: 'string', + components: { + input: () => { + const errorFunc = () => { + throw new Error('This is not a real error: we are just testing') + } + return ( +