Skip to content

Commit

Permalink
chore(e2e): run e2e tests in production build
Browse files Browse the repository at this point in the history
  • Loading branch information
binoy14 committed Oct 26, 2023
1 parent ad93b1a commit 65af4b6
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 2 deletions.
10 changes: 10 additions & 0 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion dev/studio-e2e-testing/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"author": "Sanity.io <[email protected]>",
"scripts": {
"dev": "sanity dev --port 3339",
"start": "sanity start",
"start": "sanity start --port 3339",
"build": "sanity build"
},
"keywords": [
Expand Down
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
7 changes: 6 additions & 1 deletion playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
},
})

Expand Down

0 comments on commit 65af4b6

Please sign in to comment.