Skip to content

Commit b6b72fb

Browse files
authored
Merge branch 'develop' into woopmnt-5447-backend-update-backend-for-new-challenge-forms
2 parents e110e45 + 87a381e commit b6b72fb

15 files changed

+580
-30
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Significance: patch
2+
Type: add
3+
4+
chore: add amazon pay feature flag.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Significance: patch
2+
Type: dev
3+
Comment: Dev only changes to run E2E tests with QIT.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Significance: patch
2+
Type: fix
3+
4+
fix: text color of payment method icons on checkout page when a dark background is used

client/checkout/blocks/payment-methods-logos/style.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
width: 38px;
2222
height: 24px;
2323
background-color: rgba( $gray-700, 0.1 );
24-
color: $gray-900;
24+
color: var( --wp--preset--color--contrast, $gray-900 );
2525
text-align: center;
2626
line-height: 24px;
2727
border-radius: 3px;

includes/class-wc-payments-features.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ class WC_Payments_Features {
3131
const WOOPAY_GLOBAL_THEME_SUPPORT_FLAG_NAME = '_wcpay_feature_woopay_global_theme_support';
3232
const WCPAY_DYNAMIC_CHECKOUT_PLACE_ORDER_BUTTON_FLAG_NAME = '_wcpay_feature_dynamic_checkout_place_order_button';
3333
const ACCOUNT_DETAILS_FLAG_NAME = '_wcpay_feature_account_details';
34+
const AMAZON_PAY_FLAG_NAME = '_wcpay_feature_amazon_pay';
3435

3536
/**
3637
* Indicates whether card payments are enabled for this (Stripe) account.
@@ -362,6 +363,15 @@ public static function is_account_details_enabled(): bool {
362363
return '1' === get_option( self::ACCOUNT_DETAILS_FLAG_NAME, '0' );
363364
}
364365

366+
/**
367+
* Checks whether Amazon Pay is enabled.
368+
*
369+
* @return bool
370+
*/
371+
public static function is_amazon_pay_enabled(): bool {
372+
return '1' === get_option( self::AMAZON_PAY_FLAG_NAME, '0' );
373+
}
374+
365375
/**
366376
* Returns feature flags as an array suitable for display on the front-end.
367377
*

tests/qit/config/default.env

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,11 @@
77
QIT_USER=your_qit_username
88
QIT_PASSWORD=your_qit_application_password
99

10+
# ===========================================
11+
# E2E TEST CREDENTIALS (optional - for basic connectivity testing)
12+
# ===========================================
13+
# These provide basic WooPayments plugin connectivity for E2E tests
14+
E2E_JP_SITE_ID=your_site_id_here
15+
E2E_JP_BLOG_TOKEN=your_blog_token_here
16+
E2E_JP_USER_TOKEN=your_user_token_here
17+

tests/qit/e2e-runner.sh

Lines changed: 72 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,63 @@ echo "Running E2E tests..."
2222
# Change to project root directory to build plugin
2323
cd "$WCP_ROOT"
2424

25-
# Foundation version: Simplified build process for easier testing
26-
# For this foundation PR, we'll always build to avoid complex signature computation issues
25+
# Compute a signature of sources relevant to the release build and
26+
# skip rebuilding if nothing has changed since the last build.
27+
compute_build_signature() {
28+
# Hash tracked files that affect the release artifact. This includes
29+
# sources packaged in the zip and build/config files that affect the output.
30+
git ls-files -z -- \
31+
assets \
32+
i18n \
33+
includes \
34+
languages \
35+
lib \
36+
src \
37+
templates \
38+
client \
39+
tasks/release.js \
40+
webpack \
41+
webpack.config.js \
42+
babel.config.js \
43+
package.json \
44+
package-lock.json \
45+
composer.json \
46+
composer.lock \
47+
woocommerce-payments.php \
48+
changelog.txt \
49+
readme.txt \
50+
SECURITY.md \
51+
2>/dev/null \
52+
| xargs -0 shasum -a 256 2>/dev/null \
53+
| shasum -a 256 \
54+
| awk '{print $1}'
55+
56+
# Explicitly return 0 to avoid pipefail issues
57+
return 0
58+
}
2759

2860
BUILD_HASH_FILE="$WCP_ROOT/woocommerce-payments.zip.hash"
2961

30-
# For this foundation PR, always build if zip doesn't exist or if forced
31-
if [[ -n "${WCP_FORCE_BUILD:-}" ]] || [[ ! -f "woocommerce-payments.zip" ]]; then
32-
echo "Building WooPayments plugin..."
62+
CURRENT_SIG="$(compute_build_signature)"
63+
64+
# If WCP_FORCE_BUILD is set, always rebuild
65+
if [[ -n "${WCP_FORCE_BUILD:-}" ]]; then
66+
echo "WCP_FORCE_BUILD set; forcing build of WooPayments plugin..."
3367
npm run build:release
34-
echo "foundation-build-$(date +%s)" > "$BUILD_HASH_FILE"
68+
echo "$CURRENT_SIG" > "$BUILD_HASH_FILE"
69+
elif [[ -f "woocommerce-payments.zip" && -f "$BUILD_HASH_FILE" ]]; then
70+
LAST_SIG="$(cat "$BUILD_HASH_FILE" 2>/dev/null || true)"
71+
if [[ "$CURRENT_SIG" == "$LAST_SIG" && -n "$CURRENT_SIG" ]]; then
72+
echo "No relevant changes detected since last build; skipping build."
73+
else
74+
echo "Changes detected; rebuilding WooPayments plugin..."
75+
npm run build:release
76+
echo "$CURRENT_SIG" > "$BUILD_HASH_FILE"
77+
fi
3578
else
36-
echo "Using existing woocommerce-payments.zip"
79+
echo "Building WooPayments plugin..."
80+
npm run build:release
81+
echo "$CURRENT_SIG" > "$BUILD_HASH_FILE"
3782
fi
3883

3984
# Change to QIT directory so qit.yml is automatically found
@@ -46,10 +91,27 @@ else
4691
QIT_CMD="$QIT_BINARY"
4792
fi
4893

49-
echo "Running QIT E2E foundation tests (no Jetpack credentials)..."
94+
# Pass basic Jetpack environment variables
95+
env_args=()
96+
if [[ -n "${E2E_JP_SITE_ID:-}" ]]; then
97+
env_args+=( --env "E2E_JP_SITE_ID=${E2E_JP_SITE_ID}" )
98+
fi
99+
if [[ -n "${E2E_JP_BLOG_TOKEN:-}" ]]; then
100+
env_args+=( --env "E2E_JP_BLOG_TOKEN=${E2E_JP_BLOG_TOKEN}" )
101+
fi
102+
if [[ -n "${E2E_JP_USER_TOKEN:-}" ]]; then
103+
env_args+=( --env "E2E_JP_USER_TOKEN=${E2E_JP_USER_TOKEN}" )
104+
fi
50105

51106
# Run our QIT E2E tests (qit.yml automatically loaded from current directory)
52-
"$QIT_CMD" run:e2e woocommerce-payments ./e2e \
53-
--source "$WCP_ROOT/woocommerce-payments.zip"
107+
echo "Running QIT E2E tests with Jetpack functionality..."
108+
if [ ${#env_args[@]} -eq 0 ]; then
109+
"$QIT_CMD" run:e2e woocommerce-payments ./e2e \
110+
--source "$WCP_ROOT/woocommerce-payments.zip"
111+
else
112+
"$QIT_CMD" run:e2e woocommerce-payments ./e2e \
113+
--source "$WCP_ROOT/woocommerce-payments.zip" \
114+
"${env_args[@]}"
115+
fi
54116

55117
echo "QIT E2E foundation tests completed!"

tests/qit/e2e/basic.spec.js

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,13 @@ test( 'Load home page', async ( { page } ) => {
1515
} );
1616

1717
/**
18-
* Test WooCommerce Payments onboarding flow access
19-
* Since we're running in development mode without Jetpack connection,
20-
* we expect to always land on the onboarding flow.
18+
* Test admin authentication and WooPayments plugin access
2119
*/
22-
test( 'Access WooCommerce Payments onboarding as admin', async ( { page } ) => {
20+
test( 'Access WooPayments as admin', async ( { page } ) => {
2321
// Use QIT helper to login as admin
2422
await qit.loginAsAdmin( page );
2523

26-
// Navigate to WooCommerce Payments settings
24+
// Navigate to WooPayments settings
2725
await page.goto(
2826
'/wp-admin/admin.php?page=wc-admin&path=%2Fpayments%2Foverview'
2927
);
@@ -33,13 +31,21 @@ test( 'Access WooCommerce Payments onboarding as admin', async ( { page } ) => {
3331
page.locator( 'h1:not(.screen-reader-text)' ).first()
3432
).toContainText( /Settings|Payments|Overview/, { timeout: 15000 } );
3533

36-
// In development mode without Jetpack connection, we should be on onboarding
37-
expect( page.url() ).toContain( 'onboarding' );
34+
// Check that we can successfully load the WooPayments interface
35+
// Either we get the overview (if fully connected) OR the onboarding.
36+
const isOnboarding = page.url().includes( 'onboarding' );
37+
const isOverview = page.url().includes( 'payments' );
3838

39-
// The onboarding page should load without errors
40-
await expect( page.locator( 'body' ) ).not.toHaveText(
41-
/500|404|Fatal error/
42-
);
39+
// We should be on either the onboarding or overview page (both indicate success)
40+
expect( isOnboarding || isOverview ).toBe( true );
41+
42+
// If we're on onboarding, it should be functional (not errored)
43+
if ( isOnboarding ) {
44+
// The onboarding page should load without errors
45+
await expect( page.locator( 'body' ) ).not.toHaveText(
46+
/500|404|Fatal error/
47+
);
48+
}
4349
} );
4450

4551
/**

0 commit comments

Comments
 (0)