Skip to content

Commit

Permalink
E2E tests: Try fixing 'networkidle' timeout errors (#51826)
Browse files Browse the repository at this point in the history
* Remove 'no-store' from the Cache-Control header when running E2E tests

* Fix PHP lint errors
  • Loading branch information
noisysocks committed Jun 23, 2023
1 parent 50a754d commit d978b0b
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions packages/e2e-tests/mu-plugins/nocache-headers.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php
/**
* Plugin Name: Gutenberg Test Plugin, No-cache Headers
* Plugin URI: https://github.com/WordPress/gutenberg
* Author: Gutenberg Team
*
* @package gutenberg-test-nocache-headers
*/

// Remove 'no-store' from the Cache-Control header set by WordPress when running
// E2E tests. This is a workaround for an issue where E2E tests time out waiting
// for 'networkidle'.
add_filter(
'nocache_headers',
static function( $headers ) {
$cache_control_parts = explode( ', ', $headers['Cache-Control'] );
$cache_control_parts = array_diff( $cache_control_parts, array( 'no-store' ) );
$headers['Cache-Control'] = implode( ', ', $cache_control_parts );
return $headers;
}
);

1 comment on commit d978b0b

@github-actions
Copy link

Choose a reason for hiding this comment

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

Flaky tests detected in d978b0b.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/5352578364
📝 Reported issues:

Please sign in to comment.