Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
83 changes: 82 additions & 1 deletion .github/workflows/check-store.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Comment thread
damienwebdev marked this conversation as resolved.
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
Comment thread
damienwebdev marked this conversation as resolved.
if: steps.detect-e2e.outputs.enabled == 'true'
with:
cache: npm

Comment thread
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
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The 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?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The 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

9 changes: 9 additions & 0 deletions _test/demo-package/Test/E2E/ItWorksTest.ts
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") {
Comment thread
damienwebdev marked this conversation as resolved.
process.exit(1);
}

console.log("E2E test passed");