Merge pull request #3 from muratkeremozcan/test/latest-tutorial

added group property
This commit is contained in:
Murat K Ozcan 2022-05-11 08:10:29 -05:00 committed by GitHub
commit 2ca74a141d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 16 deletions

View File

@ -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 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: jobs:
install: e2e:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout - name: Checkout
@ -17,9 +17,9 @@ jobs:
uses: cypress-io/github-action@v3.0.4 uses: cypress-io/github-action@v3.0.4
with: with:
browser: chrome browser: chrome
start: yarn dev
config-file: cypress/config/dev.json config-file: cypress/config/dev.json
record: true record: true
group: deployment
env: env:
COMMERCE_PROVIDER: ${{ secrets.COMMERCE_PROVIDER }} COMMERCE_PROVIDER: ${{ secrets.COMMERCE_PROVIDER }}
NEXT_PUBLIC_SHOPIFY_STORE_DOMAIN: ${{ secrets.NEXT_PUBLIC_SHOPIFY_STORE_DOMAIN }} NEXT_PUBLIC_SHOPIFY_STORE_DOMAIN: ${{ secrets.NEXT_PUBLIC_SHOPIFY_STORE_DOMAIN }}

View File

@ -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 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: jobs:
install: e2e:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout - name: Checkout
@ -21,6 +21,7 @@ jobs:
wait-on: 'http://localhost:3000' wait-on: 'http://localhost:3000'
wait-on-timeout: 120000 wait-on-timeout: 120000
record: true record: true
group: local
env: env:
COMMERCE_PROVIDER: ${{ secrets.COMMERCE_PROVIDER }} COMMERCE_PROVIDER: ${{ secrets.COMMERCE_PROVIDER }}
NEXT_PUBLIC_SHOPIFY_STORE_DOMAIN: ${{ secrets.NEXT_PUBLIC_SHOPIFY_STORE_DOMAIN }} NEXT_PUBLIC_SHOPIFY_STORE_DOMAIN: ${{ secrets.NEXT_PUBLIC_SHOPIFY_STORE_DOMAIN }}

View File

@ -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: 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. We test the new scripts.
```bash ```bash
# on one tab # on one tab
yarn dev yarn dev
@ -61,6 +62,8 @@ In contrast, after the feature branch is merged, we want to execute e2e tests ag
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`: `main.yml`:
```yml ```yml
@ -70,7 +73,7 @@ on:
pull_request: pull_request:
jobs: jobs:
install: e2e:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout - name: Checkout
@ -86,6 +89,7 @@ jobs:
wait-on: 'http://localhost:3000' wait-on: 'http://localhost:3000'
wait-on-timeout: 120000 wait-on-timeout: 120000
record: true record: true
group: local
env: env:
COMMERCE_PROVIDER: ${{ secrets.COMMERCE_PROVIDER }} COMMERCE_PROVIDER: ${{ secrets.COMMERCE_PROVIDER }}
NEXT_PUBLIC_SHOPIFY_STORE_DOMAIN: ${{ secrets.NEXT_PUBLIC_SHOPIFY_STORE_DOMAIN }} NEXT_PUBLIC_SHOPIFY_STORE_DOMAIN: ${{ secrets.NEXT_PUBLIC_SHOPIFY_STORE_DOMAIN }}
@ -93,7 +97,6 @@ jobs:
NEXT_PUBLIC_COMMERCE_SEARCH_ENABLED: true NEXT_PUBLIC_COMMERCE_SEARCH_ENABLED: true
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }} CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 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. 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'] branches: ['main']
jobs: jobs:
install: e2e:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout - name: Checkout
@ -121,6 +124,7 @@ jobs:
browser: chrome browser: chrome
record: true record: true
config-file: cypress/config/dev.json config-file: cypress/config/dev.json
group: deployment
env: env:
COMMERCE_PROVIDER: ${{ secrets.COMMERCE_PROVIDER }} COMMERCE_PROVIDER: ${{ secrets.COMMERCE_PROVIDER }}
NEXT_PUBLIC_SHOPIFY_STORE_DOMAIN: ${{ secrets.NEXT_PUBLIC_SHOPIFY_STORE_DOMAIN }} NEXT_PUBLIC_SHOPIFY_STORE_DOMAIN: ${{ secrets.NEXT_PUBLIC_SHOPIFY_STORE_DOMAIN }}
@ -129,12 +133,6 @@ jobs:
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }} CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
# pass GitHub token to allow accurately detecting a build vs a re-run build # pass GitHub token to allow accurately detecting a build vs a re-run build
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 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