Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TASK] run content_defender tests on v13 #569

Merged
merged 1 commit into from
Dec 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 2 additions & 12 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,22 +48,12 @@ jobs:
- name: Unit Tests
run: Build/Scripts/runTests.sh -p ${{ matrix.php }} -t ${{ matrix.TYPO3 }} -s unit

- name: Functional Tests v12/v11
if: matrix.TYPO3 != '13'
- name: Functional Tests
run: Build/Scripts/runTests.sh -p ${{ matrix.php }} -t ${{ matrix.TYPO3 }} -s functional

- name: Functional Tests v13
if: matrix.TYPO3 == '13'
run: PHPUNIT_EXCLUDE_GROUPS=content_defender Build/Scripts/runTests.sh -p ${{ matrix.php }} -t ${{ matrix.TYPO3 }} -s functional

- name: Acceptance Tests v12/v11
if: matrix.TYPO3 != '13'
- name: Acceptance Tests
run: Build/Scripts/runTests.sh -p ${{ matrix.php }} -t ${{ matrix.TYPO3 }} -s acceptance -- --fail-fast

- name: Acceptance Tests v13
if: matrix.TYPO3 == '13'
run: Build/Scripts/runTests.sh -p ${{ matrix.php }} -t ${{ matrix.TYPO3 }} -s acceptance -- --fail-fast --skip-group=content_defender

- name: Archive acceptance tests results
uses: actions/upload-artifact@v4
if: always()
Expand Down
4 changes: 2 additions & 2 deletions Build/Scripts/runTests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -598,7 +598,7 @@ case ${TEST_SUITE} in
composer require typo3/cms-core:^11.5 ichhabrecht/content-defender --dev -W --no-progress --no-interaction
composer prepare-tests
elif [ ${TYPO3} -eq 13 ]; then
composer require typo3/cms-core:^13.4 --dev -W --no-progress --no-interaction
composer require typo3/cms-core:^13.4 ichhabrecht/content-defender --dev -W --no-progress --no-interaction
composer prepare-tests
else
composer require typo3/cms-core:^12.4 ichhabrecht/content-defender --dev -W --no-progress --no-interaction
Expand All @@ -620,7 +620,7 @@ case ${TEST_SUITE} in
composer require typo3/cms-core:^11.5 ichhabrecht/content-defender --dev -W --no-progress --no-interaction
composer prepare-tests
elif [ ${TYPO3} -eq 13 ]; then
composer require typo3/cms-core:^13.0 --dev -W --no-progress --no-interaction
composer require typo3/cms-core:^13.4 ichhabrecht/content-defender --dev -W --no-progress --no-interaction
composer prepare-tests
else
composer require typo3/cms-core:^12.4 ichhabrecht/content-defender --dev -W --no-progress --no-interaction
Expand Down
5 changes: 0 additions & 5 deletions Build/phpstan-baseline-11-7.4.neon
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,6 @@ parameters:
count: 1
path: ../Tests/Acceptance/Support/BackendTester.php

-
message: "#^Call to an undefined static method TYPO3\\\\TestingFramework\\\\Core\\\\Acceptance\\\\Extension\\\\BackendEnvironment\\:\\:_initialize\\(\\)\\.$#"
count: 1
path: ../Tests/Acceptance/Support/Extension/BackendContainerEnvironment.php

-
message: "#^Property TYPO3\\\\TestingFramework\\\\Core\\\\Acceptance\\\\Helper\\\\AbstractPageTree\\:\\:\\$tester \\(AcceptanceTester\\) does not accept B13\\\\Container\\\\Tests\\\\Acceptance\\\\Support\\\\BackendTester\\.$#"
count: 1
Expand Down
5 changes: 0 additions & 5 deletions Build/phpstan-baseline-11.neon
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,6 @@ parameters:
count: 1
path: ../Tests/Acceptance/Support/BackendTester.php

-
message: "#^Call to an undefined static method TYPO3\\\\TestingFramework\\\\Core\\\\Acceptance\\\\Extension\\\\BackendEnvironment\\:\\:_initialize\\(\\)\\.$#"
count: 1
path: ../Tests/Acceptance/Support/Extension/BackendContainerEnvironment.php

-
message: "#^Property TYPO3\\\\TestingFramework\\\\Core\\\\Acceptance\\\\Helper\\\\AbstractPageTree\\:\\:\\$tester \\(AcceptanceTester\\) does not accept B13\\\\Container\\\\Tests\\\\Acceptance\\\\Support\\\\BackendTester\\.$#"
count: 1
Expand Down
131 changes: 96 additions & 35 deletions Tests/Acceptance/Backend/ContentDefenderCest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

use B13\Container\Tests\Acceptance\Support\BackendTester;
use B13\Container\Tests\Acceptance\Support\PageTree;
use B13\Container\Tests\Acceptance\Support\PageTreeV13;
use TYPO3\CMS\Core\Information\Typo3Version;
use TYPO3\CMS\Core\Utility\GeneralUtility;

Expand All @@ -30,32 +31,44 @@ public function _before(BackendTester $I)
/**
* @group content_defender
*/
public function canCreateChildIn2ColsContainerWithNoContentDefenderRestrictionsDefined(BackendTester $I, PageTree $pageTree): void
public function canCreateChildIn2ColsContainerWithNoContentDefenderRestrictionsDefined(BackendTester $I, PageTree $pageTree, PageTreeV13 $pageTreeV13): void
{
$I->click('Page');
$I->waitForElement('#typo3-pagetree-tree .nodes .node');
$pageTree->openPath(['home', 'pageWithDifferentContainers']);
if (GeneralUtility::makeInstance(Typo3Version::class)->getMajorVersion() < 13) {
$I->waitForElement('#typo3-pagetree-tree .nodes .node');
$pageTree->openPath(['home', 'pageWithDifferentContainers']);
} else {
$pageTreeV13->openPath(['home', 'pageWithDifferentContainers']);
}
$I->wait(0.5);
$I->switchToContentFrame();
$dataColPos = $I->getDataColPos(300, 200);
$I->waitForElement('#element-tt_content-300 [data-colpos="' . $dataColPos . '"]');
$newContentElementLabel = $I->getNewContentElementLabel();

$I->click($newContentElementLabel, '#element-tt_content-300 [data-colpos="' . $dataColPos . '"]');
$I->switchToIFrame();
$I->waitForElement('.modal-dialog');
if (GeneralUtility::makeInstance(Typo3Version::class)->getMajorVersion() > 12) {
$I->executeJS("document.querySelector('" . $I->getNewRecordWizardSelector() . "').shadowRoot.querySelector('button[data-identifier=\"default\"]').click()");
}
$I->waitForText('Header Only');
$I->see('Header Only');
$I->see('Table');
$I->see('Images Only');
}

/**
* @group content_defender
*/
public function doNotSeeNotAllowedContentElementsInNewContentElementWizard(BackendTester $I, PageTree $pageTree): void
public function doNotSeeNotAllowedContentElementsInNewContentElementWizard(BackendTester $I, PageTree $pageTree, PageTreeV13 $pageTreeV13): void
{
$I->click('Page');
$I->waitForElement('#typo3-pagetree-tree .nodes .node');
$pageTree->openPath(['home', 'pageWithContainer-3']);
if (GeneralUtility::makeInstance(Typo3Version::class)->getMajorVersion() < 13) {
$I->waitForElement('#typo3-pagetree-tree .nodes .node');
$pageTree->openPath(['home', 'pageWithContainer-3']);
} else {
$pageTreeV13->openPath(['home', 'pageWithContainer-3']);
}
$I->wait(0.5);
$I->switchToContentFrame();
$dataColPos = $I->getDataColPos(800, 200);
Expand All @@ -64,18 +77,25 @@ public function doNotSeeNotAllowedContentElementsInNewContentElementWizard(Backe
$I->click($newContentElementLabel, '#element-tt_content-800 [data-colpos="' . $dataColPos . '"]');
$I->switchToIFrame();
$I->waitForElement('.modal-dialog');
if (GeneralUtility::makeInstance(Typo3Version::class)->getMajorVersion() > 12) {
$I->executeJS("document.querySelector('" . $I->getNewRecordWizardSelector() . "').shadowRoot.querySelector('button[data-identifier=\"default\"]').click()");
}
$I->waitForText('Header Only');
$I->dontSee('Table');
$I->dontSee('Images Only');
}

/**
* @group content_defender
*/
public function doNotSeeNotAllowedContentElementsInNewContentElementWizardTriggeredByContextMenu(BackendTester $I, PageTree $pageTree): void
public function doNotSeeNotAllowedContentElementsInNewContentElementWizardTriggeredByContextMenu(BackendTester $I, PageTree $pageTree, PageTreeV13 $pageTreeV13): void
{
$I->click('Page');
$I->waitForElement('#typo3-pagetree-tree .nodes .node');
$pageTree->openPath(['home', 'pageWithContainer-3']);
if (GeneralUtility::makeInstance(Typo3Version::class)->getMajorVersion() < 13) {
$I->waitForElement('#typo3-pagetree-tree .nodes .node');
$pageTree->openPath(['home', 'pageWithContainer-3']);
} else {
$pageTreeV13->openPath(['home', 'pageWithContainer-3']);
}
$I->wait(0.5);
$I->switchToContentFrame();
$typo3Version = GeneralUtility::makeInstance(Typo3Version::class);
Expand All @@ -100,18 +120,25 @@ public function doNotSeeNotAllowedContentElementsInNewContentElementWizardTrigge
}
$I->switchToIFrame();
$I->waitForElement('.modal-dialog');
if (GeneralUtility::makeInstance(Typo3Version::class)->getMajorVersion() > 12) {
$I->executeJS("document.querySelector('" . $I->getNewRecordWizardSelector() . "').shadowRoot.querySelector('button[data-identifier=\"default\"]').click()");
}
$I->waitForText('Header Only');
$I->dontSee('Table');
$I->dontSee('Images Only');
}

/**
* @group content_defender
*/
public function doNotSeeNotAllowedContentElementsInCTypeSelectBoxWhenCreateNewElement(BackendTester $I, PageTree $pageTree)
public function doNotSeeNotAllowedContentElementsInCTypeSelectBoxWhenCreateNewElement(BackendTester $I, PageTree $pageTree, PageTreeV13 $pageTreeV13)
{
$I->click('Page');
$I->waitForElement('#typo3-pagetree-tree .nodes .node');
$pageTree->openPath(['home', 'pageWithContainer-4']);
if (GeneralUtility::makeInstance(Typo3Version::class)->getMajorVersion() < 13) {
$I->waitForElement('#typo3-pagetree-tree .nodes .node');
$pageTree->openPath(['home', 'pageWithContainer-4']);
} else {
$pageTreeV13->openPath(['home', 'pageWithContainer-4']);
}
$I->wait(0.5);
$I->switchToContentFrame();
$dataColPos = $I->getDataColPos(801, 200);
Expand All @@ -120,44 +147,59 @@ public function doNotSeeNotAllowedContentElementsInCTypeSelectBoxWhenCreateNewEl
$I->click($newContentElementLabel, '#element-tt_content-801 [data-colpos="' . $dataColPos . '"]');
$I->switchToIFrame();
$I->waitForElement('.modal-dialog');
if (GeneralUtility::makeInstance(Typo3Version::class)->getMajorVersion() > 12) {
$I->executeJS("document.querySelector('" . $I->getNewRecordWizardSelector() . "').shadowRoot.querySelector('button[data-identifier=\"default\"]').click()");
}
$I->waitForText('Header Only');
$typo3Version = GeneralUtility::makeInstance(Typo3Version::class);
if ($typo3Version->getMajorVersion() < 12) {
$I->click('Header Only');
} else {
$I->executeJS("document.querySelector('typo3-backend-new-content-element-wizard').shadowRoot.querySelector('button[data-identifier=\"common_header\"]').click()");
if ($typo3Version->getMajorVersion() < 13) {
$I->executeJS("document.querySelector('" . $I->getNewRecordWizardSelector() . "').shadowRoot.querySelector('button[data-identifier=\"common_header\"]').click()");
} else {
$I->executeJS("document.querySelector('" . $I->getNewRecordWizardSelector() . "').shadowRoot.querySelector('button[data-identifier=\"default_header\"]').click()");
}
}
$I->switchToContentFrame();
$I->wait(0.5);
$I->see('textmedia', 'select');
$I->dontSee('Table', 'select');
$I->dontSee('Images Only', 'select');
}

/**
* @group content_defender
*/
public function doNotSeeNotAllowedContentElementsInCTypeSelectBoxWhenEditAnElement(BackendTester $I, PageTree $pageTree)
public function doNotSeeNotAllowedContentElementsInCTypeSelectBoxWhenEditAnElement(BackendTester $I, PageTree $pageTree, PageTreeV13 $pageTreeV13)
{
$I->click('Page');
$I->waitForElement('#typo3-pagetree-tree .nodes .node');
$pageTree->openPath(['home', 'contentTCASelectCtype']);
if (GeneralUtility::makeInstance(Typo3Version::class)->getMajorVersion() < 13) {
$I->waitForElement('#typo3-pagetree-tree .nodes .node');
$pageTree->openPath(['home', 'contentTCASelectCtype']);
} else {
$pageTreeV13->openPath(['home', 'contentTCASelectCtype']);
}
$I->wait(0.5);
$I->switchToContentFrame();
$I->waitForElement('#element-tt_content-502 a[title="Edit"]');
$I->click('#element-tt_content-502 a[title="Edit"]');
$I->waitForElement('#EditDocumentController');
$I->see('textmedia', 'select');
$I->dontSee('Table', 'select');
$I->dontSee('Images Only', 'select');
}

/**
* @group content_defender
*/
public function canSeeNewContentButtonIfMaxitemsIsNotReached(BackendTester $I, PageTree $pageTree)
public function canSeeNewContentButtonIfMaxitemsIsNotReached(BackendTester $I, PageTree $pageTree, PageTreeV13 $pageTreeV13)
{
$I->click('Page');
$I->waitForElement('#typo3-pagetree-tree .nodes .node');
$pageTree->openPath(['home', 'contentDefenderMaxitems']);
if (GeneralUtility::makeInstance(Typo3Version::class)->getMajorVersion() < 13) {
$I->waitForElement('#typo3-pagetree-tree .nodes .node');
$pageTree->openPath(['home', 'contentDefenderMaxitems']);
} else {
$pageTreeV13->openPath(['home', 'contentDefenderMaxitems']);
}
$I->wait(0.5);
$I->switchToContentFrame();
$dataColPos = $I->getDataColPos(402, 202);
Expand All @@ -168,11 +210,15 @@ public function canSeeNewContentButtonIfMaxitemsIsNotReached(BackendTester $I, P
/**
* @group content_defender
*/
public function canNotSeeNewContentButtonIfMaxitemsIsReached(BackendTester $I, PageTree $pageTree)
public function canNotSeeNewContentButtonIfMaxitemsIsReached(BackendTester $I, PageTree $pageTree, PageTreeV13 $pageTreeV13)
{
$I->click('Page');
$I->waitForElement('#typo3-pagetree-tree .nodes .node');
$pageTree->openPath(['home', 'contentDefenderMaxitems']);
if (GeneralUtility::makeInstance(Typo3Version::class)->getMajorVersion() < 13) {
$I->waitForElement('#typo3-pagetree-tree .nodes .node');
$pageTree->openPath(['home', 'contentDefenderMaxitems']);
} else {
$pageTreeV13->openPath(['home', 'contentDefenderMaxitems']);
}
$I->wait(0.5);
$I->switchToContentFrame();
$dataColPos = $I->getDataColPos(401, 202);
Expand All @@ -184,11 +230,15 @@ public function canNotSeeNewContentButtonIfMaxitemsIsReached(BackendTester $I, P
/**
* @group content_defender
*/
public function canCreateNewChildInContainerIfMaxitemsIsReachedInOtherContainer(BackendTester $I, PageTree $pageTree)
public function canCreateNewChildInContainerIfMaxitemsIsReachedInOtherContainer(BackendTester $I, PageTree $pageTree, PageTreeV13 $pageTreeV13)
{
$I->click('Page');
$I->waitForElement('#typo3-pagetree-tree .nodes .node');
$pageTree->openPath(['home', 'contentDefenderMaxitems']);
if (GeneralUtility::makeInstance(Typo3Version::class)->getMajorVersion() < 13) {
$I->waitForElement('#typo3-pagetree-tree .nodes .node');
$pageTree->openPath(['home', 'contentDefenderMaxitems']);
} else {
$pageTreeV13->openPath(['home', 'contentDefenderMaxitems']);
}
$I->wait(0.5);
$I->switchToContentFrame();
$dataColPos = $I->getDataColPos(402, 202);
Expand All @@ -197,12 +247,19 @@ public function canCreateNewChildInContainerIfMaxitemsIsReachedInOtherContainer(
$I->click($newContentElementLabel, '#element-tt_content-402 [data-colpos="' . $dataColPos . '"]');
$I->switchToIFrame();
$I->waitForElement('.modal-dialog');
if (GeneralUtility::makeInstance(Typo3Version::class)->getMajorVersion() > 12) {
$I->executeJS("document.querySelector('" . $I->getNewRecordWizardSelector() . "').shadowRoot.querySelector('button[data-identifier=\"default\"]').click()");
}
$I->waitForText('Header Only');
$typo3Version = GeneralUtility::makeInstance(Typo3Version::class);
if ($typo3Version->getMajorVersion() < 12) {
$I->click('Header Only');
} else {
$I->executeJS("document.querySelector('typo3-backend-new-content-element-wizard').shadowRoot.querySelector('button[data-identifier=\"common_header\"]').click()");
if ($typo3Version->getMajorVersion() < 13) {
$I->executeJS("document.querySelector('" . $I->getNewRecordWizardSelector() . "').shadowRoot.querySelector('button[data-identifier=\"common_header\"]').click()");
} else {
$I->executeJS("document.querySelector('" . $I->getNewRecordWizardSelector() . "').shadowRoot.querySelector('button[data-identifier=\"default_header\"]').click()");
}
}
$I->switchToContentFrame();
$I->waitForText('Create new Page Content on page');
Expand All @@ -213,11 +270,15 @@ public function canCreateNewChildInContainerIfMaxitemsIsReachedInOtherContainer(
/**
* @group content_defender
*/
public function seeEditDocumentWhenAddingChildrenToColposWhereOnlyHeaderIsAllowed(BackendTester $I, PageTree $pageTree)
public function seeEditDocumentWhenAddingChildrenToColposWhereOnlyHeaderIsAllowed(BackendTester $I, PageTree $pageTree, PageTreeV13 $pageTreeV13)
{
$I->click('Page');
$I->waitForElement('#typo3-pagetree-tree .nodes .node');
$pageTree->openPath(['home', 'pageWithDifferentContainers']);
if (GeneralUtility::makeInstance(Typo3Version::class)->getMajorVersion() < 13) {
$I->waitForElement('#typo3-pagetree-tree .nodes .node');
$pageTree->openPath(['home', 'pageWithDifferentContainers']);
} else {
$pageTreeV13->openPath(['home', 'pageWithDifferentContainers']);
}
$I->wait(0.5);
$I->switchToContentFrame();
$dataColPos = $I->getDataColPos(300, 201);
Expand All @@ -228,7 +289,7 @@ public function seeEditDocumentWhenAddingChildrenToColposWhereOnlyHeaderIsAllowe
$I->switchToContentFrame();
$I->wait(0.5);
$I->see('header', 'select');
$I->dontSee('Table', 'select');
$I->dontSee('Images Only', 'select');
}

}
Loading
Loading