chore (react-apollo): run e2e on preview instead of dev server (#3295)

### **PR Type**
Enhancement


___

### **Description**
- Run e2e tests on preview build instead of dev server

- Update Playwright configuration for better test reliability

- Add new script for building and previewing in one step

- Improve clean and install process with new script


___



### **Changes walkthrough** 📝
<table><thead><tr><th></th><th align="left">Relevant
files</th></tr></thead><tbody><tr><td><strong>Enhancement</strong></td><td><table>
<tr>
  <td>
    <details>
<summary><strong>playwright.config.ts</strong><dd><code>Update
Playwright config for preview build and improved
tracing</code></dd></summary>
<hr>

examples/react-apollo/playwright.config.ts

<li>Changed webServer command from 'pnpm dev' to 'pnpm
build:preview'<br> <li> Updated trace option from 'on-first-retry' to
'retain-on-failure'


</details>


  </td>
<td><a
href="https://github.com/nhost/nhost/pull/3295/files#diff-b22b77d29b0086af8ed742e35817880023261afccab0a6a41093e2a6d58715aa">+2/-2</a>&nbsp;
&nbsp; &nbsp; </td>

</tr>

<tr>
  <td>
    <details>
<summary><strong>package.json</strong><dd><code>Add build:preview script
and specify preview port</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; </dd></summary>
<hr>

examples/react-apollo/package.json

<li>Added port 3000 to preview script<br> <li> Introduced new
'build:preview' script combining build and preview


</details>


  </td>
<td><a
href="https://github.com/nhost/nhost/pull/3295/files#diff-d95dc3391741287366ea2e61f70e9ccc64452e0d22b1db91d6bf524f5aa4331c">+2/-1</a>&nbsp;
&nbsp; &nbsp; </td>

</tr>

<tr>
  <td>
    <details>
<summary><strong>package.json</strong><dd><code>Add clean:install script
for project maintenance</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; </dd></summary>
<hr>

package.json

- Added new 'clean:install' script for cleaning and reinstalling


</details>


  </td>
<td><a
href="https://github.com/nhost/nhost/pull/3295/files#diff-7ae45ad102eab3b6d7e7896acd08c427a9b25b346470d7bc6507b6481575d519">+1/-0</a>&nbsp;
&nbsp; &nbsp; </td>

</tr>
</table></td></tr></tr></tbody></table>

___

> <details> <summary> Need help?</summary><li>Type <code>/help how to
...</code> in the comments thread for any questions about PR-Agent
usage.</li><li>Check out the <a
href="https://qodo-merge-docs.qodo.ai/usage-guide/">documentation</a>
for more information.</li></details>
This commit is contained in:
robertkasza
2025-04-10 15:51:05 +02:00
committed by GitHub
parent 233232b06f
commit efd68c3f92
5 changed files with 18 additions and 8 deletions

View File

@@ -0,0 +1,5 @@
---
'@nhost-examples/react-apollo': patch
---
chore (react-apollo): use preview build instead of local dev server for e2e tests

View File

@@ -1,7 +1,7 @@
[global]
[hasura]
version = 'v2.25.1-ce'
version = 'v2.46.0-ce'
adminSecret = '{{ secrets.HASURA_GRAPHQL_ADMIN_SECRET }}'
webhookSecret = '{{ secrets.NHOST_WEBHOOK_SECRET }}'
@@ -25,10 +25,10 @@ httpPoolSize = 100
[functions]
[functions.node]
version = 18
version = 22
[auth]
version = '0.24.0'
version = '0.38.0'
[auth.redirections]
clientUrl = 'http://localhost:3000'
@@ -139,12 +139,15 @@ timeout = 60000
enabled = false
[postgres]
version = '14.6-20230406-2'
version = '16.6-20250311-1'
[postgres.resources.storage]
capacity = 1
[provider]
[storage]
version = '0.5.1'
version = '0.7.1'
[observability]
[observability.grafana]

View File

@@ -7,7 +7,8 @@
"dev": "vite",
"build": "tsc -b && vite build",
"lint": "eslint .",
"preview": "vite preview",
"preview": "vite preview --port 3000",
"build:preview": "pnpm build && pnpm preview",
"install-browsers": "pnpm playwright install && pnpm playwright install-deps",
"e2e": "pnpm e2e:start-backend && pnpm e2e:test",
"e2e:test": "pnpm install-browsers && pnpm playwright test",

View File

@@ -16,11 +16,11 @@ export default defineConfig({
timeout: 5000
},
webServer: {
command: 'pnpm dev',
command: 'pnpm build:preview',
port: 3000
},
use: {
trace: 'on-first-retry',
trace: 'retain-on-failure',
baseURL: 'http://localhost:3000'
},
fullyParallel: true,

View File

@@ -26,6 +26,7 @@
"dev:dashboard": "turbo run dev --filter=@nhost/dashboard",
"clean:all": "pnpm clean && rm -rf ./{{packages,examples/**,templates/**}/*,docs,dashboard}/{.nhost,node_modules} node_modules",
"clean": "rm -rf ./{{packages,examples/**}/*,docs,dashboard}/{dist,umd,.next,.turbo,coverage}",
"clean:install": "pnpm clean:all && pnpm install",
"ci:version": "changeset version && pnpm install --frozen-lockfile false",
"coverage": "pnpm run test -- --coverage",
"prettier": "prettier --check .",