|
1 | | -name: SalesforceCommerceCloud/pwa-kit/e2e-pr |
2 | | -on: |
3 | | - workflow_dispatch: |
4 | | - pull_request: # Default: opened, reopened, synchronize (head branch updated) |
5 | | - merge_group: # Trigger GA workflow when a pull request is added to a merge queue. |
6 | | - push: |
7 | | - branches: |
8 | | - - develop |
9 | | - - 'release-*' |
10 | | - |
11 | | -permissions: |
12 | | - id-token: write |
13 | | - contents: read |
14 | | - |
15 | | -jobs: |
16 | | - test_e2e_private_client: |
17 | | - runs-on: ubuntu-latest |
18 | | - env: |
19 | | - AWS_S3_BUCKET: ${{ vars.AWS_S3_BUCKET }} |
20 | | - AWS_REGION: ${{ vars.AWS_REGION }} |
21 | | - AWS_S3_POOL_DATA_FILE_KEY: ${{ vars.AWS_S3_POOL_DATA_FILE_KEY }} |
22 | | - |
23 | | - steps: |
24 | | - - name: Checkout |
25 | | - uses: actions/checkout@v4 |
26 | | - |
27 | | - - name: Check PWA Kit Version |
28 | | - run: |- |
29 | | - version=`jq -r ".version" package.json` |
30 | | - echo "pwa_kit_version=$version" >> "$GITHUB_ENV" |
31 | | -
|
32 | | - # Skip the entire workflow since we don't have e2e tests for PWA Kit v2.x. |
33 | | - - name: Skip if PWA Kit version older than v3.x |
34 | | - run: |- |
35 | | - major_version=$(echo "${{ env.pwa_kit_version }}" | cut -d. -f1) |
36 | | - if [ "$major_version" -ne 3 ]; then |
37 | | - echo "PWA Kit version is does not match v3.x, skipping workflow." |
38 | | - echo "SKIP_WORKFLOW=true" >> "$GITHUB_ENV" |
39 | | - fi |
40 | | -
|
41 | | - # Only test for latest Node version supported by MRT |
42 | | - - name: Setup Node |
43 | | - if: ${{ env.SKIP_WORKFLOW != 'true' }} |
44 | | - uses: actions/setup-node@v4 |
45 | | - with: |
46 | | - node-version: 22 |
47 | | - cache: npm |
48 | | - |
49 | | - - name: Install Monorepo Dependencies |
50 | | - if: ${{ env.SKIP_WORKFLOW != 'true' }} |
51 | | - run: |- |
52 | | - # Install node dependencies |
53 | | - node ./scripts/gtime.js monorepo_install npm ci |
54 | | -
|
55 | | - # Check central resource allocation on AWS and get a lock on an available environment from the pool. |
56 | | - # Sets the MRT target details in the workflow output. |
57 | | - - name: Configure AWS Credentials |
58 | | - if: ${{ env.SKIP_WORKFLOW != 'true' }} |
59 | | - uses: aws-actions/configure-aws-credentials@v4 |
60 | | - with: |
61 | | - role-to-assume: ${{ secrets.AWS_ROLE_ARN }} |
62 | | - aws-region: ${{ vars.AWS_REGION }} |
63 | | - role-session-name: 'GithubActions-E2E-CI' |
64 | | - |
65 | | - - name: Get MRT Target lock |
66 | | - id: get_mrt_target_lock |
67 | | - if: ${{ env.SKIP_WORKFLOW != 'true' }} |
68 | | - uses: ./.github/actions/e2e_acquire_mrt_target |
69 | | - with: |
70 | | - BRANCH: ${{ github.ref_name }} |
71 | | - RUN_ID: ${{ github.run_id }} |
72 | | - PR_NUMBER: ${{ github.event.pull_request.number }} |
73 | | - |
74 | | - - name: Read MRT Target Details |
75 | | - id: mrt_target_details |
76 | | - if: ${{ env.SKIP_WORKFLOW != 'true' }} |
77 | | - run: |- |
78 | | - jq -r 'to_entries[] | "\(.key)=\(.value // "")"' e2e/mrt-target/mrt-target-details.json >> "$GITHUB_OUTPUT" |
79 | | - # Set the RETAIL_APP_HOME environment variable to the MRT target URL. |
80 | | - # This is used by the e2e tests to run the tests against the MRT target. |
81 | | - echo "RETAIL_APP_HOME=${{ steps.mrt_target_details.outputs.envURL }}" >> "$GITHUB_ENV" |
82 | | -
|
83 | | - # Engage post-run cleanup via a Node action that has a post hook. |
84 | | - # - The action defines `runs.post` so its post step runs at the |
85 | | - # end of this job even if earlier steps fail or the job is cancelled. |
86 | | - # - This step passes the slug, maxRetries and retryDelay; the action's main saves it to state. |
87 | | - # - The actual release happens in the action's post script (post.js). |
88 | | - # - This replaces a separate cleanup job and avoids double-release. |
89 | | - # - This step is only engaged if the workflow is not skipped. |
90 | | - - name: Engage Post hook to release MRT target back to the pool |
91 | | - if: ${{ env.SKIP_WORKFLOW != 'true' }} |
92 | | - uses: ./.github/actions/e2e_release_mrt_target |
93 | | - with: |
94 | | - SLUG: ${{ steps.mrt_target_details.outputs.slug }} |
95 | | - MAX_RETRIES: 3 |
96 | | - RETRY_DELAY: 10000 |
97 | | - |
98 | | - # Properties specified in the body for MRT API to update settings must be in MRT_ENV_SETTINGS_E2E_BASE_FILENAME file. |
99 | | - # See: https://developer.salesforce.com/docs/commerce/pwa-kit-managed-runtime/references/mrt-admin?meta=projects_target_partial_update |
100 | | - # Like proxy configs, enabling cookies or other MRT env settings. |
101 | | - - name: Create .env with settings to be updated on the MRT target |
102 | | - run: |- |
103 | | - echo "MRT_TARGET_SSR_PROXY_CONFIGS=${{ vars.PWA_KIT_E2E_TARGET_PROXY_CONFIGS }}" > ${{ vars.MRT_ENV_SETTINGS_E2E_BASE_FILENAME }} |
104 | | -
|
105 | | - # Environment variables you'd like to set on the MRT target must be in MRT_ENV_VARS_E2E_BASE_FILENAME file. |
106 | | - # See: https://developer.salesforce.com/docs/commerce/pwa-kit-managed-runtime/references/mrt-admin?meta=projects_target_env_var_partial_update |
107 | | - # These are the env variables required by the storefront to be set in MRT for the e2e tests to run. |
108 | | - # Like SLAS client secret. |
109 | | - - name: Create .env with environment variables to be set on the MRT target |
110 | | - run: |- |
111 | | - echo "PWA_KIT_SLAS_CLIENT_SECRET=${{ secrets.ZZRF_002_SLAS_PRIVATE_CLIENT_SECRET }}" > ${{ vars.MRT_ENV_VARS_E2E_BASE_FILENAME }} |
112 | | -
|
113 | | - # Call the e2e/scripts/update-mrt-target.js script to update the MRT target config and environment variables. |
114 | | - # This script is a Node.js script that makes a PATCH request to the MRT API to update the MRT target config and environment variables. |
115 | | - # The script is located in the e2e/scripts directory. |
116 | | - # The script is called from the .github/actions/update_mrt_target action. |
117 | | - # The script is called with the following arguments: |
118 | | - - name: Update MRT Target Config and Environment Variables |
119 | | - if: ${{ env.SKIP_WORKFLOW != 'true' }} |
120 | | - uses: ./.github/actions/update_mrt_target |
121 | | - with: |
122 | | - PROJECT_SLUG: ${{ vars.MRT_STG_PWA_KIT_PROJECT_ID }} |
123 | | - TARGET_SLUG: ${{ steps.mrt_target_details.outputs.slug }} |
124 | | - MOBIFY_API_KEY: ${{ secrets.MRT_STG_PWA_KIT_CI_API_KEY }} |
125 | | - CLOUD_ORIGIN: ${{ vars.MRT_STG_CLOUD_ORIGIN }} |
126 | | - MRT_TARGET_SETTINGS_FILE_PATH: ${{ vars.MRT_ENV_SETTINGS_E2E_BASE_FILENAME }} |
127 | | - MRT_TARGET_VARS_FILE_PATH: ${{ vars.MRT_ENV_VARS_E2E_BASE_FILENAME }} |
128 | | - |
129 | | - - name: Get Template Version |
130 | | - if: ${{ env.SKIP_WORKFLOW != 'true' }} |
131 | | - run: |- |
132 | | - version=`jq -r ".version" packages/template-retail-react-app/package.json` |
133 | | - echo "retail_app_template_version=$version" >> "$GITHUB_ENV" |
134 | | -
|
135 | | - - name: Generate Retail App Private Client |
136 | | - id: generate_app |
137 | | - if: ${{ env.SKIP_WORKFLOW != 'true' }} |
138 | | - uses: ./.github/actions/e2e_generate_app |
139 | | - with: |
140 | | - PROJECT_KEY: 'retail-app-private-client' |
141 | | - TEMPLATE_VERSION: ${{ env.retail_app_template_version }} |
142 | | - |
143 | | - - name: Validate Generated Retail App |
144 | | - if: ${{ env.SKIP_WORKFLOW != 'true' }} |
145 | | - uses: ./.github/actions/e2e_validate_generated_app |
146 | | - with: |
147 | | - PROJECT_KEY: 'retail-app-private-client' |
148 | | - TEMPLATE_VERSION: ${{ env.retail_app_template_version }} |
149 | | - |
150 | | - - name: Create MRT credentials file |
151 | | - if: ${{ env.SKIP_WORKFLOW != 'true' }} |
152 | | - uses: './.github/actions/create_mrt' |
153 | | - with: |
154 | | - mobify_user: ${{ secrets.MRT_STG_PWA_KIT_CI_USER }} |
155 | | - mobify_api_key: ${{ secrets.MRT_STG_PWA_KIT_CI_API_KEY }} |
156 | | - |
157 | | - - name: Push Bundle to MRT (E2E Test PWA Kit) |
158 | | - if: ${{ env.SKIP_WORKFLOW != 'true' }} |
159 | | - uses: './.github/actions/push_to_mrt' |
160 | | - with: |
161 | | - CWD: ${{ steps.generate_app.outputs.project_path }} |
162 | | - PROJECT: ${{ vars.MRT_STG_PWA_KIT_PROJECT_ID }} |
163 | | - TARGET: ${{ steps.mrt_target_details.outputs.slug }} |
164 | | - CLOUD_ORIGIN: ${{ vars.MRT_STG_CLOUD_ORIGIN }} |
165 | | - FLAGS: --wait |
166 | | - |
167 | | - # Only install chromium since we're only testing for chrome and chrome mobile for per-pr test runs. |
168 | | - # Nightly tests will run against multiple browsers. |
169 | | - - name: Install Playwright Browsers |
170 | | - if: ${{ env.SKIP_WORKFLOW != 'true' }} |
171 | | - run: npx playwright install chromium --with-deps |
172 | | - |
173 | | - # Run all 4 playwright projects in parallel to reduce run time. |
174 | | - # Number of workers must match number of projects for parallel runs so we have it set to 4. |
175 | | - # Limit the number of workers to 2x the number of cores on the machine to avoid overloading the machine (Github-hosted runner). |
176 | | - # Note: This job uses "ubuntu-latest" which has 4 cores so we limit the number of workers to 8. |
177 | | - # See: https://docs.github.com/en/actions/reference/runners/github-hosted-runners#standard-github-hosted-runners-for-public-repositories for runner specs. |
178 | | - - name: Run Playwright tests |
179 | | - if: ${{ env.SKIP_WORKFLOW != 'true' }} |
180 | | - run: | |
181 | | - npx playwright test --project=chromium --project=mobile-chrome --project=a11y-mobile --project=a11y-desktop --workers=4 |
| 1 | +# Commented due to this failing for every PR until this is fixed with @W-19443536 |
| 2 | +# name: SalesforceCommerceCloud/pwa-kit/e2e-pr |
| 3 | +# on: |
| 4 | +# workflow_dispatch: |
| 5 | +# pull_request: # Default: opened, reopened, synchronize (head branch updated) |
| 6 | +# merge_group: # Trigger GA workflow when a pull request is added to a merge queue. |
| 7 | +# push: |
| 8 | +# branches: |
| 9 | +# - develop |
| 10 | +# - 'release-*' |
| 11 | + |
| 12 | +# permissions: |
| 13 | +# id-token: write |
| 14 | +# contents: read |
| 15 | + |
| 16 | +# jobs: |
| 17 | +# test_e2e_private_client: |
| 18 | +# runs-on: ubuntu-latest |
| 19 | +# env: |
| 20 | +# AWS_S3_BUCKET: ${{ vars.AWS_S3_BUCKET }} |
| 21 | +# AWS_REGION: ${{ vars.AWS_REGION }} |
| 22 | +# AWS_S3_POOL_DATA_FILE_KEY: ${{ vars.AWS_S3_POOL_DATA_FILE_KEY }} |
| 23 | + |
| 24 | +# steps: |
| 25 | +# - name: Checkout |
| 26 | +# uses: actions/checkout@v4 |
| 27 | + |
| 28 | +# - name: Check PWA Kit Version |
| 29 | +# run: |- |
| 30 | +# version=`jq -r ".version" package.json` |
| 31 | +# echo "pwa_kit_version=$version" >> "$GITHUB_ENV" |
| 32 | + |
| 33 | +# # Skip the entire workflow since we don't have e2e tests for PWA Kit v2.x. |
| 34 | +# - name: Skip if PWA Kit version older than v3.x |
| 35 | +# run: |- |
| 36 | +# major_version=$(echo "${{ env.pwa_kit_version }}" | cut -d. -f1) |
| 37 | +# if [ "$major_version" -ne 3 ]; then |
| 38 | +# echo "PWA Kit version is does not match v3.x, skipping workflow." |
| 39 | +# echo "SKIP_WORKFLOW=true" >> "$GITHUB_ENV" |
| 40 | +# fi |
| 41 | + |
| 42 | +# # Only test for latest Node version supported by MRT |
| 43 | +# - name: Setup Node |
| 44 | +# if: ${{ env.SKIP_WORKFLOW != 'true' }} |
| 45 | +# uses: actions/setup-node@v4 |
| 46 | +# with: |
| 47 | +# node-version: 22 |
| 48 | +# cache: npm |
| 49 | + |
| 50 | +# - name: Install Monorepo Dependencies |
| 51 | +# if: ${{ env.SKIP_WORKFLOW != 'true' }} |
| 52 | +# run: |- |
| 53 | +# # Install node dependencies |
| 54 | +# node ./scripts/gtime.js monorepo_install npm ci |
| 55 | + |
| 56 | +# # Check central resource allocation on AWS and get a lock on an available environment from the pool. |
| 57 | +# # Sets the MRT target details in the workflow output. |
| 58 | +# - name: Configure AWS Credentials |
| 59 | +# if: ${{ env.SKIP_WORKFLOW != 'true' }} |
| 60 | +# uses: aws-actions/configure-aws-credentials@v4 |
| 61 | +# with: |
| 62 | +# role-to-assume: ${{ secrets.AWS_ROLE_ARN }} |
| 63 | +# aws-region: ${{ vars.AWS_REGION }} |
| 64 | +# role-session-name: 'GithubActions-E2E-CI' |
| 65 | + |
| 66 | +# - name: Get MRT Target lock |
| 67 | +# id: get_mrt_target_lock |
| 68 | +# if: ${{ env.SKIP_WORKFLOW != 'true' }} |
| 69 | +# uses: ./.github/actions/e2e_acquire_mrt_target |
| 70 | +# with: |
| 71 | +# BRANCH: ${{ github.ref_name }} |
| 72 | +# RUN_ID: ${{ github.run_id }} |
| 73 | +# PR_NUMBER: ${{ github.event.pull_request.number }} |
| 74 | + |
| 75 | +# - name: Read MRT Target Details |
| 76 | +# id: mrt_target_details |
| 77 | +# if: ${{ env.SKIP_WORKFLOW != 'true' }} |
| 78 | +# run: |- |
| 79 | +# jq -r 'to_entries[] | "\(.key)=\(.value // "")"' e2e/mrt-target/mrt-target-details.json >> "$GITHUB_OUTPUT" |
| 80 | +# # Set the RETAIL_APP_HOME environment variable to the MRT target URL. |
| 81 | +# # This is used by the e2e tests to run the tests against the MRT target. |
| 82 | +# echo "RETAIL_APP_HOME=${{ steps.mrt_target_details.outputs.envURL }}" >> "$GITHUB_ENV" |
| 83 | + |
| 84 | +# # Engage post-run cleanup via a Node action that has a post hook. |
| 85 | +# # - The action defines `runs.post` so its post step runs at the |
| 86 | +# # end of this job even if earlier steps fail or the job is cancelled. |
| 87 | +# # - This step passes the slug, maxRetries and retryDelay; the action's main saves it to state. |
| 88 | +# # - The actual release happens in the action's post script (post.js). |
| 89 | +# # - This replaces a separate cleanup job and avoids double-release. |
| 90 | +# # - This step is only engaged if the workflow is not skipped. |
| 91 | +# - name: Engage Post hook to release MRT target back to the pool |
| 92 | +# if: ${{ env.SKIP_WORKFLOW != 'true' }} |
| 93 | +# uses: ./.github/actions/e2e_release_mrt_target |
| 94 | +# with: |
| 95 | +# SLUG: ${{ steps.mrt_target_details.outputs.slug }} |
| 96 | +# MAX_RETRIES: 3 |
| 97 | +# RETRY_DELAY: 10000 |
| 98 | + |
| 99 | +# # Properties specified in the body for MRT API to update settings must be in MRT_ENV_SETTINGS_E2E_BASE_FILENAME file. |
| 100 | +# # See: https://developer.salesforce.com/docs/commerce/pwa-kit-managed-runtime/references/mrt-admin?meta=projects_target_partial_update |
| 101 | +# # Like proxy configs, enabling cookies or other MRT env settings. |
| 102 | +# - name: Create .env with settings to be updated on the MRT target |
| 103 | +# run: |- |
| 104 | +# echo "MRT_TARGET_SSR_PROXY_CONFIGS=${{ vars.PWA_KIT_E2E_TARGET_PROXY_CONFIGS }}" > ${{ vars.MRT_ENV_SETTINGS_E2E_BASE_FILENAME }} |
| 105 | + |
| 106 | +# # Environment variables you'd like to set on the MRT target must be in MRT_ENV_VARS_E2E_BASE_FILENAME file. |
| 107 | +# # See: https://developer.salesforce.com/docs/commerce/pwa-kit-managed-runtime/references/mrt-admin?meta=projects_target_env_var_partial_update |
| 108 | +# # These are the env variables required by the storefront to be set in MRT for the e2e tests to run. |
| 109 | +# # Like SLAS client secret. |
| 110 | +# - name: Create .env with environment variables to be set on the MRT target |
| 111 | +# run: |- |
| 112 | +# echo "PWA_KIT_SLAS_CLIENT_SECRET=${{ secrets.ZZRF_002_SLAS_PRIVATE_CLIENT_SECRET }}" > ${{ vars.MRT_ENV_VARS_E2E_BASE_FILENAME }} |
| 113 | + |
| 114 | +# # Call the e2e/scripts/update-mrt-target.js script to update the MRT target config and environment variables. |
| 115 | +# # This script is a Node.js script that makes a PATCH request to the MRT API to update the MRT target config and environment variables. |
| 116 | +# # The script is located in the e2e/scripts directory. |
| 117 | +# # The script is called from the .github/actions/update_mrt_target action. |
| 118 | +# # The script is called with the following arguments: |
| 119 | +# - name: Update MRT Target Config and Environment Variables |
| 120 | +# if: ${{ env.SKIP_WORKFLOW != 'true' }} |
| 121 | +# uses: ./.github/actions/update_mrt_target |
| 122 | +# with: |
| 123 | +# PROJECT_SLUG: ${{ vars.MRT_STG_PWA_KIT_PROJECT_ID }} |
| 124 | +# TARGET_SLUG: ${{ steps.mrt_target_details.outputs.slug }} |
| 125 | +# MOBIFY_API_KEY: ${{ secrets.MRT_STG_PWA_KIT_CI_API_KEY }} |
| 126 | +# CLOUD_ORIGIN: ${{ vars.MRT_STG_CLOUD_ORIGIN }} |
| 127 | +# MRT_TARGET_SETTINGS_FILE_PATH: ${{ vars.MRT_ENV_SETTINGS_E2E_BASE_FILENAME }} |
| 128 | +# MRT_TARGET_VARS_FILE_PATH: ${{ vars.MRT_ENV_VARS_E2E_BASE_FILENAME }} |
| 129 | + |
| 130 | +# - name: Get Template Version |
| 131 | +# if: ${{ env.SKIP_WORKFLOW != 'true' }} |
| 132 | +# run: |- |
| 133 | +# version=`jq -r ".version" packages/template-retail-react-app/package.json` |
| 134 | +# echo "retail_app_template_version=$version" >> "$GITHUB_ENV" |
| 135 | + |
| 136 | +# - name: Generate Retail App Private Client |
| 137 | +# id: generate_app |
| 138 | +# if: ${{ env.SKIP_WORKFLOW != 'true' }} |
| 139 | +# uses: ./.github/actions/e2e_generate_app |
| 140 | +# with: |
| 141 | +# PROJECT_KEY: 'retail-app-private-client' |
| 142 | +# TEMPLATE_VERSION: ${{ env.retail_app_template_version }} |
| 143 | + |
| 144 | +# - name: Validate Generated Retail App |
| 145 | +# if: ${{ env.SKIP_WORKFLOW != 'true' }} |
| 146 | +# uses: ./.github/actions/e2e_validate_generated_app |
| 147 | +# with: |
| 148 | +# PROJECT_KEY: 'retail-app-private-client' |
| 149 | +# TEMPLATE_VERSION: ${{ env.retail_app_template_version }} |
| 150 | + |
| 151 | +# - name: Create MRT credentials file |
| 152 | +# if: ${{ env.SKIP_WORKFLOW != 'true' }} |
| 153 | +# uses: './.github/actions/create_mrt' |
| 154 | +# with: |
| 155 | +# mobify_user: ${{ secrets.MRT_STG_PWA_KIT_CI_USER }} |
| 156 | +# mobify_api_key: ${{ secrets.MRT_STG_PWA_KIT_CI_API_KEY }} |
| 157 | + |
| 158 | +# - name: Push Bundle to MRT (E2E Test PWA Kit) |
| 159 | +# if: ${{ env.SKIP_WORKFLOW != 'true' }} |
| 160 | +# uses: './.github/actions/push_to_mrt' |
| 161 | +# with: |
| 162 | +# CWD: ${{ steps.generate_app.outputs.project_path }} |
| 163 | +# PROJECT: ${{ vars.MRT_STG_PWA_KIT_PROJECT_ID }} |
| 164 | +# TARGET: ${{ steps.mrt_target_details.outputs.slug }} |
| 165 | +# CLOUD_ORIGIN: ${{ vars.MRT_STG_CLOUD_ORIGIN }} |
| 166 | +# FLAGS: --wait |
| 167 | + |
| 168 | +# # Only install chromium since we're only testing for chrome and chrome mobile for per-pr test runs. |
| 169 | +# # Nightly tests will run against multiple browsers. |
| 170 | +# - name: Install Playwright Browsers |
| 171 | +# if: ${{ env.SKIP_WORKFLOW != 'true' }} |
| 172 | +# run: npx playwright install chromium --with-deps |
| 173 | + |
| 174 | +# # Run all 4 playwright projects in parallel to reduce run time. |
| 175 | +# # Number of workers must match number of projects for parallel runs so we have it set to 4. |
| 176 | +# # Limit the number of workers to 2x the number of cores on the machine to avoid overloading the machine (Github-hosted runner). |
| 177 | +# # Note: This job uses "ubuntu-latest" which has 4 cores so we limit the number of workers to 8. |
| 178 | +# # See: https://docs.github.com/en/actions/reference/runners/github-hosted-runners#standard-github-hosted-runners-for-public-repositories for runner specs. |
| 179 | +# - name: Run Playwright tests |
| 180 | +# if: ${{ env.SKIP_WORKFLOW != 'true' }} |
| 181 | +# run: | |
| 182 | +# npx playwright test --project=chromium --project=mobile-chrome --project=a11y-mobile --project=a11y-desktop --workers=4 |
0 commit comments