Skip to content

Commit f7a18e6

Browse files
lucadobrescuclaude
andcommitted
test: force lazy rendering in e2e env so the lazy-render spec exercises the delayed script loader
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent b8f343b commit f7a18e6

3 files changed

Lines changed: 15 additions & 1 deletion

File tree

.wp-env.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
"."
66
],
77
"themes": [],
8+
"mappings": {
9+
"wp-content/mu-plugins/visualizer-e2e-force-lazy-render.php": "./tests/e2e/config/force-lazy-render.php"
10+
},
811
"config": {
912
"WP_DEBUG": true,
1013
"WP_DEBUG_LOG": true,
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?php
2+
/**
3+
* E2E test helper (loaded as an mu-plugin via .wp-env.json).
4+
*
5+
* Charts created through the quick wizard have no `lazy_load_chart` setting,
6+
* so force lazy rendering on the frontend to exercise the delayed script
7+
* loader in lazy-render.spec.js. Elementor previews are unaffected: the
8+
* widget force-disables lazy rendering with the same filter during render.
9+
*/
10+
add_filter( 'visualizer_lazy_load_chart', '__return_true' );

tests/e2e/specs/lazy-render.spec.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ test.describe( 'Lazy rendered charts (frontend)', () => {
2424
} );
2525

2626
async function createChartOnPost( admin, page, requestUtils ) {
27-
// New charts have lazy rendering enabled by default.
27+
// Lazy rendering is forced on by tests/e2e/config/force-lazy-render.php
28+
// (mapped as an mu-plugin in .wp-env.json).
2829
const chartId = await createChartWithAdmin( admin, page );
2930

3031
const post = await requestUtils.createPost( {

0 commit comments

Comments
 (0)