Skip to content
Draft
54 changes: 24 additions & 30 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -347,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 '.data.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
Expand All @@ -373,18 +390,17 @@ 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

# this will not include a11y tests
- name: Run Playwright tests
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]
Expand Down Expand Up @@ -413,26 +429,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 }}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ 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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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'],
Expand Down
4 changes: 3 additions & 1 deletion packages/pwa-kit-create-app/program.json
Original file line number Diff line number Diff line change
Expand Up @@ -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
},
Expand Down
18 changes: 2 additions & 16 deletions playwright.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,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',
Expand All @@ -59,20 +59,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'] }
}
]
})
Loading