diff --git a/.gitattributes b/.gitattributes index 84e5cd3be..4b770aba0 100644 --- a/.gitattributes +++ b/.gitattributes @@ -2,3 +2,6 @@ # Improve highlighting for PHPStan stub files. *.stub linguist-language=PHP + +# Hide diffs for Optimization Detective snapshots. +plugins/*/tests/test-cases/*/expected.html linguist-generated=true diff --git a/plugins/embed-optimizer/tests/test-cases/all-embeds-inside-viewport/expected.html b/plugins/embed-optimizer/tests/test-cases/all-embeds-inside-viewport/expected.html index cb8b50e3c..dcef822fc 100644 --- a/plugins/embed-optimizer/tests/test-cases/all-embeds-inside-viewport/expected.html +++ b/plugins/embed-optimizer/tests/test-cases/all-embeds-inside-viewport/expected.html @@ -3,58 +3,58 @@ ... @@ -83,14 +83,14 @@
-
+
-
+
@@ -98,49 +98,49 @@
-
+
-
+
-
+
-
+
-
+
-
+
-
+
diff --git a/plugins/embed-optimizer/tests/test-cases/all-embeds-inside-viewport/set-up.php b/plugins/embed-optimizer/tests/test-cases/all-embeds-inside-viewport/set-up.php index 6ea4d7f7c..c7094d0d2 100644 --- a/plugins/embed-optimizer/tests/test-cases/all-embeds-inside-viewport/set-up.php +++ b/plugins/embed-optimizer/tests/test-cases/all-embeds-inside-viewport/set-up.php @@ -12,7 +12,7 @@ $elements[] = array_merge( $element_data, array( - 'xpath' => "/HTML/BODY/DIV/*[{$i}][self::FIGURE]/*[1][self::DIV]", + 'xpath' => "/HTML/BODY/DIV[@class='wp-site-blocks']/*[{$i}][self::FIGURE]/*[1][self::DIV]", ) ); } diff --git a/plugins/embed-optimizer/tests/test-cases/nested-figure-embed/expected.html b/plugins/embed-optimizer/tests/test-cases/nested-figure-embed/expected.html index ba37caa5c..6bd7ae318 100644 --- a/plugins/embed-optimizer/tests/test-cases/nested-figure-embed/expected.html +++ b/plugins/embed-optimizer/tests/test-cases/nested-figure-embed/expected.html @@ -3,10 +3,10 @@ ...
-
-
+
+
diff --git a/plugins/embed-optimizer/tests/test-cases/single-spotify-embed-outside-viewport-with-subsequent-script/set-up.php b/plugins/embed-optimizer/tests/test-cases/single-spotify-embed-outside-viewport-with-subsequent-script/set-up.php index e91b7b75c..6901bacc3 100644 --- a/plugins/embed-optimizer/tests/test-cases/single-spotify-embed-outside-viewport-with-subsequent-script/set-up.php +++ b/plugins/embed-optimizer/tests/test-cases/single-spotify-embed-outside-viewport-with-subsequent-script/set-up.php @@ -3,7 +3,7 @@ $test_case->populate_url_metrics( array( array( - 'xpath' => '/HTML/BODY/DIV/*[1][self::FIGURE]/*[1][self::DIV]', + 'xpath' => '/HTML/BODY/DIV[@class=\'wp-site-blocks\']/*[1][self::FIGURE]/*[1][self::DIV]', 'isLCP' => false, 'intersectionRatio' => 0, 'resizedBoundingClientRect' => array_merge( $test_case->get_sample_dom_rect(), array( 'height' => 500 ) ), diff --git a/plugins/embed-optimizer/tests/test-cases/single-twitter-embed-inside-viewport-without-resized-data/set-up.php b/plugins/embed-optimizer/tests/test-cases/single-twitter-embed-inside-viewport-without-resized-data/set-up.php index 412e1e9a8..71f70d86f 100644 --- a/plugins/embed-optimizer/tests/test-cases/single-twitter-embed-inside-viewport-without-resized-data/set-up.php +++ b/plugins/embed-optimizer/tests/test-cases/single-twitter-embed-inside-viewport-without-resized-data/set-up.php @@ -3,7 +3,7 @@ $test_case->populate_url_metrics( array( array( - 'xpath' => '/HTML/BODY/DIV/*[1][self::FIGURE]/*[1][self::DIV]', + 'xpath' => '/HTML/BODY/DIV[@class=\'wp-site-blocks\']/*[1][self::FIGURE]/*[1][self::DIV]', 'isLCP' => true, 'intersectionRatio' => 1, // Intentionally omitting resizedBoundingClientRect here to test behavior when data isn't supplied. diff --git a/plugins/embed-optimizer/tests/test-cases/single-twitter-embed-inside-viewport/expected.html b/plugins/embed-optimizer/tests/test-cases/single-twitter-embed-inside-viewport/expected.html index a41674725..11b8b714a 100644 --- a/plugins/embed-optimizer/tests/test-cases/single-twitter-embed-inside-viewport/expected.html +++ b/plugins/embed-optimizer/tests/test-cases/single-twitter-embed-inside-viewport/expected.html @@ -3,17 +3,17 @@ ...
-
+
diff --git a/plugins/embed-optimizer/tests/test-cases/single-twitter-embed-inside-viewport/set-up.php b/plugins/embed-optimizer/tests/test-cases/single-twitter-embed-inside-viewport/set-up.php index 2f9f6d1f0..fdb0b683a 100644 --- a/plugins/embed-optimizer/tests/test-cases/single-twitter-embed-inside-viewport/set-up.php +++ b/plugins/embed-optimizer/tests/test-cases/single-twitter-embed-inside-viewport/set-up.php @@ -3,7 +3,7 @@ $test_case->populate_url_metrics( array( array( - 'xpath' => '/HTML/BODY/DIV/*[1][self::FIGURE]/*[1][self::DIV]', + 'xpath' => '/HTML/BODY/DIV[@class=\'wp-site-blocks\']/*[1][self::FIGURE]/*[1][self::DIV]', 'isLCP' => true, 'intersectionRatio' => 1, 'resizedBoundingClientRect' => array_merge( $test_case->get_sample_dom_rect(), array( 'height' => 500 ) ), diff --git a/plugins/embed-optimizer/tests/test-cases/single-twitter-embed-outside-viewport-on-mobile/expected.html b/plugins/embed-optimizer/tests/test-cases/single-twitter-embed-outside-viewport-on-mobile/expected.html index 6c44678b8..42c553dab 100644 --- a/plugins/embed-optimizer/tests/test-cases/single-twitter-embed-outside-viewport-on-mobile/expected.html +++ b/plugins/embed-optimizer/tests/test-cases/single-twitter-embed-outside-viewport-on-mobile/expected.html @@ -3,17 +3,17 @@ ...
-
+
diff --git a/plugins/embed-optimizer/tests/test-cases/single-twitter-embed-outside-viewport-on-mobile/set-up.php b/plugins/embed-optimizer/tests/test-cases/single-twitter-embed-outside-viewport-on-mobile/set-up.php index 1fd211c23..d0a4528d0 100644 --- a/plugins/embed-optimizer/tests/test-cases/single-twitter-embed-outside-viewport-on-mobile/set-up.php +++ b/plugins/embed-optimizer/tests/test-cases/single-twitter-embed-outside-viewport-on-mobile/set-up.php @@ -3,7 +3,7 @@ foreach ( array_merge( od_get_breakpoint_max_widths(), array( 1000 ) ) as $i => $viewport_width ) { $elements = array( array( - 'xpath' => '/HTML/BODY/DIV/*[1][self::FIGURE]/*[1][self::DIV]', + 'xpath' => '/HTML/BODY/DIV[@class=\'wp-site-blocks\']/*[1][self::FIGURE]/*[1][self::DIV]', 'isLCP' => true, 'resizedBoundingClientRect' => array_merge( $test_case->get_sample_dom_rect(), array( 'height' => 500 + $i * 100 ) ), ), diff --git a/plugins/embed-optimizer/tests/test-cases/single-twitter-embed-outside-viewport/expected.html b/plugins/embed-optimizer/tests/test-cases/single-twitter-embed-outside-viewport/expected.html index d55d88ef8..334cb77fa 100644 --- a/plugins/embed-optimizer/tests/test-cases/single-twitter-embed-outside-viewport/expected.html +++ b/plugins/embed-optimizer/tests/test-cases/single-twitter-embed-outside-viewport/expected.html @@ -3,15 +3,15 @@ ...
-
+
diff --git a/plugins/embed-optimizer/tests/test-cases/single-twitter-embed-outside-viewport/set-up.php b/plugins/embed-optimizer/tests/test-cases/single-twitter-embed-outside-viewport/set-up.php index 0da100a0b..596e380b1 100644 --- a/plugins/embed-optimizer/tests/test-cases/single-twitter-embed-outside-viewport/set-up.php +++ b/plugins/embed-optimizer/tests/test-cases/single-twitter-embed-outside-viewport/set-up.php @@ -3,7 +3,7 @@ $test_case->populate_url_metrics( array( array( - 'xpath' => '/HTML/BODY/DIV/*[1][self::FIGURE]/*[1][self::DIV]', + 'xpath' => '/HTML/BODY/DIV[@class=\'wp-site-blocks\']/*[1][self::FIGURE]/*[1][self::DIV]', 'isLCP' => false, 'intersectionRatio' => 0, 'resizedBoundingClientRect' => array_merge( $test_case->get_sample_dom_rect(), array( 'height' => 500 ) ), diff --git a/plugins/embed-optimizer/tests/test-cases/single-wordpress-tv-embed-inside-viewport/expected.html b/plugins/embed-optimizer/tests/test-cases/single-wordpress-tv-embed-inside-viewport/expected.html index 24ec36b5b..7c3eee88f 100644 --- a/plugins/embed-optimizer/tests/test-cases/single-wordpress-tv-embed-inside-viewport/expected.html +++ b/plugins/embed-optimizer/tests/test-cases/single-wordpress-tv-embed-inside-viewport/expected.html @@ -3,10 +3,10 @@ ... @@ -15,8 +15,8 @@
-
-
+
+
diff --git a/plugins/embed-optimizer/tests/test-cases/single-wordpress-tv-embed-inside-viewport/set-up.php b/plugins/embed-optimizer/tests/test-cases/single-wordpress-tv-embed-inside-viewport/set-up.php index 1a536025b..928a1288e 100644 --- a/plugins/embed-optimizer/tests/test-cases/single-wordpress-tv-embed-inside-viewport/set-up.php +++ b/plugins/embed-optimizer/tests/test-cases/single-wordpress-tv-embed-inside-viewport/set-up.php @@ -3,7 +3,7 @@ $test_case->populate_url_metrics( array( array( - 'xpath' => '/HTML/BODY/DIV/*[1][self::FIGURE]/*[1][self::DIV]', + 'xpath' => '/HTML/BODY/DIV[@class=\'wp-site-blocks\']/*[1][self::FIGURE]/*[1][self::DIV]', 'isLCP' => true, 'intersectionRatio' => 1, 'resizedBoundingClientRect' => array_merge( $test_case->get_sample_dom_rect(), array( 'height' => 500 ) ), diff --git a/plugins/embed-optimizer/tests/test-cases/single-wordpress-tv-embed-outside-viewport-on-mobile/expected.html b/plugins/embed-optimizer/tests/test-cases/single-wordpress-tv-embed-outside-viewport-on-mobile/expected.html index cf6d4a12e..67a96c445 100644 --- a/plugins/embed-optimizer/tests/test-cases/single-wordpress-tv-embed-outside-viewport-on-mobile/expected.html +++ b/plugins/embed-optimizer/tests/test-cases/single-wordpress-tv-embed-outside-viewport-on-mobile/expected.html @@ -3,10 +3,10 @@ ... @@ -15,8 +15,8 @@
-
-
+
+
diff --git a/plugins/embed-optimizer/tests/test-cases/single-wordpress-tv-embed-outside-viewport-on-mobile/set-up.php b/plugins/embed-optimizer/tests/test-cases/single-wordpress-tv-embed-outside-viewport-on-mobile/set-up.php index 5cb633e32..cbd2bbe37 100644 --- a/plugins/embed-optimizer/tests/test-cases/single-wordpress-tv-embed-outside-viewport-on-mobile/set-up.php +++ b/plugins/embed-optimizer/tests/test-cases/single-wordpress-tv-embed-outside-viewport-on-mobile/set-up.php @@ -3,7 +3,7 @@ foreach ( array_merge( od_get_breakpoint_max_widths(), array( 1000 ) ) as $i => $viewport_width ) { $elements = array( array( - 'xpath' => '/HTML/BODY/DIV/*[1][self::FIGURE]/*[1][self::DIV]', + 'xpath' => '/HTML/BODY/DIV[@class=\'wp-site-blocks\']/*[1][self::FIGURE]/*[1][self::DIV]', 'isLCP' => true, 'resizedBoundingClientRect' => array_merge( $test_case->get_sample_dom_rect(), array( 'height' => 500 + $i * 100 ) ), ), diff --git a/plugins/embed-optimizer/tests/test-cases/single-wordpress-tv-embed-outside-viewport/expected.html b/plugins/embed-optimizer/tests/test-cases/single-wordpress-tv-embed-outside-viewport/expected.html index 7b706664c..554fe5ae8 100644 --- a/plugins/embed-optimizer/tests/test-cases/single-wordpress-tv-embed-outside-viewport/expected.html +++ b/plugins/embed-optimizer/tests/test-cases/single-wordpress-tv-embed-outside-viewport/expected.html @@ -3,16 +3,16 @@ ...
-
-
+
+
diff --git a/plugins/embed-optimizer/tests/test-cases/single-wordpress-tv-embed-outside-viewport/set-up.php b/plugins/embed-optimizer/tests/test-cases/single-wordpress-tv-embed-outside-viewport/set-up.php index e91b7b75c..6901bacc3 100644 --- a/plugins/embed-optimizer/tests/test-cases/single-wordpress-tv-embed-outside-viewport/set-up.php +++ b/plugins/embed-optimizer/tests/test-cases/single-wordpress-tv-embed-outside-viewport/set-up.php @@ -3,7 +3,7 @@ $test_case->populate_url_metrics( array( array( - 'xpath' => '/HTML/BODY/DIV/*[1][self::FIGURE]/*[1][self::DIV]', + 'xpath' => '/HTML/BODY/DIV[@class=\'wp-site-blocks\']/*[1][self::FIGURE]/*[1][self::DIV]', 'isLCP' => false, 'intersectionRatio' => 0, 'resizedBoundingClientRect' => array_merge( $test_case->get_sample_dom_rect(), array( 'height' => 500 ) ), diff --git a/plugins/embed-optimizer/tests/test-cases/single-youtube-embed-inside-viewport-with-only-mobile-url-metrics/expected.html b/plugins/embed-optimizer/tests/test-cases/single-youtube-embed-inside-viewport-with-only-mobile-url-metrics/expected.html index 400790d6e..9ee240bd6 100644 --- a/plugins/embed-optimizer/tests/test-cases/single-youtube-embed-inside-viewport-with-only-mobile-url-metrics/expected.html +++ b/plugins/embed-optimizer/tests/test-cases/single-youtube-embed-inside-viewport-with-only-mobile-url-metrics/expected.html @@ -3,15 +3,15 @@ ...
-
-
+
+
diff --git a/plugins/embed-optimizer/tests/test-cases/single-youtube-embed-inside-viewport-with-only-mobile-url-metrics/set-up.php b/plugins/embed-optimizer/tests/test-cases/single-youtube-embed-inside-viewport-with-only-mobile-url-metrics/set-up.php index bad024fc5..d649a53ae 100644 --- a/plugins/embed-optimizer/tests/test-cases/single-youtube-embed-inside-viewport-with-only-mobile-url-metrics/set-up.php +++ b/plugins/embed-optimizer/tests/test-cases/single-youtube-embed-inside-viewport-with-only-mobile-url-metrics/set-up.php @@ -7,7 +7,7 @@ 'viewport_width' => 100, 'elements' => array( array( - 'xpath' => '/HTML/BODY/DIV/*[1][self::FIGURE]/*[1][self::DIV]', + 'xpath' => '/HTML/BODY/DIV[@class=\'wp-site-blocks\']/*[1][self::FIGURE]/*[1][self::DIV]', 'isLCP' => false, 'intersectionRatio' => 1, 'resizedBoundingClientRect' => array_merge( $test_case->get_sample_dom_rect(), array( 'height' => 500 ) ), diff --git a/plugins/embed-optimizer/tests/test-cases/single-youtube-embed-inside-viewport/expected.html b/plugins/embed-optimizer/tests/test-cases/single-youtube-embed-inside-viewport/expected.html index d159a1ddf..c4d507a94 100644 --- a/plugins/embed-optimizer/tests/test-cases/single-youtube-embed-inside-viewport/expected.html +++ b/plugins/embed-optimizer/tests/test-cases/single-youtube-embed-inside-viewport/expected.html @@ -3,17 +3,17 @@ ...
-
+
diff --git a/plugins/embed-optimizer/tests/test-cases/single-youtube-embed-inside-viewport/set-up.php b/plugins/embed-optimizer/tests/test-cases/single-youtube-embed-inside-viewport/set-up.php index 2f9f6d1f0..fdb0b683a 100644 --- a/plugins/embed-optimizer/tests/test-cases/single-youtube-embed-inside-viewport/set-up.php +++ b/plugins/embed-optimizer/tests/test-cases/single-youtube-embed-inside-viewport/set-up.php @@ -3,7 +3,7 @@ $test_case->populate_url_metrics( array( array( - 'xpath' => '/HTML/BODY/DIV/*[1][self::FIGURE]/*[1][self::DIV]', + 'xpath' => '/HTML/BODY/DIV[@class=\'wp-site-blocks\']/*[1][self::FIGURE]/*[1][self::DIV]', 'isLCP' => true, 'intersectionRatio' => 1, 'resizedBoundingClientRect' => array_merge( $test_case->get_sample_dom_rect(), array( 'height' => 500 ) ), diff --git a/plugins/embed-optimizer/tests/test-cases/single-youtube-embed-outside-viewport-on-mobile/expected.html b/plugins/embed-optimizer/tests/test-cases/single-youtube-embed-outside-viewport-on-mobile/expected.html index e207715e3..ddd35463f 100644 --- a/plugins/embed-optimizer/tests/test-cases/single-youtube-embed-outside-viewport-on-mobile/expected.html +++ b/plugins/embed-optimizer/tests/test-cases/single-youtube-embed-outside-viewport-on-mobile/expected.html @@ -3,17 +3,17 @@ ...
-
+
diff --git a/plugins/embed-optimizer/tests/test-cases/single-youtube-embed-outside-viewport-on-mobile/set-up.php b/plugins/embed-optimizer/tests/test-cases/single-youtube-embed-outside-viewport-on-mobile/set-up.php index 71fa110a0..1308a20db 100644 --- a/plugins/embed-optimizer/tests/test-cases/single-youtube-embed-outside-viewport-on-mobile/set-up.php +++ b/plugins/embed-optimizer/tests/test-cases/single-youtube-embed-outside-viewport-on-mobile/set-up.php @@ -3,7 +3,7 @@ foreach ( array_merge( od_get_breakpoint_max_widths(), array( 1000 ) ) as $viewport_width ) { $elements = array( array( - 'xpath' => '/HTML/BODY/DIV/*[1][self::FIGURE]/*[1][self::DIV]', + 'xpath' => '/HTML/BODY/DIV[@class=\'wp-site-blocks\']/*[1][self::FIGURE]/*[1][self::DIV]', 'isLCP' => true, 'resizedBoundingClientRect' => array_merge( $test_case->get_sample_dom_rect(), array( 'height' => 500 ) ), ), diff --git a/plugins/embed-optimizer/tests/test-cases/single-youtube-embed-outside-viewport-with-only-mobile-url-metrics/expected.html b/plugins/embed-optimizer/tests/test-cases/single-youtube-embed-outside-viewport-with-only-mobile-url-metrics/expected.html index 7badfa2ad..6b79b28c7 100644 --- a/plugins/embed-optimizer/tests/test-cases/single-youtube-embed-outside-viewport-with-only-mobile-url-metrics/expected.html +++ b/plugins/embed-optimizer/tests/test-cases/single-youtube-embed-outside-viewport-with-only-mobile-url-metrics/expected.html @@ -3,13 +3,13 @@ ...
-
-
+
+
diff --git a/plugins/embed-optimizer/tests/test-cases/single-youtube-embed-outside-viewport-with-only-mobile-url-metrics/set-up.php b/plugins/embed-optimizer/tests/test-cases/single-youtube-embed-outside-viewport-with-only-mobile-url-metrics/set-up.php index c192b91d6..41097adef 100644 --- a/plugins/embed-optimizer/tests/test-cases/single-youtube-embed-outside-viewport-with-only-mobile-url-metrics/set-up.php +++ b/plugins/embed-optimizer/tests/test-cases/single-youtube-embed-outside-viewport-with-only-mobile-url-metrics/set-up.php @@ -7,7 +7,7 @@ 'viewport_width' => 100, 'elements' => array( array( - 'xpath' => '/HTML/BODY/DIV/*[1][self::FIGURE]/*[1][self::DIV]', + 'xpath' => '/HTML/BODY/DIV[@class=\'wp-site-blocks\']/*[1][self::FIGURE]/*[1][self::DIV]', 'isLCP' => false, 'intersectionRatio' => 0.0, 'resizedBoundingClientRect' => array_merge( $test_case->get_sample_dom_rect(), array( 'height' => 500 ) ), diff --git a/plugins/embed-optimizer/tests/test-cases/single-youtube-embed-outside-viewport/expected.html b/plugins/embed-optimizer/tests/test-cases/single-youtube-embed-outside-viewport/expected.html index 58f90072c..9e05ac2ea 100644 --- a/plugins/embed-optimizer/tests/test-cases/single-youtube-embed-outside-viewport/expected.html +++ b/plugins/embed-optimizer/tests/test-cases/single-youtube-embed-outside-viewport/expected.html @@ -3,15 +3,15 @@ ...
-
+
diff --git a/plugins/embed-optimizer/tests/test-cases/single-youtube-embed-outside-viewport/set-up.php b/plugins/embed-optimizer/tests/test-cases/single-youtube-embed-outside-viewport/set-up.php index 0da100a0b..596e380b1 100644 --- a/plugins/embed-optimizer/tests/test-cases/single-youtube-embed-outside-viewport/set-up.php +++ b/plugins/embed-optimizer/tests/test-cases/single-youtube-embed-outside-viewport/set-up.php @@ -3,7 +3,7 @@ $test_case->populate_url_metrics( array( array( - 'xpath' => '/HTML/BODY/DIV/*[1][self::FIGURE]/*[1][self::DIV]', + 'xpath' => '/HTML/BODY/DIV[@class=\'wp-site-blocks\']/*[1][self::FIGURE]/*[1][self::DIV]', 'isLCP' => false, 'intersectionRatio' => 0, 'resizedBoundingClientRect' => array_merge( $test_case->get_sample_dom_rect(), array( 'height' => 500 ) ), diff --git a/plugins/embed-optimizer/tests/test-cases/too-many-bookmarks/expected.html b/plugins/embed-optimizer/tests/test-cases/too-many-bookmarks/expected.html index 999512d0a..6d13da4a2 100644 --- a/plugins/embed-optimizer/tests/test-cases/too-many-bookmarks/expected.html +++ b/plugins/embed-optimizer/tests/test-cases/too-many-bookmarks/expected.html @@ -6,7 +6,7 @@
-
+
diff --git a/plugins/embed-optimizer/tests/test-cases/too-many-bookmarks/set-up.php b/plugins/embed-optimizer/tests/test-cases/too-many-bookmarks/set-up.php index bf8f66d63..fde24e42a 100644 --- a/plugins/embed-optimizer/tests/test-cases/too-many-bookmarks/set-up.php +++ b/plugins/embed-optimizer/tests/test-cases/too-many-bookmarks/set-up.php @@ -5,7 +5,7 @@ $test_case->populate_url_metrics( array( array( - 'xpath' => '/HTML/BODY/DIV/*[1][self::BOGUS]', + 'xpath' => '/HTML/BODY/DIV[@class=\'wp-site-blocks\']/*[1][self::BOGUS]', 'isLCP' => false, 'intersectionRatio' => 0.0, ), diff --git a/plugins/image-prioritizer/tests/test-cases/background-image-outside-viewport-on-all-breakpoints-but-not-desktop-with-fully-populated-sample-data/set-up.php b/plugins/image-prioritizer/tests/test-cases/background-image-outside-viewport-on-all-breakpoints-but-not-desktop-with-fully-populated-sample-data/set-up.php index 048869df9..5839f6eb3 100644 --- a/plugins/image-prioritizer/tests/test-cases/background-image-outside-viewport-on-all-breakpoints-but-not-desktop-with-fully-populated-sample-data/set-up.php +++ b/plugins/image-prioritizer/tests/test-cases/background-image-outside-viewport-on-all-breakpoints-but-not-desktop-with-fully-populated-sample-data/set-up.php @@ -26,7 +26,7 @@ static function () use ( $breakpoint_max_widths ) { 'viewport_width' => $non_desktop_viewport_width, 'elements' => array( array( - 'xpath' => '/HTML/BODY/DIV/*[2][self::DIV]', + 'xpath' => '/HTML/BODY/DIV[@id=\'page\']/*[2][self::DIV]', 'isLCP' => false, 'intersectionRatio' => 0.0, 'intersectionRect' => $outside_viewport_rect, @@ -47,7 +47,7 @@ static function () use ( $breakpoint_max_widths ) { 'viewport_width' => 1000, 'elements' => array( array( - 'xpath' => '/HTML/BODY/DIV/*[2][self::DIV]', + 'xpath' => '/HTML/BODY/DIV[@id=\'page\']/*[2][self::DIV]', 'isLCP' => false, 'intersectionRatio' => 0.3, ), diff --git a/plugins/image-prioritizer/tests/test-cases/background-image-outside-viewport-with-desktop-metrics-missing/expected.html b/plugins/image-prioritizer/tests/test-cases/background-image-outside-viewport-with-desktop-metrics-missing/expected.html index 4a2eaac7a..e89bacdf9 100644 --- a/plugins/image-prioritizer/tests/test-cases/background-image-outside-viewport-with-desktop-metrics-missing/expected.html +++ b/plugins/image-prioritizer/tests/test-cases/background-image-outside-viewport-with-desktop-metrics-missing/expected.html @@ -6,7 +6,7 @@

Pretend this is a super long paragraph that pushes the next div out of the initial viewport.

-
This is so background!
+
This is so background!
diff --git a/plugins/image-prioritizer/tests/test-cases/background-image-outside-viewport-with-desktop-metrics-missing/set-up.php b/plugins/image-prioritizer/tests/test-cases/background-image-outside-viewport-with-desktop-metrics-missing/set-up.php index 6653f015f..dc4dc10f4 100644 --- a/plugins/image-prioritizer/tests/test-cases/background-image-outside-viewport-with-desktop-metrics-missing/set-up.php +++ b/plugins/image-prioritizer/tests/test-cases/background-image-outside-viewport-with-desktop-metrics-missing/set-up.php @@ -24,7 +24,7 @@ static function () use ( $breakpoint_max_widths ) { 'viewport_width' => $non_desktop_viewport_width, 'elements' => array( array( - 'xpath' => '/HTML/BODY/DIV/*[2][self::DIV]', + 'xpath' => '/HTML/BODY/DIV[@id=\'page\']/*[2][self::DIV]', 'isLCP' => false, 'intersectionRatio' => 0.0, 'intersectionRect' => $outside_viewport_rect, diff --git a/plugins/image-prioritizer/tests/test-cases/common-lcp-background-image-and-lazy-loaded-background-image-outside-viewport-with-fully-populated-sample-data/set-up.php b/plugins/image-prioritizer/tests/test-cases/common-lcp-background-image-and-lazy-loaded-background-image-outside-viewport-with-fully-populated-sample-data/set-up.php index 3e76d4ce7..fe81ed23d 100644 --- a/plugins/image-prioritizer/tests/test-cases/common-lcp-background-image-and-lazy-loaded-background-image-outside-viewport-with-fully-populated-sample-data/set-up.php +++ b/plugins/image-prioritizer/tests/test-cases/common-lcp-background-image-and-lazy-loaded-background-image-outside-viewport-with-fully-populated-sample-data/set-up.php @@ -10,18 +10,18 @@ $test_case->populate_url_metrics( array( array( - 'xpath' => '/HTML/BODY/DIV/*[1][self::DIV]', + 'xpath' => '/HTML/BODY/DIV[@id=\'page\']/*[1][self::DIV]', 'isLCP' => true, ), array( - 'xpath' => '/HTML/BODY/DIV/*[3][self::DIV]', + 'xpath' => '/HTML/BODY/DIV[@id=\'page\']/*[3][self::DIV]', 'isLCP' => false, 'intersectionRatio' => 0.0, 'intersectionRect' => $outside_viewport_rect, 'boundingClientRect' => $outside_viewport_rect, ), array( - 'xpath' => '/HTML/BODY/DIV/*[4][self::DIV]', + 'xpath' => '/HTML/BODY/DIV[@id=\'page\']/*[4][self::DIV]', 'isLCP' => false, 'intersectionRatio' => 0.0, 'intersectionRect' => $outside_viewport_rect, diff --git a/plugins/image-prioritizer/tests/test-cases/common-lcp-background-image-with-fully-populated-sample-data/set-up.php b/plugins/image-prioritizer/tests/test-cases/common-lcp-background-image-with-fully-populated-sample-data/set-up.php index cb39822c3..6107e8cd8 100644 --- a/plugins/image-prioritizer/tests/test-cases/common-lcp-background-image-with-fully-populated-sample-data/set-up.php +++ b/plugins/image-prioritizer/tests/test-cases/common-lcp-background-image-with-fully-populated-sample-data/set-up.php @@ -3,7 +3,7 @@ $test_case->populate_url_metrics( array( array( - 'xpath' => '/HTML/BODY/DIV/*[1][self::DIV]', + 'xpath' => '/HTML/BODY/DIV[@id=\'page\']/*[1][self::DIV]', 'isLCP' => true, ), ) diff --git a/plugins/image-prioritizer/tests/test-cases/common-lcp-image-and-lazy-loaded-image-outside-viewport-with-fully-populated-sample-data/set-up.php b/plugins/image-prioritizer/tests/test-cases/common-lcp-image-and-lazy-loaded-image-outside-viewport-with-fully-populated-sample-data/set-up.php index ee940eae5..2bf089a7c 100644 --- a/plugins/image-prioritizer/tests/test-cases/common-lcp-image-and-lazy-loaded-image-outside-viewport-with-fully-populated-sample-data/set-up.php +++ b/plugins/image-prioritizer/tests/test-cases/common-lcp-image-and-lazy-loaded-image-outside-viewport-with-fully-populated-sample-data/set-up.php @@ -17,41 +17,41 @@ 'viewport_width' => $viewport_width, 'elements' => array( array( - 'xpath' => '/HTML/BODY/DIV/*[1][self::DIV]/*[1][self::IMG]', + 'xpath' => '/HTML/BODY/DIV[@id=\'page\']/*[1][self::DIV]/*[1][self::IMG]', 'isLCP' => true, ), array( - 'xpath' => '/HTML/BODY/DIV/*[1][self::DIV]/*[2][self::IMG]', + 'xpath' => '/HTML/BODY/DIV[@id=\'page\']/*[1][self::DIV]/*[2][self::IMG]', 'isLCP' => false, 'intersectionRatio' => 0.0, // Subsequent carousel slide. ), array( - 'xpath' => '/HTML/BODY/DIV/*[1][self::DIV]/*[3][self::IMG]', + 'xpath' => '/HTML/BODY/DIV[@id=\'page\']/*[1][self::DIV]/*[3][self::IMG]', 'isLCP' => false, 'intersectionRatio' => 0.0, // Subsequent carousel slide. ), array( - 'xpath' => '/HTML/BODY/DIV/*[3][self::IMG]', + 'xpath' => '/HTML/BODY/DIV[@id=\'page\']/*[3][self::IMG]', 'isLCP' => false, 'intersectionRatio' => 0 === $i ? 0.5 : 0.0, // Make sure that the _max_ intersection ratio is considered. ), // All are outside all initial viewports. array( - 'xpath' => '/HTML/BODY/DIV/*[5][self::IMG]', + 'xpath' => '/HTML/BODY/DIV[@id=\'page\']/*[5][self::IMG]', 'isLCP' => false, 'intersectionRatio' => 0.0, 'intersectionRect' => $outside_viewport_rect, 'boundingClientRect' => $outside_viewport_rect, ), array( - 'xpath' => '/HTML/BODY/DIV/*[6][self::IMG]', + 'xpath' => '/HTML/BODY/DIV[@id=\'page\']/*[6][self::IMG]', 'isLCP' => false, 'intersectionRatio' => 0.0, 'intersectionRect' => $outside_viewport_rect, 'boundingClientRect' => $outside_viewport_rect, ), array( - 'xpath' => '/HTML/BODY/DIV/*[7][self::IMG]', + 'xpath' => '/HTML/BODY/DIV[@id=\'page\']/*[7][self::IMG]', 'isLCP' => false, 'intersectionRatio' => 0.0, 'intersectionRect' => $outside_viewport_rect, diff --git a/plugins/image-prioritizer/tests/test-cases/common-lcp-image-with-fully-incomplete-sample-data/expected.html b/plugins/image-prioritizer/tests/test-cases/common-lcp-image-with-fully-incomplete-sample-data/expected.html index 51215d05b..6a5d64be0 100644 --- a/plugins/image-prioritizer/tests/test-cases/common-lcp-image-with-fully-incomplete-sample-data/expected.html +++ b/plugins/image-prioritizer/tests/test-cases/common-lcp-image-with-fully-incomplete-sample-data/expected.html @@ -6,8 +6,8 @@
- Foo - Bar + Foo + Bar
diff --git a/plugins/image-prioritizer/tests/test-cases/common-lcp-image-with-fully-incomplete-sample-data/set-up.php b/plugins/image-prioritizer/tests/test-cases/common-lcp-image-with-fully-incomplete-sample-data/set-up.php index 2666fb6ce..16b9cc441 100644 --- a/plugins/image-prioritizer/tests/test-cases/common-lcp-image-with-fully-incomplete-sample-data/set-up.php +++ b/plugins/image-prioritizer/tests/test-cases/common-lcp-image-with-fully-incomplete-sample-data/set-up.php @@ -12,11 +12,11 @@ 'viewport_width' => 1000, 'elements' => array( array( - 'xpath' => '/HTML/BODY/DIV/*[1][self::IMG]', + 'xpath' => '/HTML/BODY/DIV[@id=\'page\']/*[1][self::IMG]', 'isLCP' => true, ), array( - 'xpath' => '/HTML/BODY/DIV/*[2][self::IMG]', + 'xpath' => '/HTML/BODY/DIV[@id=\'page\']/*[2][self::IMG]', 'isLCP' => false, ), ), diff --git a/plugins/image-prioritizer/tests/test-cases/common-lcp-image-with-stale-sample-data/set-up.php b/plugins/image-prioritizer/tests/test-cases/common-lcp-image-with-stale-sample-data/set-up.php index 60f03a4d6..b6f41c93b 100644 --- a/plugins/image-prioritizer/tests/test-cases/common-lcp-image-with-stale-sample-data/set-up.php +++ b/plugins/image-prioritizer/tests/test-cases/common-lcp-image-with-stale-sample-data/set-up.php @@ -3,7 +3,7 @@ $test_case->populate_url_metrics( array( array( - 'xpath' => '/HTML/BODY/DIV/*[1][self::IMG]', // Note: This is intentionally not reflecting the IMG in the HTML below. + 'xpath' => '/HTML/BODY/DIV[@id=\'page\']/*[1][self::IMG]', // Note: This is intentionally not reflecting the IMG in the HTML below. 'isLCP' => true, ), ) diff --git a/plugins/image-prioritizer/tests/test-cases/different-lcp-elements-for-all-breakpoints/expected.html b/plugins/image-prioritizer/tests/test-cases/different-lcp-elements-for-all-breakpoints/expected.html index 4e1b0de92..1c31d64e1 100644 --- a/plugins/image-prioritizer/tests/test-cases/different-lcp-elements-for-all-breakpoints/expected.html +++ b/plugins/image-prioritizer/tests/test-cases/different-lcp-elements-for-all-breakpoints/expected.html @@ -10,11 +10,11 @@
- Mobile Logo - Phablet Logo - Tablet Logo - Desktop Logo - Desktop Logo + Mobile Logo + Phablet Logo + Tablet Logo + Desktop Logo + Desktop Logo
diff --git a/plugins/image-prioritizer/tests/test-cases/different-lcp-elements-for-all-breakpoints/set-up.php b/plugins/image-prioritizer/tests/test-cases/different-lcp-elements-for-all-breakpoints/set-up.php index 4f33479ff..c8f325838 100644 --- a/plugins/image-prioritizer/tests/test-cases/different-lcp-elements-for-all-breakpoints/set-up.php +++ b/plugins/image-prioritizer/tests/test-cases/different-lcp-elements-for-all-breakpoints/set-up.php @@ -13,23 +13,23 @@ static function () use ( $breakpoint_max_widths ) { $elements = array( array( 'isLCP' => false, - 'xpath' => '/HTML/BODY/DIV/*[1][self::IMG]', + 'xpath' => '/HTML/BODY/DIV[@id=\'page\']/*[1][self::IMG]', ), array( 'isLCP' => false, - 'xpath' => '/HTML/BODY/DIV/*[2][self::IMG]', + 'xpath' => '/HTML/BODY/DIV[@id=\'page\']/*[2][self::IMG]', ), array( 'isLCP' => false, - 'xpath' => '/HTML/BODY/DIV/*[3][self::IMG]', + 'xpath' => '/HTML/BODY/DIV[@id=\'page\']/*[3][self::IMG]', ), array( 'isLCP' => false, - 'xpath' => '/HTML/BODY/DIV/*[4][self::IMG]', + 'xpath' => '/HTML/BODY/DIV[@id=\'page\']/*[4][self::IMG]', ), array( 'isLCP' => false, - 'xpath' => '/HTML/BODY/DIV/*[5][self::IMG]', + 'xpath' => '/HTML/BODY/DIV[@id=\'page\']/*[5][self::IMG]', ), ); $elements[ $i ]['isLCP'] = true; diff --git a/plugins/image-prioritizer/tests/test-cases/different-lcp-elements-for-non-consecutive-viewport-groups-with-missing-data-for-middle-group/expected.html b/plugins/image-prioritizer/tests/test-cases/different-lcp-elements-for-non-consecutive-viewport-groups-with-missing-data-for-middle-group/expected.html index 075275898..255e096a8 100644 --- a/plugins/image-prioritizer/tests/test-cases/different-lcp-elements-for-non-consecutive-viewport-groups-with-missing-data-for-middle-group/expected.html +++ b/plugins/image-prioritizer/tests/test-cases/different-lcp-elements-for-non-consecutive-viewport-groups-with-missing-data-for-middle-group/expected.html @@ -8,8 +8,8 @@
- Mobile Logo - Desktop Logo + Mobile Logo + Desktop Logo
diff --git a/plugins/image-prioritizer/tests/test-cases/different-lcp-elements-for-non-consecutive-viewport-groups-with-missing-data-for-middle-group/set-up.php b/plugins/image-prioritizer/tests/test-cases/different-lcp-elements-for-non-consecutive-viewport-groups-with-missing-data-for-middle-group/set-up.php index 3f0b67e8c..de5207f4d 100644 --- a/plugins/image-prioritizer/tests/test-cases/different-lcp-elements-for-non-consecutive-viewport-groups-with-missing-data-for-middle-group/set-up.php +++ b/plugins/image-prioritizer/tests/test-cases/different-lcp-elements-for-non-consecutive-viewport-groups-with-missing-data-for-middle-group/set-up.php @@ -8,12 +8,12 @@ 'elements' => array( array( 'isLCP' => true, - 'xpath' => '/HTML/BODY/DIV/*[1][self::IMG]', + 'xpath' => '/HTML/BODY/DIV[@id=\'page\']/*[1][self::IMG]', 'intersectionRatio' => 1.0, ), array( 'isLCP' => false, - 'xpath' => '/HTML/BODY/DIV/*[2][self::IMG]', + 'xpath' => '/HTML/BODY/DIV[@id=\'page\']/*[2][self::IMG]', 'intersectionRatio' => 0.0, ), ), @@ -28,12 +28,12 @@ 'elements' => array( array( 'isLCP' => false, - 'xpath' => '/HTML/BODY/DIV/*[1][self::IMG]', + 'xpath' => '/HTML/BODY/DIV[@id=\'page\']/*[1][self::IMG]', 'intersectionRatio' => 0.0, ), array( 'isLCP' => true, - 'xpath' => '/HTML/BODY/DIV/*[2][self::IMG]', + 'xpath' => '/HTML/BODY/DIV[@id=\'page\']/*[2][self::IMG]', 'intersectionRatio' => 1.0, ), ), diff --git a/plugins/image-prioritizer/tests/test-cases/different-lcp-elements-for-two-non-consecutive-breakpoints-and-one-is-stale/expected.html b/plugins/image-prioritizer/tests/test-cases/different-lcp-elements-for-two-non-consecutive-breakpoints-and-one-is-stale/expected.html index cd3ac1393..f30af0fb8 100644 --- a/plugins/image-prioritizer/tests/test-cases/different-lcp-elements-for-two-non-consecutive-breakpoints-and-one-is-stale/expected.html +++ b/plugins/image-prioritizer/tests/test-cases/different-lcp-elements-for-two-non-consecutive-breakpoints-and-one-is-stale/expected.html @@ -6,9 +6,9 @@
- Mobile Logo + Mobile Logo

New paragraph since URL Metrics were captured!

- Desktop Logo + Desktop Logo
diff --git a/plugins/image-prioritizer/tests/test-cases/different-lcp-elements-for-two-non-consecutive-breakpoints-and-one-is-stale/set-up.php b/plugins/image-prioritizer/tests/test-cases/different-lcp-elements-for-two-non-consecutive-breakpoints-and-one-is-stale/set-up.php index 4b7db6cc5..6228509cd 100644 --- a/plugins/image-prioritizer/tests/test-cases/different-lcp-elements-for-two-non-consecutive-breakpoints-and-one-is-stale/set-up.php +++ b/plugins/image-prioritizer/tests/test-cases/different-lcp-elements-for-two-non-consecutive-breakpoints-and-one-is-stale/set-up.php @@ -15,11 +15,11 @@ static function () { 'elements' => array( array( 'isLCP' => true, - 'xpath' => '/HTML/BODY/DIV/*[1][self::IMG]', + 'xpath' => '/HTML/BODY/DIV[@id=\'page\']/*[1][self::IMG]', ), array( 'isLCP' => false, - 'xpath' => '/HTML/BODY/DIV/*[2][self::IMG]', + 'xpath' => '/HTML/BODY/DIV[@id=\'page\']/*[2][self::IMG]', ), ), ) @@ -33,11 +33,11 @@ static function () { 'elements' => array( array( 'isLCP' => false, - 'xpath' => '/HTML/BODY/DIV/*[1][self::IMG]', + 'xpath' => '/HTML/BODY/DIV[@id=\'page\']/*[1][self::IMG]', ), array( 'isLCP' => false, - 'xpath' => '/HTML/BODY/DIV/*[2][self::IMG]', + 'xpath' => '/HTML/BODY/DIV[@id=\'page\']/*[2][self::IMG]', ), ), ) @@ -51,11 +51,11 @@ static function () { 'elements' => array( array( 'isLCP' => false, - 'xpath' => '/HTML/BODY/DIV/*[1][self::IMG]', + 'xpath' => '/HTML/BODY/DIV[@id=\'page\']/*[1][self::IMG]', ), array( 'isLCP' => true, - 'xpath' => '/HTML/BODY/DIV/*[2][self::IMG]', + 'xpath' => '/HTML/BODY/DIV[@id=\'page\']/*[2][self::IMG]', ), ), ) @@ -69,11 +69,11 @@ static function () { 'elements' => array( array( 'isLCP' => false, - 'xpath' => '/HTML/BODY/DIV/*[1][self::IMG]', + 'xpath' => '/HTML/BODY/DIV[@id=\'page\']/*[1][self::IMG]', ), array( 'isLCP' => false, - 'xpath' => '/HTML/BODY/DIV/*[2][self::IMG]', + 'xpath' => '/HTML/BODY/DIV[@id=\'page\']/*[2][self::IMG]', ), ), ) diff --git a/plugins/image-prioritizer/tests/test-cases/different-lcp-elements-for-two-non-consecutive-breakpoints/expected.html b/plugins/image-prioritizer/tests/test-cases/different-lcp-elements-for-two-non-consecutive-breakpoints/expected.html index cbd0491a9..f64ff1dc5 100644 --- a/plugins/image-prioritizer/tests/test-cases/different-lcp-elements-for-two-non-consecutive-breakpoints/expected.html +++ b/plugins/image-prioritizer/tests/test-cases/different-lcp-elements-for-two-non-consecutive-breakpoints/expected.html @@ -7,8 +7,8 @@
- Mobile Logo - Desktop Logo + Mobile Logo + Desktop Logo
diff --git a/plugins/image-prioritizer/tests/test-cases/different-lcp-elements-for-two-non-consecutive-breakpoints/set-up.php b/plugins/image-prioritizer/tests/test-cases/different-lcp-elements-for-two-non-consecutive-breakpoints/set-up.php index 9c12a4adf..5853037f8 100644 --- a/plugins/image-prioritizer/tests/test-cases/different-lcp-elements-for-two-non-consecutive-breakpoints/set-up.php +++ b/plugins/image-prioritizer/tests/test-cases/different-lcp-elements-for-two-non-consecutive-breakpoints/set-up.php @@ -15,11 +15,11 @@ static function () { 'elements' => array( array( 'isLCP' => true, - 'xpath' => '/HTML/BODY/DIV/*[1][self::IMG]', + 'xpath' => '/HTML/BODY/DIV[@id=\'page\']/*[1][self::IMG]', ), array( 'isLCP' => false, - 'xpath' => '/HTML/BODY/DIV/*[2][self::IMG]', + 'xpath' => '/HTML/BODY/DIV[@id=\'page\']/*[2][self::IMG]', ), ), ) @@ -33,11 +33,11 @@ static function () { 'elements' => array( array( 'isLCP' => false, - 'xpath' => '/HTML/BODY/DIV/*[1][self::IMG]', + 'xpath' => '/HTML/BODY/DIV[@id=\'page\']/*[1][self::IMG]', ), array( 'isLCP' => false, - 'xpath' => '/HTML/BODY/DIV/*[2][self::IMG]', + 'xpath' => '/HTML/BODY/DIV[@id=\'page\']/*[2][self::IMG]', ), ), ) @@ -51,11 +51,11 @@ static function () { 'elements' => array( array( 'isLCP' => false, - 'xpath' => '/HTML/BODY/DIV/*[1][self::IMG]', + 'xpath' => '/HTML/BODY/DIV[@id=\'page\']/*[1][self::IMG]', ), array( 'isLCP' => true, - 'xpath' => '/HTML/BODY/DIV/*[2][self::IMG]', + 'xpath' => '/HTML/BODY/DIV[@id=\'page\']/*[2][self::IMG]', ), ), ) @@ -69,11 +69,11 @@ static function () { 'elements' => array( array( 'isLCP' => false, - 'xpath' => '/HTML/BODY/DIV/*[1][self::IMG]', + 'xpath' => '/HTML/BODY/DIV[@id=\'page\']/*[1][self::IMG]', ), array( 'isLCP' => false, - 'xpath' => '/HTML/BODY/DIV/*[2][self::IMG]', + 'xpath' => '/HTML/BODY/DIV[@id=\'page\']/*[2][self::IMG]', ), ), ) diff --git a/plugins/image-prioritizer/tests/test-cases/fetch-priority-high-already-on-common-lcp-image-with-fully-populated-sample-data/set-up.php b/plugins/image-prioritizer/tests/test-cases/fetch-priority-high-already-on-common-lcp-image-with-fully-populated-sample-data/set-up.php index 47f81633e..950f2c642 100644 --- a/plugins/image-prioritizer/tests/test-cases/fetch-priority-high-already-on-common-lcp-image-with-fully-populated-sample-data/set-up.php +++ b/plugins/image-prioritizer/tests/test-cases/fetch-priority-high-already-on-common-lcp-image-with-fully-populated-sample-data/set-up.php @@ -4,7 +4,7 @@ array( array( 'isLCP' => true, - 'xpath' => '/HTML/BODY/DIV/*[1][self::IMG]', + 'xpath' => '/HTML/BODY/DIV[@id=\'page\']/*[1][self::IMG]', ), ) ); diff --git a/plugins/image-prioritizer/tests/test-cases/fetch-priority-high-on-lcp-image-common-on-mobile-and-desktop-with-url-metrics-missing-in-other-groups/expected.html b/plugins/image-prioritizer/tests/test-cases/fetch-priority-high-on-lcp-image-common-on-mobile-and-desktop-with-url-metrics-missing-in-other-groups/expected.html index 1f46f3468..ba24685f4 100644 --- a/plugins/image-prioritizer/tests/test-cases/fetch-priority-high-on-lcp-image-common-on-mobile-and-desktop-with-url-metrics-missing-in-other-groups/expected.html +++ b/plugins/image-prioritizer/tests/test-cases/fetch-priority-high-on-lcp-image-common-on-mobile-and-desktop-with-url-metrics-missing-in-other-groups/expected.html @@ -7,7 +7,7 @@
- Foo + Foo
diff --git a/plugins/image-prioritizer/tests/test-cases/fetch-priority-high-on-lcp-image-common-on-mobile-and-desktop-with-url-metrics-missing-in-other-groups/set-up.php b/plugins/image-prioritizer/tests/test-cases/fetch-priority-high-on-lcp-image-common-on-mobile-and-desktop-with-url-metrics-missing-in-other-groups/set-up.php index dba2b3d3e..52c292d65 100644 --- a/plugins/image-prioritizer/tests/test-cases/fetch-priority-high-on-lcp-image-common-on-mobile-and-desktop-with-url-metrics-missing-in-other-groups/set-up.php +++ b/plugins/image-prioritizer/tests/test-cases/fetch-priority-high-on-lcp-image-common-on-mobile-and-desktop-with-url-metrics-missing-in-other-groups/set-up.php @@ -16,7 +16,7 @@ static function () use ( $breakpoint_max_widths ) { 'viewport_width' => 375, 'elements' => array( array( - 'xpath' => '/HTML/BODY/DIV/*[1][self::IMG]', + 'xpath' => '/HTML/BODY/DIV[@id=\'page\']/*[1][self::IMG]', 'isLCP' => true, ), ), @@ -31,7 +31,7 @@ static function () use ( $breakpoint_max_widths ) { 'viewport_width' => 1000, 'elements' => array( array( - 'xpath' => '/HTML/BODY/DIV/*[1][self::IMG]', + 'xpath' => '/HTML/BODY/DIV[@id=\'page\']/*[1][self::IMG]', 'isLCP' => true, ), ), diff --git a/plugins/image-prioritizer/tests/test-cases/images-located-above-or-along-initial-viewport/set-up.php b/plugins/image-prioritizer/tests/test-cases/images-located-above-or-along-initial-viewport/set-up.php index d8cadae66..4f7d08a6a 100644 --- a/plugins/image-prioritizer/tests/test-cases/images-located-above-or-along-initial-viewport/set-up.php +++ b/plugins/image-prioritizer/tests/test-cases/images-located-above-or-along-initial-viewport/set-up.php @@ -33,28 +33,28 @@ 'viewport_width' => $viewport_width, 'elements' => array( array( - 'xpath' => '/HTML/BODY/DIV/*[1][self::IMG]', + 'xpath' => '/HTML/BODY/DIV[@id=\'page\']/*[1][self::IMG]', 'isLCP' => false, 'intersectionRatio' => 0.0, 'intersectionRect' => $above_viewport_rect, 'boundingClientRect' => $above_viewport_rect, ), array( - 'xpath' => '/HTML/BODY/DIV/*[2][self::IMG]', + 'xpath' => '/HTML/BODY/DIV[@id=\'page\']/*[2][self::IMG]', 'isLCP' => false, 'intersectionRatio' => 0.0, 'intersectionRect' => $left_of_viewport_rect, 'boundingClientRect' => $left_of_viewport_rect, ), array( - 'xpath' => '/HTML/BODY/DIV/*[3][self::IMG]', + 'xpath' => '/HTML/BODY/DIV[@id=\'page\']/*[3][self::IMG]', 'isLCP' => false, 'intersectionRatio' => 0.0, 'intersectionRect' => $right_of_viewport_rect, 'boundingClientRect' => $right_of_viewport_rect, ), array( - 'xpath' => '/HTML/BODY/DIV/*[4][self::IMG]', + 'xpath' => '/HTML/BODY/DIV[@id=\'page\']/*[4][self::IMG]', 'isLCP' => false, 'intersectionRatio' => 0.0, 'intersectionRect' => $below_viewport_rect, diff --git a/plugins/image-prioritizer/tests/test-cases/img-non-native-lazy-loading/set-up.php b/plugins/image-prioritizer/tests/test-cases/img-non-native-lazy-loading/set-up.php index 88c966d7c..b0bd77140 100644 --- a/plugins/image-prioritizer/tests/test-cases/img-non-native-lazy-loading/set-up.php +++ b/plugins/image-prioritizer/tests/test-cases/img-non-native-lazy-loading/set-up.php @@ -10,7 +10,7 @@ 'viewport_width' => 1000, 'elements' => array( array( - 'xpath' => '/HTML/BODY/DIV/*[1][self::IMG]', + 'xpath' => '/HTML/BODY/DIV[@id=\'page\']/*[1][self::IMG]', 'isLCP' => true, ), ), diff --git a/plugins/image-prioritizer/tests/test-cases/multiple-videos-on-all-breakpoints/expected.html b/plugins/image-prioritizer/tests/test-cases/multiple-videos-on-all-breakpoints/expected.html index cf7beb429..6fcd36906 100644 --- a/plugins/image-prioritizer/tests/test-cases/multiple-videos-on-all-breakpoints/expected.html +++ b/plugins/image-prioritizer/tests/test-cases/multiple-videos-on-all-breakpoints/expected.html @@ -6,11 +6,11 @@
- - - - - + + + + +
diff --git a/plugins/image-prioritizer/tests/test-cases/multiple-videos-on-all-breakpoints/set-up.php b/plugins/image-prioritizer/tests/test-cases/multiple-videos-on-all-breakpoints/set-up.php index 245364eb4..83100c805 100644 --- a/plugins/image-prioritizer/tests/test-cases/multiple-videos-on-all-breakpoints/set-up.php +++ b/plugins/image-prioritizer/tests/test-cases/multiple-videos-on-all-breakpoints/set-up.php @@ -18,25 +18,25 @@ static function () use ( $breakpoint_max_widths ) { 'elements' => array( array( 'isLCP' => true, - 'xpath' => '/HTML/BODY/DIV/*[1][self::VIDEO]', + 'xpath' => '/HTML/BODY/DIV[@id=\'page\']/*[1][self::VIDEO]', 'boundingClientRect' => $test_case->get_sample_dom_rect(), 'intersectionRatio' => 1.0, ), array( 'isLCP' => false, - 'xpath' => '/HTML/BODY/DIV/*[2][self::VIDEO]', + 'xpath' => '/HTML/BODY/DIV[@id=\'page\']/*[2][self::VIDEO]', 'boundingClientRect' => $test_case->get_sample_dom_rect(), 'intersectionRatio' => 0.1, ), array( 'isLCP' => false, - 'xpath' => '/HTML/BODY/DIV/*[3][self::VIDEO]', + 'xpath' => '/HTML/BODY/DIV[@id=\'page\']/*[3][self::VIDEO]', 'boundingClientRect' => $test_case->get_sample_dom_rect(), 'intersectionRatio' => 0.0, ), array( 'isLCP' => false, - 'xpath' => '/HTML/BODY/DIV/*[4][self::VIDEO]', + 'xpath' => '/HTML/BODY/DIV[@id=\'page\']/*[4][self::VIDEO]', 'boundingClientRect' => $test_case->get_sample_dom_rect(), 'intersectionRatio' => 0.0, ), diff --git a/plugins/image-prioritizer/tests/test-cases/multiple-videos-with-desktop-metrics-missing/expected.html b/plugins/image-prioritizer/tests/test-cases/multiple-videos-with-desktop-metrics-missing/expected.html index d6b78a2d9..c3ccef493 100644 --- a/plugins/image-prioritizer/tests/test-cases/multiple-videos-with-desktop-metrics-missing/expected.html +++ b/plugins/image-prioritizer/tests/test-cases/multiple-videos-with-desktop-metrics-missing/expected.html @@ -6,11 +6,11 @@
- - - - - + + + + +
diff --git a/plugins/image-prioritizer/tests/test-cases/multiple-videos-with-desktop-metrics-missing/set-up.php b/plugins/image-prioritizer/tests/test-cases/multiple-videos-with-desktop-metrics-missing/set-up.php index 65b95a21c..606b43c88 100644 --- a/plugins/image-prioritizer/tests/test-cases/multiple-videos-with-desktop-metrics-missing/set-up.php +++ b/plugins/image-prioritizer/tests/test-cases/multiple-videos-with-desktop-metrics-missing/set-up.php @@ -18,25 +18,25 @@ static function () use ( $breakpoint_max_widths ) { 'elements' => array( array( 'isLCP' => true, - 'xpath' => '/HTML/BODY/DIV/*[1][self::VIDEO]', + 'xpath' => '/HTML/BODY/DIV[@id=\'page\']/*[1][self::VIDEO]', 'boundingClientRect' => $test_case->get_sample_dom_rect(), 'intersectionRatio' => 1.0, ), array( 'isLCP' => false, - 'xpath' => '/HTML/BODY/DIV/*[2][self::VIDEO]', + 'xpath' => '/HTML/BODY/DIV[@id=\'page\']/*[2][self::VIDEO]', 'boundingClientRect' => $test_case->get_sample_dom_rect(), 'intersectionRatio' => 0.1, ), array( 'isLCP' => false, - 'xpath' => '/HTML/BODY/DIV/*[3][self::VIDEO]', + 'xpath' => '/HTML/BODY/DIV[@id=\'page\']/*[3][self::VIDEO]', 'boundingClientRect' => $test_case->get_sample_dom_rect(), 'intersectionRatio' => 0.0, ), array( 'isLCP' => false, - 'xpath' => '/HTML/BODY/DIV/*[4][self::VIDEO]', + 'xpath' => '/HTML/BODY/DIV[@id=\'page\']/*[4][self::VIDEO]', 'boundingClientRect' => $test_case->get_sample_dom_rect(), 'intersectionRatio' => 0.0, ), diff --git a/plugins/image-prioritizer/tests/test-cases/no-lcp-image-or-background-image-outside-viewport-with-populated-url-metrics/set-up.php b/plugins/image-prioritizer/tests/test-cases/no-lcp-image-or-background-image-outside-viewport-with-populated-url-metrics/set-up.php index c0a5bf173..145581fa7 100644 --- a/plugins/image-prioritizer/tests/test-cases/no-lcp-image-or-background-image-outside-viewport-with-populated-url-metrics/set-up.php +++ b/plugins/image-prioritizer/tests/test-cases/no-lcp-image-or-background-image-outside-viewport-with-populated-url-metrics/set-up.php @@ -3,7 +3,7 @@ $test_case->populate_url_metrics( array( array( - 'xpath' => '/HTML/BODY/DIV/*[1][self::H1]', + 'xpath' => '/HTML/BODY/DIV[@id=\'page\']/*[1][self::H1]', 'isLCP' => true, ), ) diff --git a/plugins/image-prioritizer/tests/test-cases/no-url-metrics-but-server-side-heuristics-added-fetchpriority-high/expected.html b/plugins/image-prioritizer/tests/test-cases/no-url-metrics-but-server-side-heuristics-added-fetchpriority-high/expected.html index f85d6cf74..5b735e433 100644 --- a/plugins/image-prioritizer/tests/test-cases/no-url-metrics-but-server-side-heuristics-added-fetchpriority-high/expected.html +++ b/plugins/image-prioritizer/tests/test-cases/no-url-metrics-but-server-side-heuristics-added-fetchpriority-high/expected.html @@ -5,10 +5,10 @@
- Foo - Bar - Baz - Qux + Foo + Bar + Baz + Qux
diff --git a/plugins/image-prioritizer/tests/test-cases/no-url-metrics/expected.html b/plugins/image-prioritizer/tests/test-cases/no-url-metrics/expected.html index b62547c48..e65e561ff 100644 --- a/plugins/image-prioritizer/tests/test-cases/no-url-metrics/expected.html +++ b/plugins/image-prioritizer/tests/test-cases/no-url-metrics/expected.html @@ -5,9 +5,9 @@
- Foo + Foo

Pretend this is a super long paragraph that pushes the next div out of the initial viewport.

-
This is so background!
+
This is so background!
diff --git a/plugins/image-prioritizer/tests/test-cases/only-mobile-and-desktop-groups-are-populated/expected.html b/plugins/image-prioritizer/tests/test-cases/only-mobile-and-desktop-groups-are-populated/expected.html index 9d86483b0..1323295b4 100644 --- a/plugins/image-prioritizer/tests/test-cases/only-mobile-and-desktop-groups-are-populated/expected.html +++ b/plugins/image-prioritizer/tests/test-cases/only-mobile-and-desktop-groups-are-populated/expected.html @@ -23,14 +23,14 @@

Last Post

First Post

This post does have a featured image, and the server-side heuristics in WordPress cause it to get fetchpriority=high, but it should not have this since it is out of the viewport on mobile.

Pretend this is a super long paragraph that pushes the next div out of the initial viewport.

-
This is so background!
+
This is so background!
diff --git a/plugins/image-prioritizer/tests/test-cases/only-mobile-and-desktop-groups-are-populated/set-up.php b/plugins/image-prioritizer/tests/test-cases/only-mobile-and-desktop-groups-are-populated/set-up.php index 29244432e..72ff40f7e 100644 --- a/plugins/image-prioritizer/tests/test-cases/only-mobile-and-desktop-groups-are-populated/set-up.php +++ b/plugins/image-prioritizer/tests/test-cases/only-mobile-and-desktop-groups-are-populated/set-up.php @@ -27,12 +27,12 @@ static function () { 'viewport_width' => $viewport_width, 'elements' => array( array( - 'xpath' => '/HTML/BODY/DIV/*[2][self::MAIN]/*[2][self::ARTICLE]/*[2][self::FIGURE]/*[1][self::IMG]', + 'xpath' => '/HTML/BODY/DIV[@id=\'page\']/*[2][self::MAIN]/*[2][self::ARTICLE]/*[2][self::FIGURE]/*[1][self::IMG]', 'isLCP' => $viewport_width > 600, 'intersectionRatio' => $viewport_width > 600 ? 1.0 : 0.1, ), array( - 'xpath' => '/HTML/BODY/DIV/*[2][self::MAIN]/*[4][self::DIV]', + 'xpath' => '/HTML/BODY/DIV[@id=\'page\']/*[2][self::MAIN]/*[4][self::DIV]', 'isLCP' => false, 'intersectionRatio' => 0.0, 'intersectionRect' => $outside_viewport_rect, diff --git a/plugins/image-prioritizer/tests/test-cases/picture-element-as-lcp-tablet-and-desktop-metrics-missing/expected.html b/plugins/image-prioritizer/tests/test-cases/picture-element-as-lcp-tablet-and-desktop-metrics-missing/expected.html index 3c091020b..d3119732b 100644 --- a/plugins/image-prioritizer/tests/test-cases/picture-element-as-lcp-tablet-and-desktop-metrics-missing/expected.html +++ b/plugins/image-prioritizer/tests/test-cases/picture-element-as-lcp-tablet-and-desktop-metrics-missing/expected.html @@ -9,7 +9,7 @@ - Foo + Foo
diff --git a/plugins/image-prioritizer/tests/test-cases/picture-element-as-lcp-tablet-and-desktop-metrics-missing/set-up.php b/plugins/image-prioritizer/tests/test-cases/picture-element-as-lcp-tablet-and-desktop-metrics-missing/set-up.php index 414d90ee6..32acd76fd 100644 --- a/plugins/image-prioritizer/tests/test-cases/picture-element-as-lcp-tablet-and-desktop-metrics-missing/set-up.php +++ b/plugins/image-prioritizer/tests/test-cases/picture-element-as-lcp-tablet-and-desktop-metrics-missing/set-up.php @@ -22,7 +22,7 @@ static function () use ( $breakpoint_max_widths ) { 'viewport_width' => $viewport_width, 'elements' => array( array( - 'xpath' => '/HTML/BODY/DIV/*[1][self::PICTURE]/*[3][self::IMG]', + 'xpath' => '/HTML/BODY/DIV[@id=\'page\']/*[1][self::PICTURE]/*[3][self::IMG]', 'isLCP' => true, ), ), diff --git a/plugins/image-prioritizer/tests/test-cases/picture-element-with-lcp-image-and-fully-populated-sample-data/set-up.php b/plugins/image-prioritizer/tests/test-cases/picture-element-with-lcp-image-and-fully-populated-sample-data/set-up.php index cb673b547..2500623b0 100644 --- a/plugins/image-prioritizer/tests/test-cases/picture-element-with-lcp-image-and-fully-populated-sample-data/set-up.php +++ b/plugins/image-prioritizer/tests/test-cases/picture-element-with-lcp-image-and-fully-populated-sample-data/set-up.php @@ -12,7 +12,7 @@ static function () use ( $breakpoint_max_widths ) { $test_case->populate_url_metrics( array( array( - 'xpath' => '/HTML/BODY/DIV/*[1][self::PICTURE]/*[2][self::IMG]', + 'xpath' => '/HTML/BODY/DIV[@id=\'page\']/*[1][self::PICTURE]/*[2][self::IMG]', 'isLCP' => true, ), ) diff --git a/plugins/image-prioritizer/tests/test-cases/picture-element-with-source-having-media-attribute/set-up.php b/plugins/image-prioritizer/tests/test-cases/picture-element-with-source-having-media-attribute/set-up.php index cb673b547..2500623b0 100644 --- a/plugins/image-prioritizer/tests/test-cases/picture-element-with-source-having-media-attribute/set-up.php +++ b/plugins/image-prioritizer/tests/test-cases/picture-element-with-source-having-media-attribute/set-up.php @@ -12,7 +12,7 @@ static function () use ( $breakpoint_max_widths ) { $test_case->populate_url_metrics( array( array( - 'xpath' => '/HTML/BODY/DIV/*[1][self::PICTURE]/*[2][self::IMG]', + 'xpath' => '/HTML/BODY/DIV[@id=\'page\']/*[1][self::PICTURE]/*[2][self::IMG]', 'isLCP' => true, ), ) diff --git a/plugins/image-prioritizer/tests/test-cases/picture-element-with-source-missing-type-attribute/set-up.php b/plugins/image-prioritizer/tests/test-cases/picture-element-with-source-missing-type-attribute/set-up.php index cb673b547..2500623b0 100644 --- a/plugins/image-prioritizer/tests/test-cases/picture-element-with-source-missing-type-attribute/set-up.php +++ b/plugins/image-prioritizer/tests/test-cases/picture-element-with-source-missing-type-attribute/set-up.php @@ -12,7 +12,7 @@ static function () use ( $breakpoint_max_widths ) { $test_case->populate_url_metrics( array( array( - 'xpath' => '/HTML/BODY/DIV/*[1][self::PICTURE]/*[2][self::IMG]', + 'xpath' => '/HTML/BODY/DIV[@id=\'page\']/*[1][self::PICTURE]/*[2][self::IMG]', 'isLCP' => true, ), ) diff --git a/plugins/image-prioritizer/tests/test-cases/responsive-background-images/set-up.php b/plugins/image-prioritizer/tests/test-cases/responsive-background-images/set-up.php index f31160ed0..e79cafd61 100644 --- a/plugins/image-prioritizer/tests/test-cases/responsive-background-images/set-up.php +++ b/plugins/image-prioritizer/tests/test-cases/responsive-background-images/set-up.php @@ -26,7 +26,7 @@ static function () use ( $mobile_breakpoint, $tablet_breakpoint ): array { array( 'viewport_width' => $viewport_width, 'element' => array( - 'xpath' => sprintf( '/HTML/BODY/DIV/*[%d][self::DIV]', $div_index + 1 ), + 'xpath' => sprintf( '/HTML/BODY/DIV[@id=\'page\']/*[%d][self::DIV]', $div_index + 1 ), 'isLCP' => true, ), ) diff --git a/plugins/image-prioritizer/tests/test-cases/url-metric-only-captured-for-one-breakpoint/expected.html b/plugins/image-prioritizer/tests/test-cases/url-metric-only-captured-for-one-breakpoint/expected.html index d0dd1329d..0e045721b 100644 --- a/plugins/image-prioritizer/tests/test-cases/url-metric-only-captured-for-one-breakpoint/expected.html +++ b/plugins/image-prioritizer/tests/test-cases/url-metric-only-captured-for-one-breakpoint/expected.html @@ -8,7 +8,7 @@
- Foo + Foo
diff --git a/plugins/image-prioritizer/tests/test-cases/url-metric-only-captured-for-one-breakpoint/set-up.php b/plugins/image-prioritizer/tests/test-cases/url-metric-only-captured-for-one-breakpoint/set-up.php index 568a112cd..68190d206 100644 --- a/plugins/image-prioritizer/tests/test-cases/url-metric-only-captured-for-one-breakpoint/set-up.php +++ b/plugins/image-prioritizer/tests/test-cases/url-metric-only-captured-for-one-breakpoint/set-up.php @@ -7,7 +7,7 @@ 'viewport_width' => 400, 'element' => array( 'isLCP' => true, - 'xpath' => '/HTML/BODY/DIV/*[1][self::IMG]', + 'xpath' => '/HTML/BODY/DIV[@id=\'page\']/*[1][self::IMG]', ), ) ) diff --git a/plugins/image-prioritizer/tests/test-cases/video-with-large-poster-and-desktop-url-metrics-collected/expected.html b/plugins/image-prioritizer/tests/test-cases/video-with-large-poster-and-desktop-url-metrics-collected/expected.html index 648472749..659752173 100644 --- a/plugins/image-prioritizer/tests/test-cases/video-with-large-poster-and-desktop-url-metrics-collected/expected.html +++ b/plugins/image-prioritizer/tests/test-cases/video-with-large-poster-and-desktop-url-metrics-collected/expected.html @@ -5,7 +5,7 @@
-