Skip to content

Commit

Permalink
Acceptance Test: Pin e2e tests to WP 6.4
Browse files Browse the repository at this point in the history
  • Loading branch information
theodesp committed Apr 12, 2024
1 parent dcb4d6d commit 48cb974
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 31 deletions.
2 changes: 1 addition & 1 deletion plugins/faustwp/.docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG WP_VERSION=latest
ARG WP_VERSION=6.4

FROM wordpress:${WP_VERSION}

Expand Down
25 changes: 6 additions & 19 deletions plugins/faustwp/tests/acceptance/CustomPostTypeCest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,6 @@

class CustomPostTypeCest
{
private function _clickElementIfPresent($I, $element)
{
try {
$I->click($element);
} catch (\PHPUnit_Framework_ExpectationFailedException $e) {
}
return;
}

public function _before(AcceptanceTester $I)
{
Expand Down Expand Up @@ -44,18 +36,13 @@ public function i_can_view_the_custom_post_type_preview_link(AcceptanceTester $I

$I->loginAsAdmin();
$I->amEditingPostWithId($cpt_id);
$this->_clickElementIfPresent($I, 'div.components-modal__header > button');
$I->click('button.editor-preview-dropdown__toggle');

$I->click('div.components-guide .components-modal__header button.components-button');
$I->click('button.block-editor-post-preview__button-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",
);

$I->click('Preview in new tab');
$I->switchToNextTab();
$I->wait(14); // Wait for authentication
$I->see($cpt_title, 'section h1');
$I->see($cpt_content, 'main.content-single .wrap p');
'Preview in new tab',
"${front_end_url}/document/${cpt_name}/?preview=true&previewPathname=" . rawurlencode("/document/cpt-document-preview/") . "&p=${cpt_id}&typeName=Document",
);
}
}
13 changes: 2 additions & 11 deletions plugins/faustwp/tests/acceptance/PostPreviewCest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,6 @@

class PostPreviewCest
{
private function _clickElementIfPresent($I, $element)
{
try {
$I->click($element);
} catch (\PHPUnit_Framework_ExpectationFailedException $e) {
}
return;
}
/**
* Ensure the nodejs site url is set as the post preview url.
*/
Expand All @@ -31,12 +23,11 @@ public function i_can_view_the_post_preview_link(AcceptanceTester $I)

$I->loginAsAdmin();
$I->amEditingPostWithId($post_id);
$this->_clickElementIfPresent($I, 'div.components-modal__header > button');
$I->click('button.editor-preview-dropdown__toggle');
$I->click('button.block-editor-post-preview__button-toggle');
$I->wait(4); // Wait for previewlinks.js to modify button href.
$I->seeLink(
'Preview in new tab',
"${front_end_url}/${post_name}/?preview=true",
"${front_end_url}/${post_name}/?preview=true&previewPathname=" . rawurlencode("/post-preview-post/") . "&p=${post_id}&typeName=Post",
);

$I->click('Preview in new tab');
Expand Down

0 comments on commit 48cb974

Please sign in to comment.