From 577aaaf9f2066f5d4f83ced1a1c5e6a1c2119014 Mon Sep 17 00:00:00 2001 From: Untone Date: Sun, 4 Feb 2024 16:39:26 +0300 Subject: [PATCH] e2e-test-github --- .gitea/workflows/main.yml | 36 ++++------------------------------- .github/workflows/node-ci.yml | 20 ++++++++++++++++++- tests/basic-routes.spec.ts | 2 +- 3 files changed, 24 insertions(+), 34 deletions(-) diff --git a/.gitea/workflows/main.yml b/.gitea/workflows/main.yml index 6a0b9341..528b5ac9 100644 --- a/.gitea/workflows/main.yml +++ b/.gitea/workflows/main.yml @@ -3,7 +3,7 @@ name: "deploy" on: [push] jobs: - Linting: + test: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -29,42 +29,14 @@ jobs: - name: Test production build run: npm run build - Playwright: - timeout-minutes: 60 - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 - with: - node-version: 18 - - name: Install dependencies - run: npm ci - - name: Install Playwright Browsers - run: npx playwright install --with-deps - - - name: Start Web Server - run: npm start > server.log 2>&1 & - - name: Web Server startup log - run: sleep 10 && cat server.log - - - - name: Run Playwright tests - run: npm run e2e - - uses: actions/upload-artifact@v3 - if: always() - with: - name: playwright-report - path: playwright-report/ - retention-days: 30 - - Github: - needs: test_with_playwright + push: + needs: test runs-on: ubuntu-latest steps: - name: Push changes uses: ad-m/github-push-action@master - Mailgun: + email-templates: runs-on: ubuntu-latest name: Update templates on Mailgun if: github.event_name == 'push' && github.ref == 'refs/heads/feature/email-templates' diff --git a/.github/workflows/node-ci.yml b/.github/workflows/node-ci.yml index c60516d1..4994c9b6 100644 --- a/.github/workflows/node-ci.yml +++ b/.github/workflows/node-ci.yml @@ -3,7 +3,7 @@ name: "deploy" on: [push] jobs: - Linting: + test: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -28,3 +28,21 @@ jobs: - name: Test production build run: npm run build + + e2e: + timeout-minutes: 60 + runs-on: ubuntu-latest + if: github.event.deployment_status.state == 'success' + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 18 + - name: Install dependencies + run: npm ci + - name: Install Playwright + run: npx playwright install --with-deps + - name: Run Playwright tests + run: npx playwright test + env: + BASE_URL: ${{ github.event.deployment_status.target_url }} diff --git a/tests/basic-routes.spec.ts b/tests/basic-routes.spec.ts index 3157458e..3b581ef5 100644 --- a/tests/basic-routes.spec.ts +++ b/tests/basic-routes.spec.ts @@ -1,6 +1,6 @@ import { expect, test } from '@playwright/test' -const baseHost = 'https://localhost:3000' +const baseHost = process.env.BASE_URL const pagesTitles = { '/': /Дискурс/,