diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index 8102448..0ef8173 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -1,6 +1,9 @@ name: E2E Tests on: + push: + branches: + - develop workflow_dispatch: jobs: @@ -31,10 +34,8 @@ jobs: node-version: '20.10.0' - name: Install Dependencies run: npm ci - - name: Install Playwright Deps - run: npx playwright install-deps chrome webkit - - name: Install Playwright Browsers - run: npx playwright install chrome webkit + - name: Install Playwright + run: npx playwright install --with-deps - name: Run Tests run: npm test env: @@ -42,11 +43,12 @@ jobs: SERVER_NAME: localhost HOST_NAME: localhost UPSTREAM_API_HOST: api - SSL_CERT_PATH: /etc/ci/file.pem - SSL_KEY_PATH: /etc/ci/file.key - BM_SESSION_STORE: memory - BM_COOKIE_SECURE: false - BM_COOKIE_SAMESITE: lax + SSL_CERT_PATH: /etc/nginx/certs/busmap.localhost.pem + SSL_KEY_PATH: /etc/nginx/certs/busmap.localhost-key.pem + BM_REDIS_HOST: redis://session + BM_SESSION_STORE: redis + BM_COOKIE_SECURE: true + BM_COOKIE_SAMESITE: strict BM_COOKIE_SECRET: ${{ secrets.BM_COOKIE_SECRET }} BM_POSTGRES_PASSWORD: ${{ secrets.BM_POSTGRES_PASSWORD }} BM_POSTGRES_USER: ${{ secrets.BM_POSTGRES_USER }} diff --git a/packages/api/src/index.ts b/packages/api/src/index.ts index dd86b35..44cb33f 100644 --- a/packages/api/src/index.ts +++ b/packages/api/src/index.ts @@ -47,8 +47,8 @@ if (env.BM_SESSION_STORE === 'redis') { url: env.BM_REDIS_HOST, socket: { reconnectStrategy(retries, cause) { - if (/ENOTFOUND/i.test(cause.message) && retries > 3) { - logger.warn('Redis host not found, done reconnecting.') + if (/ENOTFOUND|ECONNREFUSED/i.test(cause.message) && retries > 3) { + logger.warn('Redis host not found or accepting connections, done reconnecting.') return false } diff --git a/playwright.config.ts b/playwright.config.ts index ce45eb9..a1c3c4e 100644 --- a/playwright.config.ts +++ b/playwright.config.ts @@ -40,25 +40,16 @@ export default defineConfig({ { name: 'webkit', use: { ...devices['Desktop Safari'] } - }, - - /* Test against mobile viewports. */ - { - name: 'Mobile Chrome', - use: { ...devices['Pixel 5'] } - }, - { - name: 'Mobile Safari', - use: { ...devices['iPhone 12'] } } ], /* Run your local dev server before starting the tests */ webServer: { - command: 'docker compose up --attach-dependencies dev', - url: 'http://localhost:3000/health', + command: 'docker compose -f compose.yaml up --attach-dependencies stage', + ignoreHTTPSErrors: true, + url: 'https://localhost/healthcheck', reuseExistingServer: !process.env.CI, - timeout: 60_000 * 7, + timeout: 60_000 * 3, stdout: 'pipe' } })