From 83fdb7b885071109044c27e952e67d85413ff1d7 Mon Sep 17 00:00:00 2001 From: Theo <328805+theodesp@users.noreply.github.com> Date: Fri, 12 Apr 2024 13:14:49 +0100 Subject: [PATCH] Acceptance Tests: Attempt to fix preview tests --- .../faustwp/tests/acceptance/CustomPostTypeCest.php | 12 ++++++++---- plugins/faustwp/tests/acceptance/PostPreviewCest.php | 2 +- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/plugins/faustwp/tests/acceptance/CustomPostTypeCest.php b/plugins/faustwp/tests/acceptance/CustomPostTypeCest.php index 743dff96a..4b4c416a6 100644 --- a/plugins/faustwp/tests/acceptance/CustomPostTypeCest.php +++ b/plugins/faustwp/tests/acceptance/CustomPostTypeCest.php @@ -36,13 +36,17 @@ public function i_can_view_the_custom_post_type_preview_link(AcceptanceTester $I $I->loginAsAdmin(); $I->amEditingPostWithId($cpt_id); - $I->click('div.components-guide .components-modal__header button.components-button'); $I->click('button.editor-preview-dropdown__toggle'); $I->wait(4); // Wait for previewlinks.js to modify button href. $I->seeLink( - 'Preview in new tab', - "${front_end_url}/document/${cpt_name}/?preview=true&previewPathname=" . rawurlencode("/document/cpt-document-preview/") . "&p=${cpt_id}&typeName=Document", - ); + 'Preview in new tab', + "${front_end_url}/${post_name}/?preview=true", + ); + + $I->click('Preview in new tab'); + $I->switchToNextTab(); + $I->wait(14); // Wait for authentication + $I->see($post_title, 'section h1'); } } diff --git a/plugins/faustwp/tests/acceptance/PostPreviewCest.php b/plugins/faustwp/tests/acceptance/PostPreviewCest.php index cd2dc200e..697e997a4 100644 --- a/plugins/faustwp/tests/acceptance/PostPreviewCest.php +++ b/plugins/faustwp/tests/acceptance/PostPreviewCest.php @@ -27,7 +27,7 @@ public function i_can_view_the_post_preview_link(AcceptanceTester $I) $I->wait(4); // Wait for previewlinks.js to modify button href. $I->seeLink( 'Preview in new tab', - "${front_end_url}/${post_name}/?preview=true&previewPathname=" . rawurlencode("/post-preview-post/") . "&p=${post_id}&typeName=Post", + "${front_end_url}/${post_name}/?preview=true", ); $I->click('Preview in new tab');