From 4454a525acfe0c7cd53428763c442dd11da9b186 Mon Sep 17 00:00:00 2001 From: Murat Ozcan Date: Wed, 11 May 2022 08:09:47 -0500 Subject: [PATCH] added group property --- .github/workflows/deployment.yml | 4 ++-- .github/workflows/main.yml | 3 ++- site/comments.md | 24 +++++++++++------------- 3 files changed, 15 insertions(+), 16 deletions(-) diff --git a/.github/workflows/deployment.yml b/.github/workflows/deployment.yml index d9401063c..fa0493b86 100644 --- a/.github/workflows/deployment.yml +++ b/.github/workflows/deployment.yml @@ -6,7 +6,7 @@ on: workflow_dispatch: # to test out if GITHUB_TOKEN env var can be a solution for rerunning CI and having it re-record on Cypress Dashboard jobs: - install: + e2e: runs-on: ubuntu-latest steps: - name: Checkout @@ -17,9 +17,9 @@ jobs: uses: cypress-io/github-action@v3.0.4 with: browser: chrome - start: yarn dev config-file: cypress/config/dev.json record: true + group: deployment env: COMMERCE_PROVIDER: ${{ secrets.COMMERCE_PROVIDER }} NEXT_PUBLIC_SHOPIFY_STORE_DOMAIN: ${{ secrets.NEXT_PUBLIC_SHOPIFY_STORE_DOMAIN }} diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 5918e0c37..258648492 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -5,7 +5,7 @@ on: workflow_dispatch: # to test out if GITHUB_TOKEN env var can be a solution for rerunning CI and having it re-record on Cypress Dashboard jobs: - install: + e2e: runs-on: ubuntu-latest steps: - name: Checkout @@ -21,6 +21,7 @@ jobs: wait-on: 'http://localhost:3000' wait-on-timeout: 120000 record: true + group: local env: COMMERCE_PROVIDER: ${{ secrets.COMMERCE_PROVIDER }} NEXT_PUBLIC_SHOPIFY_STORE_DOMAIN: ${{ secrets.NEXT_PUBLIC_SHOPIFY_STORE_DOMAIN }} diff --git a/site/comments.md b/site/comments.md index 1e9215b81..44c522b54 100644 --- a/site/comments.md +++ b/site/comments.md @@ -24,7 +24,7 @@ Create a config folder and two json files `cypress/config/local.json`, `cypress/ } ``` -(How I wish we could *extend* the base `cypress.json`, because unfortunately Gleb's `cypress-extends` plugin clashes with other plugins like `cypress-grep`) +(How I wish we could _extend_ the base `cypress.json`, because unfortunately Gleb's `cypress-extends` plugin clashes with other plugins like `cypress-grep`) We slightly modify our `package.json` scripts to use the respective config files: @@ -43,6 +43,7 @@ We slightly modify our `package.json` scripts to use the respective config files ``` We test the new scripts. + ```bash # on one tab yarn dev @@ -55,11 +56,13 @@ yarn cy:open-dev ## Enhancing the CI pipeline architecture -We want local deployments to execute against the app being locally served. +We want local deployments to execute against the app being locally served. In contrast, after the feature branch is merged, we want to execute e2e tests against the deployment. -For the app being locally served, in Github Actions, we can accomplish this task by using `pull_request` vs `push`. We also need to specify the config file we are using. +For the app being locally served, in Github Actions, we can accomplish this task by using `pull_request` vs `push`. We also need to specify the config file we are using. + +> We will also add a group property to make things a bit more clear on the Cypress Dashboard. `main.yml`: @@ -70,7 +73,7 @@ on: pull_request: jobs: - install: + e2e: runs-on: ubuntu-latest steps: - name: Checkout @@ -86,6 +89,7 @@ jobs: wait-on: 'http://localhost:3000' wait-on-timeout: 120000 record: true + group: local env: COMMERCE_PROVIDER: ${{ secrets.COMMERCE_PROVIDER }} NEXT_PUBLIC_SHOPIFY_STORE_DOMAIN: ${{ secrets.NEXT_PUBLIC_SHOPIFY_STORE_DOMAIN }} @@ -93,7 +97,6 @@ jobs: NEXT_PUBLIC_COMMERCE_SEARCH_ENABLED: true CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - ``` For the deployment test, we need a new yml file, using `push`, and it will have slightly different settings so that it only runs on the `main` branch. @@ -109,7 +112,7 @@ on: branches: ['main'] jobs: - install: + e2e: runs-on: ubuntu-latest steps: - name: Checkout @@ -121,6 +124,7 @@ jobs: browser: chrome record: true config-file: cypress/config/dev.json + group: deployment env: COMMERCE_PROVIDER: ${{ secrets.COMMERCE_PROVIDER }} NEXT_PUBLIC_SHOPIFY_STORE_DOMAIN: ${{ secrets.NEXT_PUBLIC_SHOPIFY_STORE_DOMAIN }} @@ -129,12 +133,6 @@ jobs: CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }} # pass GitHub token to allow accurately detecting a build vs a re-run build GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - ``` - - - - - - +After the feature branch push, we can observe the tests running against the locally served app as usual. And after the merge, we can obj