Skip to content
Open
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
6ed84eb
Add E2E tests proxy auth plugin to fake user authentication and grant…
eugene-manuilov Mar 13, 2026
49d77ca
Add support for enabling feature flags in Playwright E2E tests via an…
eugene-manuilov Mar 13, 2026
9c82fa8
Add Playwright test for email reporting UI.
eugene-manuilov Mar 13, 2026
f5c626d
Merge remote-tracking branch 'origin/infrastructure/11912-playwright-…
eugene-manuilov Mar 16, 2026
fc2f995
Update tests for email-reporting settings.
eugene-manuilov Mar 16, 2026
dd644fa
Update the email reporting test to verify subscription selection proc…
eugene-manuilov Mar 16, 2026
1c6f3e1
Merge remote-tracking branch 'origin/develop' into infrastructure/117…
eugene-manuilov Mar 17, 2026
5ddbe53
De-duplicate PHP errors reported during tests to avoid redundant output.
eugene-manuilov Mar 17, 2026
810e8b4
Update snapshots.
eugene-manuilov Mar 17, 2026
c6ce9c6
Update the wp fixture to be able to trigger rest apis.
eugene-manuilov Mar 18, 2026
af5e61c
Add email reporting test to verify actual email delivery.
eugene-manuilov Mar 18, 2026
4953064
Add the ability to use fixtures for playwright tests.
eugene-manuilov Mar 18, 2026
ac42166
Add the mu-plugin that sets the reference date to 2026-01-01 to make …
eugene-manuilov Mar 18, 2026
0b10193
Update the client factory to let us add custom headers to api requests.
eugene-manuilov Mar 18, 2026
26f8d77
Implement email delivery testing.
eugene-manuilov Mar 18, 2026
11a84cb
Refactor the email reporting tests a bit.
eugene-manuilov Mar 18, 2026
9b5ab2b
Merge remote-tracking branch 'origin/develop' into infrastructure/117…
eugene-manuilov Mar 18, 2026
582a1f9
Add emails export in case there are orphans after test runs.
eugene-manuilov Mar 19, 2026
3ea71af
Build Playwright fixtures service image.
eugene-manuilov Mar 19, 2026
abace2b
Update fixtures to have correct dates.
eugene-manuilov Mar 19, 2026
90c4041
Revert email exporting from the playwright workflow.
eugene-manuilov Mar 19, 2026
1a2e820
Update playwright documentation.
eugene-manuilov Mar 19, 2026
f40bd07
Merge remote-tracking branch 'origin/develop' into infrastructure/117…
eugene-manuilov Mar 19, 2026
998c3ee
Adjust fixtures after date ranges change.
eugene-manuilov Mar 19, 2026
7233d75
Merge remote-tracking branch 'origin/develop' into infrastructure/117…
eugene-manuilov Mar 23, 2026
25c319a
Merge remote-tracking branch 'origin/develop' into infrastructure/117…
eugene-manuilov Mar 30, 2026
2e0659b
Update the fixture file to have fake data.
eugene-manuilov Mar 30, 2026
e90497b
Fix feedback issues.
eugene-manuilov Mar 30, 2026
d5f350e
Update email images.
eugene-manuilov Mar 30, 2026
0dac238
Rename role=alert to be role=status.
eugene-manuilov Mar 30, 2026
2df9be9
Update Search Console property ID and verify site in proxy-auth plugin.
eugene-manuilov Mar 30, 2026
55748e0
Fix missing fixture issue.
eugene-manuilov Mar 30, 2026
bc7882e
Merge remote-tracking branch 'origin/develop' into infrastructure/117…
eugene-manuilov Mar 30, 2026
0947297
Merge remote-tracking branch 'origin/develop' into infrastructure/117…
eugene-manuilov Mar 30, 2026
24f2fbb
Merge remote-tracking branch 'origin/develop' into infrastructure/117…
eugene-manuilov Apr 2, 2026
76e11b2
Address code review feedback.
eugene-manuilov Apr 2, 2026
5bed304
Fix broken tests.
eugene-manuilov Apr 6, 2026
7c05388
Fix eslint warnings.
eugene-manuilov Apr 6, 2026
cb7ffe8
Remove the "from name" override.
eugene-manuilov Apr 6, 2026
c6245c3
Update batch ID feedback.
eugene-manuilov Apr 6, 2026
446fc7b
Merge remote-tracking branch 'origin/develop' into infrastructure/117…
eugene-manuilov Apr 6, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions assets/js/components/Notice/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ const Notice = forwardRef(
`googlesitekit-notice--${ type }`,
className
) }
role="alert"
>
{ ! hideIcon && (
<div className="googlesitekit-notice__icon">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ export default function UserSettingsSelectionPanel() {

return (
<SelectionPanel
className="googlesitekit-user-settings-selection-panel"
className="googlesitekit-user-settings-selection-panel googlesitekit-email-reporting-settings"
isOpen={ !! isOpen }
onOpen={ onSideSheetOpen }
closePanel={ closePanel }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ exports[`EmailReportingErrorNotices should render the permissions error notice w
>
<div
class="googlesitekit-notice googlesitekit-notice--error googlesitekit-email-reporting__admin-settings-notice"
role="alert"
>
<div
class="googlesitekit-notice__icon"
Expand Down Expand Up @@ -56,6 +57,7 @@ exports[`EmailReportingErrorNotices should render the report error notice when e
>
<div
class="googlesitekit-notice googlesitekit-notice--error googlesitekit-email-reporting__admin-settings-notice"
role="alert"
>
<div
class="googlesitekit-notice__icon"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ exports[`GoogleTagGatewayToggle should render in disabled state if server requir
>
<div
class="googlesitekit-notice googlesitekit-notice--warning"
role="alert"
>
<div
class="googlesitekit-notice__icon"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -513,6 +513,7 @@ exports[`KeyMetricsSetupApp initial setup flow should display the progress indic
>
<div
class="googlesitekit-notice googlesitekit-notice--success googlesitekit-toast-notice"
role="alert"
>
<div
class="googlesitekit-notice__icon"
Expand Down Expand Up @@ -1012,6 +1013,7 @@ exports[`KeyMetricsSetupApp should render correctly 1`] = `
>
<div
class="googlesitekit-notice googlesitekit-notice--success googlesitekit-toast-notice"
role="alert"
>
<div
class="googlesitekit-notice__icon"
Expand Down Expand Up @@ -1492,6 +1494,7 @@ exports[`KeyMetricsSetupApp should show an error when the save fails 1`] = `
>
<div
class="googlesitekit-notice googlesitekit-notice--error"
role="alert"
>
<div
class="googlesitekit-notice__icon"
Expand Down Expand Up @@ -1538,6 +1541,7 @@ exports[`KeyMetricsSetupApp should show an error when the save fails 1`] = `
>
<div
class="googlesitekit-notice googlesitekit-notice--success googlesitekit-toast-notice"
role="alert"
>
<div
class="googlesitekit-notice__icon"
Expand Down Expand Up @@ -2037,6 +2041,7 @@ exports[`KeyMetricsSetupApp should show the analytics setup success toast notice
>
<div
class="googlesitekit-notice googlesitekit-notice--success googlesitekit-toast-notice"
role="alert"
>
<div
class="googlesitekit-notice__icon"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ exports[`GoogleTagGatewaySetupSuccessSubtleNotification should render correctly
>
<div
class="googlesitekit-notice googlesitekit-notice--success"
role="alert"
>
<div
class="googlesitekit-notice__icon"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ exports[`WPDashboardReportError should only render one error per module when the
>
<div
class="googlesitekit-notice googlesitekit-notice--error"
role="alert"
>
<div
class="googlesitekit-notice__icon"
Expand Down Expand Up @@ -86,6 +87,7 @@ exports[`WPDashboardReportError should only render one error per module when the
>
<div
class="googlesitekit-notice googlesitekit-notice--error"
role="alert"
>
<div
class="googlesitekit-notice__icon"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ exports[`Ads EnhancedConversionsNotification should render the notification 1`]
>
<div
class="googlesitekit-notice googlesitekit-notice--info-alt"
role="alert"
>
<div
class="googlesitekit-notice__icon"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ exports[`Ads EnhancedConversionsNotification should render the notice 1`] = `
>
<div
class="googlesitekit-notice googlesitekit-notice--info"
role="alert"
>
<div
class="googlesitekit-notice__icon"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ exports[`AdBlockingRecoverySetupSuccessNotification should render notification a
>
<div
class="googlesitekit-notice googlesitekit-notice--success"
role="alert"
>
<div
class="googlesitekit-notice__icon"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ exports[`AudienceCreationNotice should render the missing scope notice if the us
>
<div
class="googlesitekit-notice googlesitekit-notice--warning"
role="alert"
>
<div
class="googlesitekit-notice__content"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@ exports[`EnhancedMeasurementActivationBanner should render the success step when
>
<div
class="googlesitekit-notice googlesitekit-notice--success"
role="alert"
>
<div
class="googlesitekit-notice__icon"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ exports[`Analytics EnhancedConversionsNotification should render the notificatio
>
<div
class="googlesitekit-notice googlesitekit-notice--info-alt"
role="alert"
>
<div
class="googlesitekit-notice__icon"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ exports[`Analytics EnhancedConversionsNotification should render the notice 1`]
>
<div
class="googlesitekit-notice googlesitekit-notice--info"
role="alert"
>
<div
class="googlesitekit-notice__icon"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ exports[`PolicyViolationSettingsNotice should render error notice with extreme v
>
<div
class="googlesitekit-notice googlesitekit-notice--error googlesitekit-policy-violation-settings-notice"
role="alert"
>
<div
class="googlesitekit-notice__icon"
Expand Down Expand Up @@ -57,6 +58,7 @@ exports[`PolicyViolationSettingsNotice should render warning notice with pending
>
<div
class="googlesitekit-notice googlesitekit-notice--warning googlesitekit-policy-violation-settings-notice"
role="alert"
>
<div
class="googlesitekit-notice__icon"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ exports[`PolicyViolationNotification should render error notification for immedi
>
<div
class="googlesitekit-notice googlesitekit-notice--error"
role="alert"
>
<div
class="googlesitekit-notice__icon"
Expand Down Expand Up @@ -95,6 +96,7 @@ exports[`PolicyViolationNotification should render warning notification for pend
>
<div
class="googlesitekit-notice googlesitekit-notice--warning"
role="alert"
>
<div
class="googlesitekit-notice__icon"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ exports[`ProductIDContributionsNotification should render correctly 1`] = `
>
<div
class="googlesitekit-notice googlesitekit-notice--new"
role="alert"
>
<div
class="googlesitekit-notice__icon"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ exports[`ProductIDSubscriptionsNotification should render correctly 1`] = `
>
<div
class="googlesitekit-notice googlesitekit-notice--warning"
role="alert"
>
<div
class="googlesitekit-notice__icon"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ exports[`SetupForm should not silently fail when there is an error 1`] = `
>
<div
class="googlesitekit-notice googlesitekit-notice--error"
role="alert"
>
<div
class="googlesitekit-notice__icon"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@

// Ensure every notice after the first notice has a margin
// so the notices don't render with no gap.
//
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stylelint blamed this and insisted it be removed. 🤷‍♂️

// See: https://github.com/google/site-kit-wp/issues/12279
.googlesitekit-notice-container:nth-of-type(n + 2) {
margin-top: $grid-gap-phone;
Expand Down
3 changes: 2 additions & 1 deletion includes/Core/Assets/Assets.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
use Google\Site_Kit\Core\Modules\Module_Sharing_Settings;
use Google\Site_Kit\Core\Permissions\Permissions;
use Google\Site_Kit\Core\Storage\Options;
use Google\Site_Kit\Core\Util\Date;
use Google\Site_Kit\Core\Util\Feature_Flags;
use WP_Dependencies;
use WP_Post_Type;
Expand Down Expand Up @@ -795,7 +796,7 @@ private function get_inline_base_data() {
'webStoriesActive' => defined( 'WEBSTORIES_VERSION' ),
'postTypes' => $this->get_post_types(),
'storagePrefix' => $this->get_storage_prefix(),
'referenceDate' => apply_filters( 'googlesitekit_reference_date', null ),
'referenceDate' => Date::reference_date(),
'productPostType' => $this->get_product_post_type(),
'anyoneCanRegister' => (bool) get_option( 'users_can_register' ),
'isMultisite' => is_multisite(),
Expand Down
10 changes: 10 additions & 0 deletions includes/Core/Authentication/Clients/Client_Factory.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,16 @@ public static function create_client( array $args ) {

$http_client = $client->getHttpClient();
$http_client_config = self::get_http_client_config( $http_client->getConfig() );

/**
* Filters the Guzzle HTTP client configuration used for Google API requests.
*
* @since n.e.x.t
*
* @param array $http_client_config Guzzle HTTP client configuration array.
*/
$http_client_config = apply_filters( 'googlesitekit_http_client_config', $http_client_config );
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd rather not add a filter just for use in E2E, but I'm not sure there is another way. Alternatively, we could conditionally only apply it in tests/e2e – WDYT?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately, i can't find another way how to do it.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After thinking about this some more, I think we can overload the access token value which we're already controlling with a filter in tests to use a plain test-access-token. We can essentially append/embed additional metadata (or just pass json in this field, encoded if necessary) and then we can pass whatever we want through to the service and it will be contained in tests. This would be extensible to other values or configuration we want to send through as well. Yes, it gets encrypted (this is necessary) but it will be decrypted before being set in the authorization header. I think this should work since we should also never need to use a fixture for an unauthenticated response. Let me know what you think 👍

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice idea, updated.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, it turned out if we do it this way, auto-authorization stops working. I had to revert it to the previous approach with the filter. I think we can create a ticket to address this challenge separately.


// In Guzzle 6+, the HTTP client is immutable, so only a new instance can be set.
$client->setHttpClient( new Client( $http_client_config ) );

Expand Down
13 changes: 10 additions & 3 deletions includes/Core/Email_Reporting/Initiator_Task.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
use DateTimeImmutable;
use Google\Site_Kit\Core\Util\BC_Functions;
use Google\Site_Kit\Core\User\Email_Reporting_Settings;
use Google\Site_Kit\Core\Util\Date;

/**
* Handles initiator cron callbacks for email reporting.
Expand Down Expand Up @@ -61,14 +62,20 @@ public function __construct( Email_Reporting_Scheduler $scheduler, Subscribed_Us
*/
public function handle_callback_action( $frequency, $scheduled_timestamp = null ) {
$timestamp = (int) $scheduled_timestamp;

if ( $timestamp <= 0 ) {
$timestamp = time();
$timestamp = Date::now();
}

$this->scheduler->schedule_next_initiator( $frequency, $timestamp );

$batch_id = wp_generate_uuid4();
/**
* Filter the unique ID to use for the current batch of emails.
*
* @since n.e.x.t
*
* @param string $batch_id The batch ID.
*/
$batch_id = apply_filters( 'googlesitekit_email_reporting_batch_id', wp_generate_uuid4() );
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See my other comment on this one, as I think we can do without it as well.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated

$user_ids = $this->subscribed_users_query->for_frequency( $frequency );

$reference_dates = self::build_reference_dates( $frequency, $timestamp );
Expand Down
39 changes: 38 additions & 1 deletion includes/Core/Util/Date.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/**
* Class Google\Site_Kit\Core\Util\URL
* Class Google\Site_Kit\Core\Util\Date
*
* @package Google\Site_Kit\Core\Util
* @copyright 2023 Google LLC
Expand All @@ -19,6 +19,43 @@
*/
class Date {

/**
* Gets the reference date.
*
* @since 1.174.0
*
* @return string|null Reference date in 'Y-m-d' format or null.
*/
public static function reference_date() {
/**
* Filter to allow setting a custom reference date for testing purposes.
*
* @since 1.174.0
*
* @return string|null Reference date in 'Y-m-d' format or null.
*/
return apply_filters( 'googlesitekit_reference_date', null );
}

/**
* Gets the current time.
*
* @since n.e.x.t
*
* @return int Current time.
*/
public static function now() {
$reference_date = self::reference_date();
if ( $reference_date ) {
$time = strtotime( $reference_date );
if ( $time ) {
return $time;
}
}

return time();
}

/**
* Parses a date range string into a start date and an end date.
*
Expand Down
Loading
Loading