From 452136e610f6da177abd0aad9bfeefa630f2240a Mon Sep 17 00:00:00 2001 From: Herve Tribouilloy Date: Tue, 19 May 2026 08:30:39 +0100 Subject: [PATCH 1/6] feat!: add generic e2e support to check-store workflow --- .github/workflows/check-store.yaml | 69 +++++++++++++++++++++- _test/demo-package/Test/E2E/ItWorksTest.ts | 9 +++ _test/demo-package/Test/E2E/tsconfig.json | 33 +++++++++++ package.json | 1 + 4 files changed, 111 insertions(+), 1 deletion(-) create mode 100644 _test/demo-package/Test/E2E/ItWorksTest.ts create mode 100644 _test/demo-package/Test/E2E/tsconfig.json diff --git a/.github/workflows/check-store.yaml b/.github/workflows/check-store.yaml index 21e8e74c..2b11572b 100644 --- a/.github/workflows/check-store.yaml +++ b/.github/workflows/check-store.yaml @@ -240,4 +240,71 @@ jobs: - uses: graycoreio/github-actions-magento2/smoke-test@main with: - kind: graphql \ No newline at end of file + 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 }} + + - 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 + with: + container_id: ${{ job.services.nginx.id }} + magento_path: ${{ inputs.path }} + + - uses: actions/setup-node@v4 + with: + node-version: 22 + cache: npm + + - name: Run E2E tests + working-directory: ${{ steps.setup-magento.outputs.path }} + run: | + if [ -f package.json ]; then + npm ci + npm run test:e2e + else + echo "No package.json found, skipping E2E" + fi \ No newline at end of file diff --git a/_test/demo-package/Test/E2E/ItWorksTest.ts b/_test/demo-package/Test/E2E/ItWorksTest.ts new file mode 100644 index 00000000..b8ca6624 --- /dev/null +++ b/_test/demo-package/Test/E2E/ItWorksTest.ts @@ -0,0 +1,9 @@ +export const testItWorks = (): string => { + return "Hello world"; +}; + +if (testItWorks() !== "Hello world") { + process.exit(1); +} + +console.log("E2E test passed"); \ No newline at end of file diff --git a/_test/demo-package/Test/E2E/tsconfig.json b/_test/demo-package/Test/E2E/tsconfig.json new file mode 100644 index 00000000..9becd5d6 --- /dev/null +++ b/_test/demo-package/Test/E2E/tsconfig.json @@ -0,0 +1,33 @@ +{ + "compilerOptions": { + "target": "es6", + "module": "commonjs", + "strict": true, + "esModuleInterop": true, + "allowSyntheticDefaultImports": true, + "resolveJsonModule": true, + "baseUrl": ".", + "paths": { + "@config": [ + "base-tests/config", + "tests/config", // keep this for gitlab and when index.ts needs to be changed. + ], + "@utils/*": [ + "base-tests/utils/*", + "tests/utils/*" + ], + "@poms/*": [ + "base-tests/poms/*", + "tests/poms/*" + ], + "@types/*": [ + "base-tests/types/*", + "tests/types/*" + ], + "@fixtures/*": [ + "base-tests/fixtures/*", + "tests/fixtures/*" + ] + } + } +} \ No newline at end of file diff --git a/package.json b/package.json index dc5df744..3291be78 100644 --- a/package.json +++ b/package.json @@ -4,6 +4,7 @@ "description": "Github Actions for Magento 2", "scripts": { "test": "cd supported-version && npm run test && cd - && cd setup-install && npm run test && cd -", + "test:e2e": "ts-node dev/tests/e2e/**/*.ts", "release": "standard-version" }, "private": true, From 58c5a1250e6df2c9bc8e175773b5383251d6ae41 Mon Sep 17 00:00:00 2001 From: Herve Tribouilloy Date: Tue, 19 May 2026 15:06:06 +0100 Subject: [PATCH 2/6] fix: refine generic e2e workflow orchestration --- .github/workflows/check-store.yaml | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/.github/workflows/check-store.yaml b/.github/workflows/check-store.yaml index 2b11572b..b7302c73 100644 --- a/.github/workflows/check-store.yaml +++ b/.github/workflows/check-store.yaml @@ -260,7 +260,19 @@ jobs: name: ${{ inputs.store_artifact_name }} path: ${{ inputs.path }} + - name: Detect E2E npm contract + id: detect-e2e + working-directory: ${{ inputs.path }} + run: | + if [ -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/setup-magento@main + if: steps.detect-e2e.outputs.enabled == 'true' id: setup-magento with: php-version: ${{ matrix.php }} @@ -270,6 +282,7 @@ jobs: composer_auth: ${{ secrets.composer_auth }} - 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 }} @@ -282,6 +295,7 @@ jobs: 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) }} @@ -290,21 +304,18 @@ jobs: 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 with: - node-version: 22 cache: npm - name: Run E2E tests + if: steps.detect-e2e.outputs.enabled == 'true' working-directory: ${{ steps.setup-magento.outputs.path }} run: | - if [ -f package.json ]; then - npm ci - npm run test:e2e - else - echo "No package.json found, skipping E2E" - fi \ No newline at end of file + npm ci + npm run test:e2e \ No newline at end of file From 96a08206cda75e16afaacf5b0e24c59c88adc650 Mon Sep 17 00:00:00 2001 From: Herve Tribouilloy Date: Tue, 19 May 2026 15:09:30 +0100 Subject: [PATCH 3/6] fix: guard remaining e2e runtime setup steps --- .github/workflows/check-store.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/check-store.yaml b/.github/workflows/check-store.yaml index b7302c73..2090baf3 100644 --- a/.github/workflows/check-store.yaml +++ b/.github/workflows/check-store.yaml @@ -289,6 +289,7 @@ jobs: stamp: ${{ inputs.stamp }} - name: Composer install + if: steps.detect-e2e.outputs.enabled == 'true' working-directory: ${{ steps.setup-magento.outputs.path }} run: composer install env: @@ -310,6 +311,7 @@ jobs: magento_path: ${{ inputs.path }} - uses: actions/setup-node@v4 + if: steps.detect-e2e.outputs.enabled == 'true' with: cache: npm From d90c0bf1150e0e81dc98331306526512dc032d1d Mon Sep 17 00:00:00 2001 From: Herve Tribouilloy Date: Tue, 19 May 2026 15:22:03 +0100 Subject: [PATCH 4/6] fix: combined both checks package.json and e2e folder existence to trigger e2e tests steps --- .github/workflows/check-store.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/check-store.yaml b/.github/workflows/check-store.yaml index 2090baf3..a600e66c 100644 --- a/.github/workflows/check-store.yaml +++ b/.github/workflows/check-store.yaml @@ -264,7 +264,9 @@ jobs: id: detect-e2e working-directory: ${{ inputs.path }} run: | - if [ -f package.json ]; then + 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" From 608201f303dceea99a379a62bcd4f25ac2a908f4 Mon Sep 17 00:00:00 2001 From: Herve Tribouilloy Date: Wed, 20 May 2026 08:30:03 +0100 Subject: [PATCH 5/6] fix: refine e2e suite detection and orchestration flow --- .github/workflows/check-store.yaml | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/.github/workflows/check-store.yaml b/.github/workflows/check-store.yaml index a600e66c..f696689a 100644 --- a/.github/workflows/check-store.yaml +++ b/.github/workflows/check-store.yaml @@ -260,9 +260,18 @@ jobs: 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: ${{ inputs.path }} + working-directory: ${{ steps.setup-magento.outputs.path }} run: | if [ -d dev/tests/e2e ] \ && [ "$(find dev/tests/e2e -type f | wc -l)" -gt 0 ] \ @@ -273,16 +282,6 @@ jobs: echo "::notice::No package.json found, skipping E2E" fi - - uses: graycoreio/github-actions-magento2/setup-magento@main - if: steps.detect-e2e.outputs.enabled == 'true' - id: setup-magento - with: - php-version: ${{ matrix.php }} - tools: composer:v${{ matrix.composer }} - mode: store - working-directory: ${{ inputs.path }} - composer_auth: ${{ secrets.composer_auth }} - - uses: graycoreio/github-actions-magento2/cache-magento@main if: steps.detect-e2e.outputs.enabled == 'true' with: From 7b3c493a5986f9fc27c04d6a02da0d01729f5cfe Mon Sep 17 00:00:00 2001 From: Herve Tribouilloy Date: Fri, 22 May 2026 15:35:58 +0100 Subject: [PATCH 6/6] Remove unecessary code --- _test/demo-package/Test/E2E/tsconfig.json | 33 ----------------------- package.json | 1 - 2 files changed, 34 deletions(-) delete mode 100644 _test/demo-package/Test/E2E/tsconfig.json diff --git a/_test/demo-package/Test/E2E/tsconfig.json b/_test/demo-package/Test/E2E/tsconfig.json deleted file mode 100644 index 9becd5d6..00000000 --- a/_test/demo-package/Test/E2E/tsconfig.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "compilerOptions": { - "target": "es6", - "module": "commonjs", - "strict": true, - "esModuleInterop": true, - "allowSyntheticDefaultImports": true, - "resolveJsonModule": true, - "baseUrl": ".", - "paths": { - "@config": [ - "base-tests/config", - "tests/config", // keep this for gitlab and when index.ts needs to be changed. - ], - "@utils/*": [ - "base-tests/utils/*", - "tests/utils/*" - ], - "@poms/*": [ - "base-tests/poms/*", - "tests/poms/*" - ], - "@types/*": [ - "base-tests/types/*", - "tests/types/*" - ], - "@fixtures/*": [ - "base-tests/fixtures/*", - "tests/fixtures/*" - ] - } - } -} \ No newline at end of file diff --git a/package.json b/package.json index 3291be78..dc5df744 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,6 @@ "description": "Github Actions for Magento 2", "scripts": { "test": "cd supported-version && npm run test && cd - && cd setup-install && npm run test && cd -", - "test:e2e": "ts-node dev/tests/e2e/**/*.ts", "release": "standard-version" }, "private": true,