From b0b3d63417b28c09e00fe813d260b6069fb390a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CJamesHenry=E2=80=9D?= Date: Mon, 20 Feb 2023 13:14:51 +0400 Subject: [PATCH 1/3] chore: run website tests against netlify deployment --- .github/workflows/ci.yml | 18 +++++++++++++++--- packages/website/playwright.config.ts | 14 ++++++++------ 2 files changed, 23 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4eed32afb742..9b891e1daee6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -179,6 +179,9 @@ jobs: contents: read # to fetch code (actions/checkout) name: Website tests + # We technically do not need to wait for build within the pipeline any more because the build we care about is happening within Netlify, however, + # it is highly likely that if the CI one fails, the Netlify one will as well, so in order to not waste unncessary Github Actions minutes/resources, + # we do still keep this requirement here. needs: [build] runs-on: ubuntu-latest steps: @@ -186,19 +189,28 @@ jobs: uses: actions/checkout@v3 with: fetch-depth: 2 + - name: Install uses: ./.github/actions/prepare-install with: node-version: ${{ env.PRIMARY_NODE_VERSION }} - - name: Build - uses: ./.github/actions/prepare-build - name: Install Playwright Browsers run: npx playwright install --with-deps - - name: Run Playwright tests + - name: Wait for Netlify deployment + uses: probablyup/wait-for-netlify-action@3.2.0 + id: waitForDeployment + with: + site_id: '128d21c7-b2fe-45ad-b141-9878fcf5de3a' + env: + NETLIFY_TOKEN: ${{ secrets.NETLIFY_TOKEN }} + + - name: Run Playwright tests against the Netlify deployment run: yarn playwright test --reporter=list working-directory: packages/website + env: + PLAYWRIGHT_TEST_BASE_URL: ${{ steps.waitForDeployment.outputs.url }} - if: always() uses: actions/upload-artifact@v3 diff --git a/packages/website/playwright.config.ts b/packages/website/playwright.config.ts index ad85c7391d99..5d3f84bc757d 100644 --- a/packages/website/playwright.config.ts +++ b/packages/website/playwright.config.ts @@ -8,7 +8,7 @@ const config: PlaywrightTestConfig = { retries: 0, testDir: './tests', use: { - baseURL: 'http://localhost:3000', + baseURL: process.env.PLAYWRIGHT_TEST_BASE_URL || 'http://localhost:3000', trace: 'on-first-retry', }, projects: [ @@ -19,11 +19,13 @@ const config: PlaywrightTestConfig = { }, }, ], - webServer: { - command: 'yarn start', - port: 3000, - reuseExistingServer: !process.env.CI, - }, + webServer: process.env.PLAYWRIGHT_TEST_BASE_URL + ? undefined + : { + command: 'yarn start', + port: 3000, + reuseExistingServer: !process.env.CI, + }, workers: process.env.CI ? 1 : undefined, }; From 517f75ba1746226df842926424308a5f992d786f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CJamesHenry=E2=80=9D?= Date: Mon, 20 Feb 2023 13:46:38 +0400 Subject: [PATCH 2/3] chore: remove dev only error message --- packages/website/tests/index.spec.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/packages/website/tests/index.spec.ts b/packages/website/tests/index.spec.ts index e0a99f3d12cc..77d6c73cda27 100644 --- a/packages/website/tests/index.spec.ts +++ b/packages/website/tests/index.spec.ts @@ -15,8 +15,6 @@ test.describe('Website', () => { } }); await page.goto('/'); - expect(errorMessages).toStrictEqual([ - "[error] Warning: ReactDOM.render is no longer supported in React 18. Use createRoot instead. Until you switch to the new API, your app will behave as if it's running React 17. Learn more: https://reactjs.org/link/switch-to-createroot", - ]); + expect(errorMessages).toStrictEqual([]); }); }); From 4d2544f02b8f82f17e0f7754f827c7e1d0cc4d3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CJamesHenry=E2=80=9D?= Date: Mon, 20 Feb 2023 13:53:47 +0400 Subject: [PATCH 3/3] chore: resolve lint error --- packages/website/playwright.config.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/website/playwright.config.ts b/packages/website/playwright.config.ts index 5d3f84bc757d..fa403223152b 100644 --- a/packages/website/playwright.config.ts +++ b/packages/website/playwright.config.ts @@ -8,7 +8,7 @@ const config: PlaywrightTestConfig = { retries: 0, testDir: './tests', use: { - baseURL: process.env.PLAYWRIGHT_TEST_BASE_URL || 'http://localhost:3000', + baseURL: process.env.PLAYWRIGHT_TEST_BASE_URL ?? 'http://localhost:3000', trace: 'on-first-retry', }, projects: [