11name : SalesforceCommerceCloud/pwa-kit/e2e-pr
22on :
33 workflow_dispatch :
4+ # Manually deploy e2e test setup to your own MRT Target for debugging tests.
5+ inputs :
6+ mrt_project_slug :
7+ type : string
8+ description : ' MRT Project ID'
9+ required : true
10+ mrt_target_slug :
11+ type : string
12+ description : ' MRT Environment ID'
13+ required : true
14+ mrt_target_external_hostname :
15+ type : string
16+ description : ' MRT Target External Hostname'
17+ required : true
18+ mrt_admin_cloud_origin :
19+ type : string
20+ description : ' MRT Org hostname for your project'
21+ required : false
22+ default : ' https://cloud.mobify.com'
23+ mrt_admin_user :
24+ type : string
25+ description : ' MRT Admin Username'
26+ required : true
27+ mrt_admin_api_key :
28+ type : string
29+ description : ' MRT Admin API key'
30+ required : true
31+ skip_tests :
32+ type : boolean
33+ description : ' Skip Tests - Uncheck if you want to run the tests as a part of this deployment'
34+ required : false
35+ default : true
436 pull_request : # Default: opened, reopened, synchronize (head branch updated)
537 merge_group : # Trigger GA workflow when a pull request is added to a merge queue.
638 push :
5587 # Check central resource allocation on AWS and get a lock on an available environment from the pool.
5688 # Sets the MRT target details in the workflow output.
5789 - name : Configure AWS Credentials
58- if : ${{ env.SKIP_WORKFLOW != 'true' }}
90+ if : ${{ env.SKIP_WORKFLOW != 'true' && github.event_name != 'workflow_dispatch' }}
5991 uses : aws-actions/configure-aws-credentials@v4
6092 with :
6193 role-to-assume : ${{ secrets.AWS_ROLE_ARN }}
6496
6597 - name : Get MRT Target lock
6698 id : get_mrt_target_lock
67- if : ${{ env.SKIP_WORKFLOW != 'true' }}
99+ if : ${{ env.SKIP_WORKFLOW != 'true' && github.event_name != 'workflow_dispatch' }}
68100 uses : ./.github/actions/e2e_acquire_mrt_target
69101 with :
70102 BRANCH : ${{ github.ref_name }}
73105
74106 - name : Read MRT Target Details
75107 id : mrt_target_details
76- if : ${{ env.SKIP_WORKFLOW != 'true' }}
108+ if : ${{ env.SKIP_WORKFLOW != 'true' && github.event_name != 'workflow_dispatch' }}
77109 run : |-
78110 jq -r 'to_entries[] | "\(.key)=\(.value // "")"' e2e/mrt-target/mrt-target-details.json >> "$GITHUB_OUTPUT"
79111
85117 # - This replaces a separate cleanup job and avoids double-release.
86118 # - This step is only engaged if the workflow is not skipped.
87119 - name : Engage Post hook to release MRT target back to the pool
88- if : ${{ env.SKIP_WORKFLOW != 'true' }}
120+ if : ${{ env.SKIP_WORKFLOW != 'true' && github.event_name != 'workflow_dispatch' }}
89121 uses : ./.github/actions/e2e_release_mrt_target
90122 with :
91123 SLUG : ${{ steps.mrt_target_details.outputs.slug }}
@@ -117,10 +149,10 @@ jobs:
117149 if : ${{ env.SKIP_WORKFLOW != 'true' }}
118150 uses : ./.github/actions/update_mrt_target
119151 with :
120- PROJECT_SLUG : ${{ vars.MRT_STG_PWA_KIT_PROJECT_ID }}
121- TARGET_SLUG : ${{ steps.mrt_target_details.outputs.slug }}
122- MOBIFY_API_KEY : ${{ secrets.MRT_STG_PWA_KIT_CI_API_KEY }}
123- CLOUD_ORIGIN : ${{ vars.MRT_STG_CLOUD_ORIGIN }}
152+ PROJECT_SLUG : ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.mrt_project_slug || vars.MRT_STG_PWA_KIT_PROJECT_ID }}
153+ TARGET_SLUG : ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.mrt_target_slug || steps.mrt_target_details.outputs.slug }}
154+ MOBIFY_API_KEY : ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.mrt_admin_api_key || secrets.MRT_STG_PWA_KIT_CI_API_KEY }}
155+ CLOUD_ORIGIN : ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.mrt_admin_cloud_origin || vars.MRT_STG_CLOUD_ORIGIN }}
124156 MRT_TARGET_SETTINGS_FILE_PATH : ${{ vars.MRT_ENV_SETTINGS_E2E_BASE_FILENAME }}
125157 MRT_TARGET_VARS_FILE_PATH : ${{ vars.MRT_ENV_VARS_E2E_BASE_FILENAME }}
126158
@@ -149,23 +181,23 @@ jobs:
149181 if : ${{ env.SKIP_WORKFLOW != 'true' }}
150182 uses : ' ./.github/actions/create_mrt'
151183 with :
152- mobify_user : ${{ secrets.MRT_STG_PWA_KIT_CI_USER }}
153- mobify_api_key : ${{ secrets.MRT_STG_PWA_KIT_CI_API_KEY }}
184+ mobify_user : ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.mrt_admin_user || secrets.MRT_STG_PWA_KIT_CI_USER }}
185+ mobify_api_key : ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.mrt_admin_api_key || secrets.MRT_STG_PWA_KIT_CI_API_KEY }}
154186
155187 - name : Push Bundle to MRT (E2E Test PWA Kit)
156188 if : ${{ env.SKIP_WORKFLOW != 'true' }}
157189 uses : ' ./.github/actions/push_to_mrt'
158190 with :
159191 CWD : ${{ steps.generate_app.outputs.project_path }}
160- PROJECT : ${{ vars.MRT_STG_PWA_KIT_PROJECT_ID }}
161- TARGET : ${{ steps.mrt_target_details.outputs.slug }}
162- CLOUD_ORIGIN : ${{ vars.MRT_STG_CLOUD_ORIGIN }}
192+ PROJECT : ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.mrt_project_slug || vars.MRT_STG_PWA_KIT_PROJECT_ID }}
193+ TARGET : ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.mrt_target_slug || steps.mrt_target_details.outputs.slug }}
194+ CLOUD_ORIGIN : ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.mrt_admin_cloud_origin || vars.MRT_STG_CLOUD_ORIGIN }}
163195 FLAGS : --wait
164196
165197 # Only install chromium since we're only testing for chrome and chrome mobile for per-pr test runs.
166198 # Nightly tests will run against multiple browsers.
167199 - name : Install Playwright Browsers
168- if : ${{ env.SKIP_WORKFLOW != 'true' }}
200+ if : ${{ env.SKIP_WORKFLOW != 'true' && !github.event.inputs.skip_tests }}
169201 run : npx playwright install chromium --with-deps
170202
171203 # Run all 4 playwright projects in parallel to reduce run time.
@@ -174,10 +206,10 @@ jobs:
174206 # Note: This job uses "ubuntu-latest" which has 4 cores so we limit the number of workers to 8.
175207 # See: https://docs.github.com/en/actions/reference/runners/github-hosted-runners#standard-github-hosted-runners-for-public-repositories for runner specs.
176208 - name : Run Playwright tests
177- if : ${{ env.SKIP_WORKFLOW != 'true' }}
209+ if : ${{ env.SKIP_WORKFLOW != 'true' && !github.event.inputs.skip_tests }}
178210 run : |
179211 # Set the RETAIL_APP_HOME environment variable to the MRT target URL.
180212 # This is used by the e2e tests to run the tests against the MRT target.
181- export RETAIL_APP_HOME="https://${{ steps.mrt_target_details.outputs.ssrExternalHostname }}"
213+ export RETAIL_APP_HOME="https://${{ github.event_name == 'workflow_dispatch' && github.event.inputs.mrt_target_external_hostname || steps.mrt_target_details.outputs.ssrExternalHostname }}"
182214 echo "RETAIL_APP_HOME environment variable value: $RETAIL_APP_HOME"
183215 npx playwright test --project=chromium --project=mobile-chrome --project=a11y-mobile-slas-private-client --project=a11y-desktop-slas-private-client --workers=4
0 commit comments