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
96 changes: 95 additions & 1 deletion .github/workflows/check-store.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -240,4 +240,98 @@ jobs:

- uses: graycoreio/github-actions-magento2/smoke-test@main
with:
kind: graphql
kind: graphql

e2e-test:
runs-on: ${{ matrix.os }}
needs: compute_matrix
services: ${{ matrix.services }}
strategy:
matrix: ${{ fromJSON(needs.compute_matrix.outputs.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
with:
composer_cache_key: ${{ inputs.composer_cache_key }}
working-directory: ${{ steps.setup-magento.outputs.path }}
stamp: ${{ inputs.stamp }}

- name: Composer install
working-directory: ${{ steps.setup-magento.outputs.path }}
run: composer install
env:
COMPOSER_AUTH: ${{ secrets.composer_auth }}

- uses: graycoreio/github-actions-magento2/setup-install@main
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: Install Magento sample data
if: steps.detect-e2e.outputs.enabled == 'true'
working-directory: ${{ steps.setup-magento.outputs.path }}
run: |
bin/magento sampledata:deploy
composer update
bin/magento setup:upgrade
bin/magento indexer:reindex

- name: Install MageOS E2E suite
working-directory: ${{ steps.setup-magento.outputs.path }}
run: |
mkdir -p dev/tests
git clone \
--branch ci/tests-e2e-playwright-elgentos-hyva \
https://github.com/digitalrisedorset/mageos-magento2.git \
dev/tests/e2e

- name: Run E2E tests
working-directory: ${{ steps.setup-magento.outputs.path }}/dev/tests/e2e
run: |
npm ci
npx playwright test
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");