Skip to content

Commit

Permalink
add inputs for cypress-cloud-tag, sync-npm-package, and `only-mod…
Browse files Browse the repository at this point in the history
…ule-tests` and accompanying conditional steps
  • Loading branch information
circlecube committed Dec 14, 2023
1 parent 5ac1670 commit 24028fb
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 11 deletions.
27 changes: 21 additions & 6 deletions .github/workflows/module-plugin-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,15 @@ on:
description: The branch of the module to be tested
type: string
required: true
secrets:
registry-token:
description: The registry token for installing packages
cypress-cloud-tag:
description: The tags to use for cypress cloud, if present the cloud test step will be used with inherited key
type: string
default: ''
required: false
sync-npm-package:
description: Flag to sync module files to equivalent node module
type: boolean
default: false
required: false
workflow_dispatch:
inputs:
Expand Down Expand Up @@ -169,9 +175,9 @@ jobs:
- name: NPM Install for Plugin
run: npm ci --legacy-peer-deps

# - name: Sync Module build files to node_modules dir
# if: ${{ steps.build.outputs.hasBuildCommand != 'false' }}
# run: rsync -r vendor/${{ inputs.module-repo }}/build node_modules/@${{ inputs.module-repo }}/build
- name: Sync Module build files to node_modules dir
if: ${{ inputs.sync-npm-package }} && ${{ steps.build.outputs.hasBuildCommand != 'false' }}
run: rsync -r vendor/${{ inputs.module-repo }}/build node_modules/@${{ inputs.module-repo }}/build

- name: Build Plugin
run: npm run build
Expand Down Expand Up @@ -205,8 +211,17 @@ jobs:
run: npx @wordpress/env@latest start

- name: Run Cypress Tests
if: ${{ inputs.cypress-cloud-tag == '' }}
run: npm run test:e2e -- --browser chrome

- name: Run Module Cypress Tests
if: ${{ inputs.cypress-cloud-tag == '' }} && ${{ inputs.only-module-tests }}
run: npm run test:e2e -- --browser chrome --spec "vendor/${{ inputs.plugin-repo }}/**/*"

- name: Run Cypress Cloud Tests
if: ${{ inputs.cypress-cloud-tag != '' }}
run: npm run test:e2e -- --browser chrome --record --key ${{ secrets.CYPRESS_RECORD_KEY }} --tag ${{ inputs.cypress-cloud-tag }}

- name: Store screenshots of test failures
if: failure()
uses: actions/upload-artifact@v3
Expand Down
6 changes: 1 addition & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,10 @@ jobs:


# Todos:
- Readme updates.
- Add to all `press-1` modules.
- Demo recording.
- Add other workflows for reusable use in plugins/modules to manage them in one central location.
- Add an optional step for when a js build is required (as is in the ecommerce module).
- Add a flag to signify the tests should be run in cypress cloud for easier debugging.

## Potential Todos/Ideas:
- Add other workflows for reusable use in plugins/modules to manage them in one central location.
- Add a flag to run for full matrix of WP versions.
- Add a flag to run for full matrix of PHP versions.
- Add a flag to only run this module's test vs all the plugin tests.
Expand Down

0 comments on commit 24028fb

Please sign in to comment.