-
Notifications
You must be signed in to change notification settings - Fork 16
feat!: add generic e2e support to check-store workflow #279
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
452136e
58c5a12
96a0820
d90c0bf
608201f
7b3c493
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -240,4 +240,85 @@ jobs: | |
|
|
||
| - uses: graycoreio/github-actions-magento2/smoke-test@main | ||
| with: | ||
| kind: graphql | ||
| kind: graphql | ||
|
|
||
| e2e-test: | ||
| runs-on: ${{ matrix.os }} | ||
| needs: compute_matrix | ||
| if: ${{ fromJSON(needs.compute_matrix.outputs.resolved)['e2e-test'].enabled != false }} | ||
| services: ${{ matrix.services }} | ||
| strategy: | ||
| matrix: ${{ fromJSON(needs.compute_matrix.outputs.resolved)['e2e-test'].matrix }} | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v6 | ||
| if: inputs.store_artifact_name == '' | ||
|
|
||
| - uses: actions/download-artifact@v8 | ||
| if: inputs.store_artifact_name != '' | ||
| with: | ||
| name: ${{ inputs.store_artifact_name }} | ||
| path: ${{ inputs.path }} | ||
|
|
||
| - uses: graycoreio/github-actions-magento2/setup-magento@main | ||
| id: setup-magento | ||
| with: | ||
| php-version: ${{ matrix.php }} | ||
| tools: composer:v${{ matrix.composer }} | ||
| mode: store | ||
| working-directory: ${{ inputs.path }} | ||
| composer_auth: ${{ secrets.composer_auth }} | ||
|
|
||
| - name: Detect E2E npm contract | ||
| id: detect-e2e | ||
| working-directory: ${{ steps.setup-magento.outputs.path }} | ||
| run: | | ||
| if [ -d dev/tests/e2e ] \ | ||
| && [ "$(find dev/tests/e2e -type f | wc -l)" -gt 0 ] \ | ||
| && [ -f package.json ]; then | ||
| echo "enabled=true" >> "$GITHUB_OUTPUT" | ||
| else | ||
| echo "enabled=false" >> "$GITHUB_OUTPUT" | ||
| echo "::notice::No package.json found, skipping E2E" | ||
| fi | ||
|
|
||
| - uses: graycoreio/github-actions-magento2/cache-magento@main | ||
| if: steps.detect-e2e.outputs.enabled == 'true' | ||
| with: | ||
| composer_cache_key: ${{ inputs.composer_cache_key }} | ||
| working-directory: ${{ steps.setup-magento.outputs.path }} | ||
| stamp: ${{ inputs.stamp }} | ||
|
|
||
| - name: Composer install | ||
| if: steps.detect-e2e.outputs.enabled == 'true' | ||
| working-directory: ${{ steps.setup-magento.outputs.path }} | ||
| run: composer install | ||
| env: | ||
| COMPOSER_AUTH: ${{ secrets.composer_auth }} | ||
|
|
||
| - uses: graycoreio/github-actions-magento2/setup-install@main | ||
| if: steps.detect-e2e.outputs.enabled == 'true' | ||
| id: setup-install | ||
| with: | ||
| services: ${{ toJSON(matrix.services) }} | ||
| path: ${{ steps.setup-magento.outputs.path }} | ||
| container_id: ${{ job.services['php-fpm'].id }} | ||
| extra_args: --magento-init-params=MAGE_MODE=developer | ||
|
|
||
| - uses: graycoreio/github-actions-magento2/configure-service-nginx@main | ||
| if: steps.detect-e2e.outputs.enabled == 'true' | ||
| with: | ||
| container_id: ${{ job.services.nginx.id }} | ||
| magento_path: ${{ inputs.path }} | ||
|
|
||
| - uses: actions/setup-node@v4 | ||
|
damienwebdev marked this conversation as resolved.
|
||
| if: steps.detect-e2e.outputs.enabled == 'true' | ||
| with: | ||
| cache: npm | ||
|
|
||
|
damienwebdev marked this conversation as resolved.
|
||
| - name: Run E2E tests | ||
| if: steps.detect-e2e.outputs.enabled == 'true' | ||
| working-directory: ${{ steps.setup-magento.outputs.path }} | ||
| run: | | ||
| npm ci | ||
| npm run test:e2e | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does test:e2e exist as a script in every Magento store with a dev/tests/e2e folder?
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This command exists so that we can executes the elgentos playwright test suite under dev/tests/e2e. I assume you are clear with this. I added it in package.json for CI to be able to trigger this test suite. Somehow, I unclear how e2e gets trigger without the command-line. I will follow your lead and will remove the code as per your suggestions, thanks |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| export const testItWorks = (): string => { | ||
| return "Hello world"; | ||
| }; | ||
|
|
||
| if (testItWorks() !== "Hello world") { | ||
|
damienwebdev marked this conversation as resolved.
|
||
| process.exit(1); | ||
| } | ||
|
|
||
| console.log("E2E test passed"); | ||
Uh oh!
There was an error while loading. Please reload this page.