From a72d5b67c7ad0d165aca582f6a9c4ba60dffa464 Mon Sep 17 00:00:00 2001 From: Jang ho Jung Date: Tue, 26 Aug 2025 16:18:56 -0700 Subject: [PATCH 01/11] Initial commit --- .github/workflows/e2e.yml | 2 ++ ...=> passwordless-and-password-reset.spec.js} | 0 ...=> passwordless-and-password-reset.spec.js} | 3 +++ packages/pwa-kit-create-app/program.json | 4 +++- playwright.config.js | 18 ++---------------- 5 files changed, 10 insertions(+), 17 deletions(-) rename e2e/tests/desktop/{extra-features.spec.js => passwordless-and-password-reset.spec.js} (100%) rename e2e/tests/mobile/{extra-features.spec.js => passwordless-and-password-reset.spec.js} (97%) diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index 0c063dc4c8..dfec2365d8 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -385,6 +385,8 @@ jobs: # this will not include a11y tests - name: Run Playwright tests run: npm run test:e2e + env: + RUN_PRIVATE_CLIENT_TESTS: true notify-slack-pwa-private-client: needs: [run-generator-private-client] diff --git a/e2e/tests/desktop/extra-features.spec.js b/e2e/tests/desktop/passwordless-and-password-reset.spec.js similarity index 100% rename from e2e/tests/desktop/extra-features.spec.js rename to e2e/tests/desktop/passwordless-and-password-reset.spec.js diff --git a/e2e/tests/mobile/extra-features.spec.js b/e2e/tests/mobile/passwordless-and-password-reset.spec.js similarity index 97% rename from e2e/tests/mobile/extra-features.spec.js rename to e2e/tests/mobile/passwordless-and-password-reset.spec.js index cbe78d9f73..2fda54a760 100644 --- a/e2e/tests/mobile/extra-features.spec.js +++ b/e2e/tests/mobile/passwordless-and-password-reset.spec.js @@ -12,6 +12,9 @@ const {answerConsentTrackingForm} = require('../../scripts/pageHelpers.js') const GUEST_USER_CREDENTIALS = generateUserCredentials() +// Skip this test suite if not running private client tests +test.skip(() => !process.env.RUN_PRIVATE_CLIENT_TESTS, 'Passwordless login tests require private client configuration') + /** * Test that a user can login with passwordless login on mobile. There is no programmatic way to check the email, * so we will check that the necessary API call is being made and expected UI is shown diff --git a/packages/pwa-kit-create-app/program.json b/packages/pwa-kit-create-app/program.json index 508bcb02e7..404621f0af 100644 --- a/packages/pwa-kit-create-app/program.json +++ b/packages/pwa-kit-create-app/program.json @@ -399,7 +399,9 @@ "project.einstein.siteId": "aaij-MobileFirst", "project.dataCloud.appSourceId": "7ae070a6-f4ec-4def-a383-d9cacc3f20a1", "project.dataCloud.tenantId": "g82wgnrvm-ywk9dggrrw8mtggy.pc-rnd", - "project.demo.enableDemoSettings": false + "project.demo.enableDemoSettings": false, + "project.login.passwordless.enabled": true, + "project.login.social.enabled": true }, "private": true }, diff --git a/playwright.config.js b/playwright.config.js index 99c448a7c9..07668778c9 100644 --- a/playwright.config.js +++ b/playwright.config.js @@ -37,14 +37,14 @@ module.exports = defineConfig({ { name: 'chromium', use: {...devices['Desktop Chrome']}, - testIgnore: ['**/a11y/**', '**/mobile/**', '**/extra-features.spec.js'] + testIgnore: ['**/a11y/**', '**/mobile/**'] }, /* Test against mobile viewports. */ { name: 'mobile-chrome', use: {...devices['Pixel 5']}, - testIgnore: ['**/a11y/**', '**/desktop/**', '**/extra-features.spec.js'] + testIgnore: ['**/a11y/**', '**/desktop/**'] }, { name: 'a11y-mobile', @@ -55,20 +55,6 @@ module.exports = defineConfig({ name: 'a11y-desktop', use: {...devices['Desktop Chrome']}, testDir: './e2e/tests/a11y/desktop' - }, - { - name: 'extra-features-desktop', - testMatch: [ - 'e2e/tests/desktop/extra-features.spec.js' - ], - use: { ...devices['Desktop Chrome'] } - }, - { - name: 'extra-features-mobile', - testMatch: [ - 'e2e/tests/mobile/extra-features.spec.js' - ], - use: { ...devices['Pixel 5'] } } ] }) From 8ec4a761dcb6057d8ba04452f8f16cb9ef4f75c6 Mon Sep 17 00:00:00 2001 From: Jang ho Jung Date: Tue, 26 Aug 2025 16:47:14 -0700 Subject: [PATCH 02/11] Update passwordless-and-password-reset.spec.js --- e2e/tests/mobile/passwordless-and-password-reset.spec.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/e2e/tests/mobile/passwordless-and-password-reset.spec.js b/e2e/tests/mobile/passwordless-and-password-reset.spec.js index f6c3e5a70b..39e35cd8a7 100644 --- a/e2e/tests/mobile/passwordless-and-password-reset.spec.js +++ b/e2e/tests/mobile/passwordless-and-password-reset.spec.js @@ -13,7 +13,10 @@ const {answerConsentTrackingForm} = require('../../scripts/pageHelpers.js') const GUEST_USER_CREDENTIALS = generateUserCredentials() // Skip this test suite if not running private client tests -test.skip(() => !process.env.RUN_PRIVATE_CLIENT_TESTS, 'Passwordless login tests require private client configuration') +test.skip( + () => !process.env.RUN_PRIVATE_CLIENT_TESTS, + 'Passwordless login tests require private client configuration' +) /** * Test that a user can login with passwordless login on mobile. There is no programmatic way to check the email, From 218c3d0ca2b6e7e2133e263968f384f76bb53a31 Mon Sep 17 00:00:00 2001 From: Jang ho Jung Date: Tue, 26 Aug 2025 17:05:04 -0700 Subject: [PATCH 03/11] Update e2e.yml --- .github/workflows/e2e.yml | 34 ++++++++++------------------------ 1 file changed, 10 insertions(+), 24 deletions(-) diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index dfec2365d8..5165e786e5 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -4,9 +4,12 @@ on: schedule: # Run every day at 12am (PST) - cron uses UTC times - cron: "0 8 * * *" + pull_request: jobs: run-generator-demo: + # Only run on scheduled events and manual dispatch (not on PRs) + if: ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }} strategy: fail-fast: false matrix: @@ -61,6 +64,8 @@ jobs: with: PROJECT_KEY: "retail-app-demo" run-generator-retail-app-no-ext: + # Only run on scheduled events and manual dispatch (not on PRs) + if: ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }} strategy: fail-fast: false # Run one matrix env at a time because we need to deploy each app to MRT and run e2e tests there @@ -175,7 +180,8 @@ jobs: SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} run-generator-retail-app-ext: # Run after the previous job completes irrespective of its result - if: ${{ always() }} + # Only run on scheduled events and manual dispatch (not on PRs) + if: ${{ always() && (github.event_name == 'schedule' || github.event_name == 'workflow_dispatch') }} needs: [run-generator-retail-app-no-ext] strategy: fail-fast: false @@ -297,6 +303,8 @@ jobs: env: SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} run-generator-private-client: + # Run on PRs and scheduled runs + if: ${{ github.event_name == 'pull_request' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }} strategy: fail-fast: false # Run one matrix env at a time because we need to deploy each app to MRT and run e2e tests there @@ -415,26 +423,4 @@ jobs: "message": "❌ One or more PWA Kit Private Client E2E tests failed! (${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})" } env: - SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} - - test-extra-features: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Setup Node.js - uses: actions/setup-node@v4 - with: - node-version: 22 - cache: npm - - name: Install Monorepo Dependencies - run: node ./scripts/gtime.js monorepo_install npm ci - - name: Install Playwright Browsers - run: npx playwright install --with-deps - - name: Set PWA Kit E2E Test User - run: export PWA_E2E_USER_EMAIL=e2e.pwa.kit@gmail.com PWA_E2E_USER_PASSWORD=hpv_pek-JZK_xkz0wzf - - name: Run extra features tests - env: - PWA_E2E_USER_EMAIL: e2e.pwa.kit@gmail.com - PWA_E2E_USER_PASSWORD: hpv_pek-JZK_xkz0wzf - run: npm run test:e2e:extra_features + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} \ No newline at end of file From dafb1aeebcdb103befa053b3c1603563a7859f1d Mon Sep 17 00:00:00 2001 From: Jang ho Jung Date: Tue, 26 Aug 2025 17:05:16 -0700 Subject: [PATCH 04/11] Add env var check to desktop spec --- e2e/tests/desktop/passwordless-and-password-reset.spec.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/e2e/tests/desktop/passwordless-and-password-reset.spec.js b/e2e/tests/desktop/passwordless-and-password-reset.spec.js index 787840bfac..64a754efff 100644 --- a/e2e/tests/desktop/passwordless-and-password-reset.spec.js +++ b/e2e/tests/desktop/passwordless-and-password-reset.spec.js @@ -11,6 +11,12 @@ const {generateUserCredentials} = require('../../scripts/utils.js') const {answerConsentTrackingForm} = require('../../scripts/pageHelpers.js') const GUEST_USER_CREDENTIALS = generateUserCredentials() + +// Skip this test suite if not running private client tests +test.skip( + () => !process.env.RUN_PRIVATE_CLIENT_TESTS, + 'Passwordless login tests require private client configuration' +) /** * Test that a user can login with passwordless login on mobile. There is no programmatic way to check the email, * so we will check that the necessary API call is being made and expected UI is shown From e9e236d50715f2b76f87dcd81b3bd9aea0178f03 Mon Sep 17 00:00:00 2001 From: Jang ho Jung Date: Tue, 26 Aug 2025 17:22:06 -0700 Subject: [PATCH 05/11] Update e2e.yml --- .github/workflows/e2e.yml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index 5165e786e5..e7cc0a0fd1 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -368,6 +368,23 @@ jobs: PROJECT_KEY: "retail-app-private-client" TEMPLATE_VERSION: ${{ env.retail_app_template_version }} + - name: Debug - Show generated app config + run: | + echo "=== Generated App Structure ===" + ls -la ${{ steps.generate_app_private_client.outputs.project_path }} + echo "" + echo "=== Config Directory ===" + ls -la ${{ steps.generate_app_private_client.outputs.project_path }}/config/ || echo "No config directory found" + echo "" + echo "=== App Directory ===" + ls -la ${{ steps.generate_app_private_client.outputs.project_path }}/app/ || echo "No app directory found" + echo "" + echo "=== Generated config/default.js Content ===" + cat ${{ steps.generate_app_private_client.outputs.project_path }}/config/default.js || echo "config/default.js not found" + echo "" + echo "=== Generated app/config/default.js Content (if exists) ===" + cat ${{ steps.generate_app_private_client.outputs.project_path }}/app/config/default.js || echo "app/config/default.js not found" + - name: Create MRT credentials file uses: "./.github/actions/create_mrt" with: From 2dcd439c4ed630f54c67b438de84456213748bbe Mon Sep 17 00:00:00 2001 From: Jang ho Jung Date: Tue, 26 Aug 2025 21:35:40 -0700 Subject: [PATCH 06/11] Debugging --- .github/workflows/e2e.yml | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index e7cc0a0fd1..9bed31d53c 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -355,6 +355,15 @@ jobs: version=`jq -r ".version" packages/template-retail-react-app/package.json` echo "retail_app_template_version=$version" >> "$GITHUB_ENV" + - name: Debug preset before generation + run: | + echo "=== Preset Configuration Debug ===" + node -e "const config = require('./e2e/config.js'); console.log('Preset for retail-app-private-client:', config.PRESET['retail-app-private-client'])" + echo "" + echo "=== Program.json preset content ===" + jq '.programs.presets[] | select(.id == "retail-react-app-private-slas-client")' packages/pwa-kit-create-app/program.json + echo "" + - name: Generate Retail App Private Client id: generate_app_private_client uses: ./.github/actions/e2e_generate_app @@ -368,8 +377,13 @@ jobs: PROJECT_KEY: "retail-app-private-client" TEMPLATE_VERSION: ${{ env.retail_app_template_version }} - - name: Debug - Show generated app config + - name: Debug - Show generated app config and preset usage run: | + echo "=== Generation Command Debug ===" + echo "PROJECT_KEY: retail-app-private-client" + echo "PRESET: retail-react-app-private-slas-client" + echo "TEMPLATE_VERSION: ${{ env.retail_app_template_version }}" + echo "" echo "=== Generated App Structure ===" ls -la ${{ steps.generate_app_private_client.outputs.project_path }} echo "" @@ -379,11 +393,20 @@ jobs: echo "=== App Directory ===" ls -la ${{ steps.generate_app_private_client.outputs.project_path }}/app/ || echo "No app directory found" echo "" + echo "=== Overrides Directory (if extensibility enabled) ===" + ls -la ${{ steps.generate_app_private_client.outputs.project_path }}/overrides/ || echo "No overrides directory found" + echo "" echo "=== Generated config/default.js Content ===" cat ${{ steps.generate_app_private_client.outputs.project_path }}/config/default.js || echo "config/default.js not found" echo "" echo "=== Generated app/config/default.js Content (if exists) ===" cat ${{ steps.generate_app_private_client.outputs.project_path }}/app/config/default.js || echo "app/config/default.js not found" + echo "" + echo "=== Generated overrides/config/default.js Content (if exists) ===" + cat ${{ steps.generate_app_private_client.outputs.project_path }}/overrides/config/default.js || echo "overrides/config/default.js not found" + echo "" + echo "=== Check if template was processed correctly ===" + grep -n "project.login" ${{ steps.generate_app_private_client.outputs.project_path }}/config/default.js || echo "No project.login references found in generated config" - name: Create MRT credentials file uses: "./.github/actions/create_mrt" From ea9064b66f3ccf7d3c6379f27b7148e0ca97c669 Mon Sep 17 00:00:00 2001 From: Jang ho Jung Date: Tue, 26 Aug 2025 21:55:44 -0700 Subject: [PATCH 07/11] More debugging --- .github/workflows/e2e.yml | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index 9bed31d53c..64addaf197 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -361,7 +361,7 @@ jobs: node -e "const config = require('./e2e/config.js'); console.log('Preset for retail-app-private-client:', config.PRESET['retail-app-private-client'])" echo "" echo "=== Program.json preset content ===" - jq '.programs.presets[] | select(.id == "retail-react-app-private-slas-client")' packages/pwa-kit-create-app/program.json + jq '.presets[] | select(.id == "retail-react-app-private-slas-client")' packages/pwa-kit-create-app/program.json echo "" - name: Generate Retail App Private Client @@ -371,6 +371,26 @@ jobs: PROJECT_KEY: "retail-app-private-client" TEMPLATE_VERSION: ${{ env.retail_app_template_version }} + - name: Debug template variables (add to template temporarily) + run: | + echo "=== Adding debug to template to see actual variables ===" + TEMPLATE_FILE="packages/pwa-kit-create-app/assets/templates/@salesforce/retail-react-app/config/default.js.hbs" + # Add debug output at the top of the template + sed -i '11i\\n// DEBUG: answers.project.login.passwordless.enabled = {{answers.project.login.passwordless.enabled}}\n// DEBUG: answers.project.login.social.enabled = {{answers.project.login.social.enabled}}\n// DEBUG: answers.project.demo.enableDemoSettings = {{answers.project.demo.enableDemoSettings}}\n' "$TEMPLATE_FILE" + echo "Debug lines added to template" + + - name: Regenerate with debug template + run: | + # Clean up previous generation + rm -rf ../generated-projects/retail-app-private-client || true + # Run generation again + COMMAND="node e2e/scripts/generate-project.js --project-key retail-app-private-client" + if [[ -n "${{ env.retail_app_template_version }}" ]]; then + COMMAND="$COMMAND --templateVersion ${{ env.retail_app_template_version }}" + fi + $COMMAND + id: regenerate_debug + - name: Validate Generated Retail App Private Client uses: ./.github/actions/e2e_validate_generated_app with: From c905234130453dfa880601038a8f5f25b21b8f73 Mon Sep 17 00:00:00 2001 From: Jang ho Jung Date: Tue, 26 Aug 2025 22:00:40 -0700 Subject: [PATCH 08/11] More debugging --- .github/workflows/e2e.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index 64addaf197..4eacde08d1 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -361,7 +361,7 @@ jobs: node -e "const config = require('./e2e/config.js'); console.log('Preset for retail-app-private-client:', config.PRESET['retail-app-private-client'])" echo "" echo "=== Program.json preset content ===" - jq '.presets[] | select(.id == "retail-react-app-private-slas-client")' packages/pwa-kit-create-app/program.json + jq '.data.presets[] | select(.id == "retail-react-app-private-slas-client")' packages/pwa-kit-create-app/program.json echo "" - name: Generate Retail App Private Client From a6ba5ea795e8b7c323d976db906013657c905f15 Mon Sep 17 00:00:00 2001 From: Jang ho Jung Date: Tue, 26 Aug 2025 22:11:08 -0700 Subject: [PATCH 09/11] More debugging --- .github/workflows/e2e.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index 4eacde08d1..63ceee91cf 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -378,6 +378,12 @@ jobs: # Add debug output at the top of the template sed -i '11i\\n// DEBUG: answers.project.login.passwordless.enabled = {{answers.project.login.passwordless.enabled}}\n// DEBUG: answers.project.login.social.enabled = {{answers.project.login.social.enabled}}\n// DEBUG: answers.project.demo.enableDemoSettings = {{answers.project.demo.enableDemoSettings}}\n' "$TEMPLATE_FILE" echo "Debug lines added to template" + + # Temporarily commit the debug changes to allow lerna publish + git config --global user.email "ci@example.com" + git config --global user.name "CI Debug" + git add "$TEMPLATE_FILE" + git commit -m "Temporary debug changes to template" || echo "Already committed" - name: Regenerate with debug template run: | @@ -391,6 +397,12 @@ jobs: $COMMAND id: regenerate_debug + - name: Restore template file after debug + if: always() + run: | + # Revert the debug changes + git reset --hard HEAD~1 || echo "Failed to reset, template might remain modified" + - name: Validate Generated Retail App Private Client uses: ./.github/actions/e2e_validate_generated_app with: From 26e859ed3427b8813c4ed565eb1980b6e5d27a7b Mon Sep 17 00:00:00 2001 From: Jang ho Jung Date: Tue, 26 Aug 2025 22:39:55 -0700 Subject: [PATCH 10/11] Debugging --- .github/workflows/e2e.yml | 43 ++++++++++--------- .../assets/bootstrap/js/config/default.js.hbs | 8 ++++ .../retail-react-app/config/default.js.hbs | 8 ++++ 3 files changed, 38 insertions(+), 21 deletions(-) diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index 63ceee91cf..ec1d7d8ebc 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -375,9 +375,15 @@ jobs: run: | echo "=== Adding debug to template to see actual variables ===" TEMPLATE_FILE="packages/pwa-kit-create-app/assets/templates/@salesforce/retail-react-app/config/default.js.hbs" - # Add debug output at the top of the template - sed -i '11i\\n// DEBUG: answers.project.login.passwordless.enabled = {{answers.project.login.passwordless.enabled}}\n// DEBUG: answers.project.login.social.enabled = {{answers.project.login.social.enabled}}\n// DEBUG: answers.project.demo.enableDemoSettings = {{answers.project.demo.enableDemoSettings}}\n' "$TEMPLATE_FILE" - echo "Debug lines added to template" + + # Create backup + cp "$TEMPLATE_FILE" "$TEMPLATE_FILE.backup" + + # Add debug output after the copyright header (around line 10) + sed -i '10a\\n// DEBUG: Full context dump\n// answers = {{json answers}}\n// answers.project.login.passwordless.enabled = {{answers.project.login.passwordless.enabled}}\n// answers.project.login.social.enabled = {{answers.project.login.social.enabled}}\n' "$TEMPLATE_FILE" + + echo "Debug lines added to template - showing changes:" + head -20 "$TEMPLATE_FILE" # Temporarily commit the debug changes to allow lerna publish git config --global user.email "ci@example.com" @@ -416,29 +422,24 @@ jobs: echo "PRESET: retail-react-app-private-slas-client" echo "TEMPLATE_VERSION: ${{ env.retail_app_template_version }}" echo "" - echo "=== Generated App Structure ===" - ls -la ${{ steps.generate_app_private_client.outputs.project_path }} + echo "=== Template Files Check ===" + echo "Checking if debug was added to template file:" + grep -n "DEBUG:" packages/pwa-kit-create-app/assets/templates/@salesforce/retail-react-app/config/default.js.hbs || echo "No debug lines found in template" echo "" - echo "=== Config Directory ===" - ls -la ${{ steps.generate_app_private_client.outputs.project_path }}/config/ || echo "No config directory found" + echo "Checking if login template logic exists:" + grep -n "answers.project.login" packages/pwa-kit-create-app/assets/templates/@salesforce/retail-react-app/config/default.js.hbs || echo "No login template logic found" echo "" - echo "=== App Directory ===" - ls -la ${{ steps.generate_app_private_client.outputs.project_path }}/app/ || echo "No app directory found" - echo "" - echo "=== Overrides Directory (if extensibility enabled) ===" - ls -la ${{ steps.generate_app_private_client.outputs.project_path }}/overrides/ || echo "No overrides directory found" - echo "" - echo "=== Generated config/default.js Content ===" - cat ${{ steps.generate_app_private_client.outputs.project_path }}/config/default.js || echo "config/default.js not found" + echo "=== Generated App Structure ===" + ls -la ${{ steps.generate_app_private_client.outputs.project_path }} echo "" - echo "=== Generated app/config/default.js Content (if exists) ===" - cat ${{ steps.generate_app_private_client.outputs.project_path }}/app/config/default.js || echo "app/config/default.js not found" + echo "=== Generated config/default.js Content (first 20 lines) ===" + head -20 ${{ steps.generate_app_private_client.outputs.project_path }}/config/default.js || echo "config/default.js not found" echo "" - echo "=== Generated overrides/config/default.js Content (if exists) ===" - cat ${{ steps.generate_app_private_client.outputs.project_path }}/overrides/config/default.js || echo "overrides/config/default.js not found" + echo "=== Generated config login section ===" + grep -A 20 "login:" ${{ steps.generate_app_private_client.outputs.project_path }}/config/default.js || echo "No login section found" echo "" - echo "=== Check if template was processed correctly ===" - grep -n "project.login" ${{ steps.generate_app_private_client.outputs.project_path }}/config/default.js || echo "No project.login references found in generated config" + echo "=== Check if debug comments exist in generated file ===" + grep "DEBUG:" ${{ steps.generate_app_private_client.outputs.project_path }}/config/default.js || echo "No debug comments found in generated config" - name: Create MRT credentials file uses: "./.github/actions/create_mrt" diff --git a/packages/pwa-kit-create-app/assets/bootstrap/js/config/default.js.hbs b/packages/pwa-kit-create-app/assets/bootstrap/js/config/default.js.hbs index 6bf1665842..5c99f0e859 100644 --- a/packages/pwa-kit-create-app/assets/bootstrap/js/config/default.js.hbs +++ b/packages/pwa-kit-create-app/assets/bootstrap/js/config/default.js.hbs @@ -45,11 +45,15 @@ module.exports = { login: { passwordless: { // Enables or disables passwordless login for the site. Defaults to: false + {{#if answers.project.login.passwordless.enabled}} + enabled: true, + {{else}} {{#if answers.project.demo.enableDemoSettings}} enabled: true, {{else}} enabled: false, {{/if}} + {{/if}} // The callback URI, which can be an absolute URL (including third-party URIs) or a relative path set up by the developer. // Required in 'callback' mode; if missing, passwordless login defaults to 'sms' mode, which requires Marketing Cloud configuration. // If the env var `PASSWORDLESS_LOGIN_CALLBACK_URI` is set, it will override the config value. @@ -60,11 +64,15 @@ module.exports = { }, social: { // Enables or disables social login for the site. Defaults to: false + {{#if answers.project.login.social.enabled}} + enabled: true, + {{else}} {{#if answers.project.demo.enableDemoSettings}} enabled: true, {{else}} enabled: false, {{/if}} + {{/if}} // The third-party identity providers supported by your app. The PWA Kit supports Google and Apple by default. // Additional IDPs will also need to be added to the IDP_CONFIG in the SocialLogin component. idps: ['google', 'apple'], diff --git a/packages/pwa-kit-create-app/assets/templates/@salesforce/retail-react-app/config/default.js.hbs b/packages/pwa-kit-create-app/assets/templates/@salesforce/retail-react-app/config/default.js.hbs index a93320a103..5bb6c0c808 100644 --- a/packages/pwa-kit-create-app/assets/templates/@salesforce/retail-react-app/config/default.js.hbs +++ b/packages/pwa-kit-create-app/assets/templates/@salesforce/retail-react-app/config/default.js.hbs @@ -45,11 +45,15 @@ module.exports = { login: { passwordless: { // Enables or disables passwordless login for the site. Defaults to: false + {{#if answers.project.login.passwordless.enabled}} + enabled: true, + {{else}} {{#if answers.project.demo.enableDemoSettings}} enabled: true, {{else}} enabled: false, {{/if}} + {{/if}} // The callback URI, which can be an absolute URL (including third-party URIs) or a relative path set up by the developer. // Required in 'callback' mode; if missing, passwordless login defaults to 'sms' mode, which requires Marketing Cloud configuration. // If the env var `PASSWORDLESS_LOGIN_CALLBACK_URI` is set, it will override the config value. @@ -60,11 +64,15 @@ module.exports = { }, social: { // Enables or disables social login for the site. Defaults to: false + {{#if answers.project.login.social.enabled}} + enabled: true, + {{else}} {{#if answers.project.demo.enableDemoSettings}} enabled: true, {{else}} enabled: false, {{/if}} + {{/if}} // The third-party identity providers supported by your app. The PWA Kit supports Google and Apple by default. // Additional IDPs will also need to be added to the IDP_CONFIG in the SocialLogin component. idps: ['google', 'apple'], From 315dc2098d8f28e868794521fba2776dd6709ccf Mon Sep 17 00:00:00 2001 From: Jang ho Jung Date: Wed, 27 Aug 2025 09:33:55 -0700 Subject: [PATCH 11/11] Move env vars into the step --- .github/workflows/e2e.yml | 73 ++------------------------------------- 1 file changed, 3 insertions(+), 70 deletions(-) diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index ec1d7d8ebc..038870b00d 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -371,76 +371,12 @@ jobs: PROJECT_KEY: "retail-app-private-client" TEMPLATE_VERSION: ${{ env.retail_app_template_version }} - - name: Debug template variables (add to template temporarily) - run: | - echo "=== Adding debug to template to see actual variables ===" - TEMPLATE_FILE="packages/pwa-kit-create-app/assets/templates/@salesforce/retail-react-app/config/default.js.hbs" - - # Create backup - cp "$TEMPLATE_FILE" "$TEMPLATE_FILE.backup" - - # Add debug output after the copyright header (around line 10) - sed -i '10a\\n// DEBUG: Full context dump\n// answers = {{json answers}}\n// answers.project.login.passwordless.enabled = {{answers.project.login.passwordless.enabled}}\n// answers.project.login.social.enabled = {{answers.project.login.social.enabled}}\n' "$TEMPLATE_FILE" - - echo "Debug lines added to template - showing changes:" - head -20 "$TEMPLATE_FILE" - - # Temporarily commit the debug changes to allow lerna publish - git config --global user.email "ci@example.com" - git config --global user.name "CI Debug" - git add "$TEMPLATE_FILE" - git commit -m "Temporary debug changes to template" || echo "Already committed" - - - name: Regenerate with debug template - run: | - # Clean up previous generation - rm -rf ../generated-projects/retail-app-private-client || true - # Run generation again - COMMAND="node e2e/scripts/generate-project.js --project-key retail-app-private-client" - if [[ -n "${{ env.retail_app_template_version }}" ]]; then - COMMAND="$COMMAND --templateVersion ${{ env.retail_app_template_version }}" - fi - $COMMAND - id: regenerate_debug - - - name: Restore template file after debug - if: always() - run: | - # Revert the debug changes - git reset --hard HEAD~1 || echo "Failed to reset, template might remain modified" - - name: Validate Generated Retail App Private Client uses: ./.github/actions/e2e_validate_generated_app with: PROJECT_KEY: "retail-app-private-client" TEMPLATE_VERSION: ${{ env.retail_app_template_version }} - - name: Debug - Show generated app config and preset usage - run: | - echo "=== Generation Command Debug ===" - echo "PROJECT_KEY: retail-app-private-client" - echo "PRESET: retail-react-app-private-slas-client" - echo "TEMPLATE_VERSION: ${{ env.retail_app_template_version }}" - echo "" - echo "=== Template Files Check ===" - echo "Checking if debug was added to template file:" - grep -n "DEBUG:" packages/pwa-kit-create-app/assets/templates/@salesforce/retail-react-app/config/default.js.hbs || echo "No debug lines found in template" - echo "" - echo "Checking if login template logic exists:" - grep -n "answers.project.login" packages/pwa-kit-create-app/assets/templates/@salesforce/retail-react-app/config/default.js.hbs || echo "No login template logic found" - echo "" - echo "=== Generated App Structure ===" - ls -la ${{ steps.generate_app_private_client.outputs.project_path }} - echo "" - echo "=== Generated config/default.js Content (first 20 lines) ===" - head -20 ${{ steps.generate_app_private_client.outputs.project_path }}/config/default.js || echo "config/default.js not found" - echo "" - echo "=== Generated config login section ===" - grep -A 20 "login:" ${{ steps.generate_app_private_client.outputs.project_path }}/config/default.js || echo "No login section found" - echo "" - echo "=== Check if debug comments exist in generated file ===" - grep "DEBUG:" ${{ steps.generate_app_private_client.outputs.project_path }}/config/default.js || echo "No debug comments found in generated config" - - name: Create MRT credentials file uses: "./.github/actions/create_mrt" with: @@ -454,12 +390,6 @@ jobs: TARGET: e2e-pwa-kit-private FLAGS: --wait - - name: Set Retail App Private Client Home - run: export RETAIL_APP_HOME=https://scaffold-pwa-e2e-pwa-kit-private.mobify-storefront.com/ - - - name: Set PWA Kit E2E Test User - run: export PWA_E2E_USER_EMAIL=e2e.pwa.kit@gmail.com PWA_E2E_USER_PASSWORD=hpv_pek-JZK_xkz0wzf - - name: Install Playwright Browsers run: npx playwright install --with-deps @@ -468,6 +398,9 @@ jobs: run: npm run test:e2e env: RUN_PRIVATE_CLIENT_TESTS: true + PWA_E2E_USER_EMAIL: "e2e.pwa.kit@gmail.com" + PWA_E2E_USER_PASSWORD: "hpv_pek-JZK_xkz0wzf" + RETAIL_APP_HOME: "https://scaffold-pwa-e2e-pwa-kit-private.mobify-storefront.com/" notify-slack-pwa-private-client: needs: [run-generator-private-client]