From d0631f0d7466574f5bfbe72a01a63245f97b961e Mon Sep 17 00:00:00 2001 From: sjaanus Date: Mon, 29 Aug 2022 12:25:11 +0000 Subject: [PATCH] Move e2e tests from frontend to backend .github (#1975) * Add e2e tests * Remove cypress key * Add project tag * Add cypress to root * Add cypress working directory and package.json in subfolder * Remove record flag * Add contains to url check * Test segment e2e test * Remove one of contains * Test e2e tests * Fix e2e * Test new yml * New yaml * Test different echo * Update workflows * Fix deployment url * Fix formatting --- .editorconfig | 2 +- .../.github => .github}/workflows/e2e.feature.yml | 10 +++++----- {frontend/.github => .github}/workflows/e2e.groups.yml | 10 +++++----- .../workflows/e2e.project-access.yml | 10 +++++----- .../.github => .github}/workflows/e2e.segments.yml | 10 +++++----- 5 files changed, 21 insertions(+), 21 deletions(-) rename {frontend/.github => .github}/workflows/e2e.feature.yml (73%) rename {frontend/.github => .github}/workflows/e2e.groups.yml (73%) rename {frontend/.github => .github}/workflows/e2e.project-access.yml (73%) rename {frontend/.github => .github}/workflows/e2e.segments.yml (73%) diff --git a/.editorconfig b/.editorconfig index 0a800d5b07..25aac1ac69 100644 --- a/.editorconfig +++ b/.editorconfig @@ -15,5 +15,5 @@ trim_trailing_whitespace = false [*.json] indent_size = 2 -[*.yaml] +[*.{yaml,yml}] indent_size = 2 diff --git a/frontend/.github/workflows/e2e.feature.yml b/.github/workflows/e2e.feature.yml similarity index 73% rename from frontend/.github/workflows/e2e.feature.yml rename to .github/workflows/e2e.feature.yml index ad89346f22..ec3bec3702 100644 --- a/frontend/.github/workflows/e2e.feature.yml +++ b/.github/workflows/e2e.feature.yml @@ -1,10 +1,10 @@ name: e2e:feature # https://docs.github.com/en/actions/reference/events-that-trigger-workflows -on: [deployment_status] +on: [ deployment_status ] jobs: e2e: # only runs this job on successful deploy - if: github.event_name == 'deployment_status' && github.event.deployment_status.state == 'success' + if: github.event_name == 'deployment_status' && github.event.deployment_status.state == 'success' && contains(github.event.deployment_status.target_url, 'unleash-monorepo-frontend') runs-on: ubuntu-latest steps: - name: Dump GitHub context @@ -14,12 +14,12 @@ jobs: echo "$GITHUB_CONTEXT" - name: Checkout uses: actions/checkout@v3 + - name: Install root dependencies + uses: bahmutov/npm-install@v1 - name: Run Cypress uses: cypress-io/github-action@v2 with: + working-directory: frontend env: AUTH_USER=admin,AUTH_PASSWORD=unleash4all config: baseUrl=${{ github.event.deployment_status.target_url }} - record: true spec: cypress/integration/feature/feature.spec.ts - env: - CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }} diff --git a/frontend/.github/workflows/e2e.groups.yml b/.github/workflows/e2e.groups.yml similarity index 73% rename from frontend/.github/workflows/e2e.groups.yml rename to .github/workflows/e2e.groups.yml index 7eb5e056e6..3211c148e2 100644 --- a/frontend/.github/workflows/e2e.groups.yml +++ b/.github/workflows/e2e.groups.yml @@ -1,10 +1,10 @@ name: e2e:groups # https://docs.github.com/en/actions/reference/events-that-trigger-workflows -on: [deployment_status] +on: [ deployment_status ] jobs: e2e: # only runs this job on successful deploy - if: github.event_name == 'deployment_status' && github.event.deployment_status.state == 'success' + if: github.event_name == 'deployment_status' && github.event.deployment_status.state == 'success' && contains(github.event.deployment_status.target_url, 'unleash-monorepo-frontend') runs-on: ubuntu-latest steps: - name: Dump GitHub context @@ -14,12 +14,12 @@ jobs: echo "$GITHUB_CONTEXT" - name: Checkout uses: actions/checkout@v3 + - name: Install root dependencies + uses: bahmutov/npm-install@v1 - name: Run Cypress uses: cypress-io/github-action@v2 with: + working-directory: frontend env: AUTH_USER=admin,AUTH_PASSWORD=unleash4all config: baseUrl=${{ github.event.deployment_status.target_url }} - record: true spec: cypress/integration/groups/groups.spec.ts - env: - CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }} diff --git a/frontend/.github/workflows/e2e.project-access.yml b/.github/workflows/e2e.project-access.yml similarity index 73% rename from frontend/.github/workflows/e2e.project-access.yml rename to .github/workflows/e2e.project-access.yml index f2dfff64df..182714d962 100644 --- a/frontend/.github/workflows/e2e.project-access.yml +++ b/.github/workflows/e2e.project-access.yml @@ -1,10 +1,10 @@ name: e2e:project-access # https://docs.github.com/en/actions/reference/events-that-trigger-workflows -on: [deployment_status] +on: [ deployment_status ] jobs: e2e: # only runs this job on successful deploy - if: github.event_name == 'deployment_status' && github.event.deployment_status.state == 'success' + if: github.event_name == 'deployment_status' && github.event.deployment_status.state == 'success' && contains(github.event.deployment_status.target_url, 'unleash-monorepo-frontend') runs-on: ubuntu-latest steps: - name: Dump GitHub context @@ -14,12 +14,12 @@ jobs: echo "$GITHUB_CONTEXT" - name: Checkout uses: actions/checkout@v3 + - name: Install root dependencies + uses: bahmutov/npm-install@v1 - name: Run Cypress uses: cypress-io/github-action@v2 with: + working-directory: frontend env: AUTH_USER=admin,AUTH_PASSWORD=unleash4all config: baseUrl=${{ github.event.deployment_status.target_url }} - record: true spec: cypress/integration/projects/access/project-access.spec.ts - env: - CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }} diff --git a/frontend/.github/workflows/e2e.segments.yml b/.github/workflows/e2e.segments.yml similarity index 73% rename from frontend/.github/workflows/e2e.segments.yml rename to .github/workflows/e2e.segments.yml index b8111b2e32..e246caf3fb 100644 --- a/frontend/.github/workflows/e2e.segments.yml +++ b/.github/workflows/e2e.segments.yml @@ -1,10 +1,10 @@ name: e2e:segments # https://docs.github.com/en/actions/reference/events-that-trigger-workflows -on: [deployment_status] +on: [ deployment_status ] jobs: e2e: # only runs this job on successful deploy - if: github.event_name == 'deployment_status' && github.event.deployment_status.state == 'success' + if: github.event_name == 'deployment_status' && github.event.deployment_status.state == 'success' && contains(github.event.deployment_status.target_url, 'unleash-monorepo-frontend') runs-on: ubuntu-latest steps: - name: Dump GitHub context @@ -14,12 +14,12 @@ jobs: echo "$GITHUB_CONTEXT" - name: Checkout uses: actions/checkout@v3 + - name: Install root dependencies + uses: bahmutov/npm-install@v1 - name: Run Cypress uses: cypress-io/github-action@v2 with: + working-directory: frontend env: AUTH_USER=admin,AUTH_PASSWORD=unleash4all config: baseUrl=${{ github.event.deployment_status.target_url }} - record: true spec: cypress/integration/segments/segments.spec.ts - env: - CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}