diff --git a/.github/workflows/module-plugin-test.yml b/.github/workflows/module-plugin-test.yml index f1c7304..7ef8cd7 100644 --- a/.github/workflows/module-plugin-test.yml +++ b/.github/workflows/module-plugin-test.yml @@ -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: @@ -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 @@ -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 diff --git a/README.md b/README.md index dded76a..c80a35f 100644 --- a/README.md +++ b/README.md @@ -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.