From f85a3522f11714e523b31325248fca37419644d2 Mon Sep 17 00:00:00 2001 From: Darin Kotter Date: Thu, 10 Aug 2023 15:20:38 -0600 Subject: [PATCH] Load our custom block for all tests. This forces the editor to load in a non-iframed state which fixes issues with Cypress --- tests/test-plugin/e2e-test-plugin.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/test-plugin/e2e-test-plugin.php b/tests/test-plugin/e2e-test-plugin.php index f993da6de..381821797 100644 --- a/tests/test-plugin/e2e-test-plugin.php +++ b/tests/test-plugin/e2e-test-plugin.php @@ -95,3 +95,14 @@ function classifai_test_prepare_response( $response ) { if ( ! defined( 'FS_METHOD' ) ) { define( 'FS_METHOD', 'direct' ); } + +// Load our recommended content block to force the non-iframe editor. +// Cypress fails to run correctly when the editor is iframed. +add_action( + 'admin_init', + function() { + if ( function_exists( 'Classifai\Blocks\setup' ) ) { + Classifai\Blocks\setup(); + } + } +);