diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index ffdd62154c8..0a791a2cf15 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -62,6 +62,16 @@ jobs: - name: Build CLI run: yarn build:cli # Needed for CLI tests + - name: Build E2E test studio + env: + # Update the SANITY_E2E_SESSION_TOKEN on github to the new value once this is merged to next + # Change the below to `secrets.SANITY_E2E_SESSION_TOKEN` + # 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: ${{ secrets.SANITY_E2E_DATASET }} + run: yarn e2e:build + - name: Run end-to-end tests env: # Missing in docs but in use diff --git a/dev/studio-e2e-testing/package.json b/dev/studio-e2e-testing/package.json index 4cba028513c..5452cd781b0 100644 --- a/dev/studio-e2e-testing/package.json +++ b/dev/studio-e2e-testing/package.json @@ -6,7 +6,7 @@ "author": "Sanity.io ", "scripts": { "dev": "sanity dev --port 3339", - "start": "sanity start", + "start": "sanity start --port 3339", "build": "sanity build" }, "keywords": [ diff --git a/package.json b/package.json index 16c50a581e2..21bae3b54c0 100644 --- a/package.json +++ b/package.json @@ -41,6 +41,9 @@ "example:example-studio": "yarn --cwd dev/example-studio start", "example:movies-studio": "yarn --cwd examples/movies-studio start", "e2e:dev": "yarn --cwd dev/studio-e2e-testing dev", + "e2e:build": "yarn --cwd dev/studio-e2e-testing build", + "e2e:preview": "yarn e2e:build && yarn --cwd dev/studio-e2e-testing start", + "e2e:start": "yarn --cwd dev/studio-e2e-testing start", "etl": "node -r dotenv-flow/config -r esbuild-register scripts/etl", "init": "lerna clean --yes && run-s bootstrap build", "lerna:clean": "lerna clean", diff --git a/playwright.config.ts b/playwright.config.ts index 557a09c59fa..fa4a1a04d9a 100644 --- a/playwright.config.ts +++ b/playwright.config.ts @@ -89,9 +89,14 @@ export default defineConfig({ /* Run your local dev server before starting the tests */ webServer: { - command: 'yarn e2e:dev', + /** + * If it is running in CI just start the production build assuming that studio is already build + * Locally run the dev server + */ + command: CI ? 'yarn e2e:start' : 'yarn e2e:dev', port: 3339, reuseExistingServer: !CI, + stdout: 'pipe', }, })