From 10f232d1c1a6b9e91a3a1ff5a831de988f8c6921 Mon Sep 17 00:00:00 2001 From: Adam Joseph Arling Date: Fri, 29 Mar 2024 12:17:19 -0500 Subject: [PATCH] Try wait-on package to get tests to run in Github workflow --- .github/workflows/playwright.yml | 9 ++-- package-lock.json | 71 +++++++++++++++++++++++++++++++- package.json | 3 +- 3 files changed, 78 insertions(+), 5 deletions(-) diff --git a/.github/workflows/playwright.yml b/.github/workflows/playwright.yml index 2c61fc0e..df0ef317 100644 --- a/.github/workflows/playwright.yml +++ b/.github/workflows/playwright.yml @@ -15,8 +15,6 @@ jobs: node-version: 18 - name: Install dependencies run: npm ci - env: - BASE_URL: ${{ secrets.BASE_URL }} - name: Install Playwright Browsers run: npx playwright install --with-deps @@ -25,10 +23,15 @@ jobs: run: npm run build - name: Start app - run: npm run start + run: npm run start & + + - name: Wait for server + run: npx wait-on http://localhost:3000 - name: Run Playwright tests run: npx playwright test + env: + BASE_URL: ${{ secrets.BASE_URL }} - uses: actions/upload-artifact@v3 if: always() diff --git a/package-lock.json b/package-lock.json index 6954216f..21b77caa 100644 --- a/package-lock.json +++ b/package-lock.json @@ -66,7 +66,8 @@ "next-router-mock": "^0.9.1-beta.0", "prettier": "^3.0.1", "ts-jest": "^29.0.5", - "typescript": "^5.4.2" + "typescript": "^5.4.2", + "wait-on": "^7.2.0" }, "optionalDependencies": { "fsevents": "^2.3.2" @@ -863,6 +864,21 @@ "resolved": "https://registry.npmjs.org/@floating-ui/utils/-/utils-0.2.1.tgz", "integrity": "sha512-9TANp6GPoMtYzQdt54kfAyMmz1+osLlXdg2ENroU7zzrtflTLrrC/lgrIfaSe+Wu0b89GKccT7vxXA0MoAIO+Q==" }, + "node_modules/@hapi/hoek": { + "version": "9.3.0", + "resolved": "https://registry.npmjs.org/@hapi/hoek/-/hoek-9.3.0.tgz", + "integrity": "sha512-/c6rf4UJlmHlC9b5BaNvzAcFv7HZ2QHaV0D4/HNlBdvFnvQq8RI4kYdhyPCl7Xj+oWvTWQ8ujhqS53LIgAe6KQ==", + "dev": true + }, + "node_modules/@hapi/topo": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/@hapi/topo/-/topo-5.1.0.tgz", + "integrity": "sha512-foQZKJig7Ob0BMAYBfcJk8d77QtOe7Wo4ox7ff1lQYoNNAb6jwcY1ncdoy2e9wQZzvNy7ODZCYJkK8kzmcAnAg==", + "dev": true, + "dependencies": { + "@hapi/hoek": "^9.0.0" + } + }, "node_modules/@honeybadger-io/core": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/@honeybadger-io/core/-/core-5.2.0.tgz", @@ -3498,6 +3514,27 @@ "react-dom": "^16.13.1 || ^17 || ^18" } }, + "node_modules/@sideway/address": { + "version": "4.1.5", + "resolved": "https://registry.npmjs.org/@sideway/address/-/address-4.1.5.tgz", + "integrity": "sha512-IqO/DUQHUkPeixNQ8n0JA6102hT9CmaljNTPmQ1u8MEhBo/R4Q8eKLN/vGZxuebwOroDB4cbpjheD4+/sKFK4Q==", + "dev": true, + "dependencies": { + "@hapi/hoek": "^9.0.0" + } + }, + "node_modules/@sideway/formula": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@sideway/formula/-/formula-3.0.1.tgz", + "integrity": "sha512-/poHZJJVjx3L+zVD6g9KgHfYnb443oi7wLu/XKojDviHy6HOEOA6z1Trk5aR1dGcmPenJEgb2sK2I80LeS3MIg==", + "dev": true + }, + "node_modules/@sideway/pinpoint": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@sideway/pinpoint/-/pinpoint-2.0.0.tgz", + "integrity": "sha512-RNiOoTPkptFtSVzQevY/yWtZwf/RxyVnPy/OcA9HBM3MlGDnBEYL5B41H0MTn0Uec8Hi+2qUtTfG2WWZBmMejQ==", + "dev": true + }, "node_modules/@sinclair/typebox": { "version": "0.27.8", "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.27.8.tgz", @@ -11444,6 +11481,19 @@ "url": "https://github.com/chalk/supports-color?sponsor=1" } }, + "node_modules/joi": { + "version": "17.12.2", + "resolved": "https://registry.npmjs.org/joi/-/joi-17.12.2.tgz", + "integrity": "sha512-RonXAIzCiHLc8ss3Ibuz45u28GOsWE1UpfDXLbN/9NKbL4tCJf8TWYVKsoYuuh+sAUt7fsSNpA+r2+TBA6Wjmw==", + "dev": true, + "dependencies": { + "@hapi/hoek": "^9.3.0", + "@hapi/topo": "^5.1.0", + "@sideway/address": "^4.1.5", + "@sideway/formula": "^3.0.1", + "@sideway/pinpoint": "^2.0.0" + } + }, "node_modules/js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", @@ -15123,6 +15173,25 @@ "node": ">=14" } }, + "node_modules/wait-on": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/wait-on/-/wait-on-7.2.0.tgz", + "integrity": "sha512-wCQcHkRazgjG5XoAq9jbTMLpNIjoSlZslrJ2+N9MxDsGEv1HnFoVjOCexL0ESva7Y9cu350j+DWADdk54s4AFQ==", + "dev": true, + "dependencies": { + "axios": "^1.6.1", + "joi": "^17.11.0", + "lodash": "^4.17.21", + "minimist": "^1.2.8", + "rxjs": "^7.8.1" + }, + "bin": { + "wait-on": "bin/wait-on" + }, + "engines": { + "node": ">=12.0.0" + } + }, "node_modules/walker": { "version": "1.0.8", "resolved": "https://registry.npmjs.org/walker/-/walker-1.0.8.tgz", diff --git a/package.json b/package.json index 33f52ac6..0d450d19 100644 --- a/package.json +++ b/package.json @@ -79,7 +79,8 @@ "next-router-mock": "^0.9.1-beta.0", "prettier": "^3.0.1", "ts-jest": "^29.0.5", - "typescript": "^5.4.2" + "typescript": "^5.4.2", + "wait-on": "^7.2.0" }, "optionalDependencies": { "fsevents": "^2.3.2"