Skip to content

Commit

Permalink
[TESTING] Align Tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dhoffmann1979 committed Jun 27, 2024
1 parent 1fee3b7 commit 38aad35
Show file tree
Hide file tree
Showing 11 changed files with 221 additions and 168 deletions.
19 changes: 12 additions & 7 deletions Tests/Browser/ContentPublisherTestsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,23 @@ class ContentPublisherTestsTest extends AbstractBrowserTestCase
{
public function testTestsAreGreen(): void
{
$driver = WebDriverFactory::createChromeDriver();
TYPO3Helper::backendLogin($driver, 'https://local.v12.in2publish-core.de/typo3', 'admin', 'password');
TYPO3Helper::selectModuleByText($driver, 'Publisher Tools');
$localDriver = WebDriverFactory::createChromeDriver();
TYPO3Helper::backendLogin($localDriver, 'https://local.v12.in2publish-core.de/typo3', 'admin', 'password');
TYPO3Helper::selectModuleByText($localDriver, 'Publisher Tools');

TYPO3Helper::inContentIFrameContext($driver, static function (WebDriver $driver): void {
TYPO3Helper::inContentIFrameContext($localDriver, static function (WebDriver $driver): void {
$driver->click(WebDriverBy::linkText('Tests'));
});

// Workaround
sleep($this->sleepTime);

TYPO3Helper::inContentIFrameContext($localDriver, static function (WebDriver $driver): void {
self::assertSourceNotContains($driver, 'callout-warning');
self::assertSourceNotContains($driver, 'callout-danger');
});

$driver->close();

self::assertTrue(true);
$localDriver->close();
unset($localDriver);
}
}
21 changes: 11 additions & 10 deletions Tests/Browser/Dependency/PublishingRecordWithDependencyTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,21 @@ class PublishingRecordWithDependencyTest extends AbstractBrowserTestCase
{
public function testRecordWithUnfulfilledDependencyIsPublishableAfterDependenciesAreFulfilled(): void
{
$driver = WebDriverFactory::createChromeDriver();
$localDriver = WebDriverFactory::createChromeDriver();
TYPO3Helper::backendLogin(
$driver,
$localDriver,
'https://local.v12.in2publish-core.de/typo3',
'publisher-page-tree-publish',
'publisher-page-tree-publish',
);
TYPO3Helper::selectModuleByText($driver, 'Page');
TYPO3Helper::selectModuleByText($localDriver, 'Page');
TYPO3Helper::selectInPageTree(
$driver,
$localDriver,
['EXT:in2publish', '5c Workflows - Unfulfilled Dependencies', '5c.1 Parent not published'],
);
TYPO3Helper::selectModuleByText($driver, 'Publish Overview');
TYPO3Helper::selectModuleByText($localDriver, 'Publish Overview');

TYPO3Helper::inContentIFrameContext($driver, static function (WebDriver $driver): void {
TYPO3Helper::inContentIFrameContext($localDriver, static function (WebDriver $driver): void {
self::assertPageContains($driver, '5c.1 Parent not published');
self::assertPageContains($driver, '5c.1.1 Child Ready to Publish');

Expand Down Expand Up @@ -76,16 +76,16 @@ public function testRecordWithUnfulfilledDependencyIsPublishableAfterDependencie
WebDriverBy::xpath('//*[@data-record-identifier="pages-36"]'),
);
});
TYPO3Helper::inContentIFrameContext($driver, static function (WebDriver $driver): void {
TYPO3Helper::inContentIFrameContext($localDriver, static function (WebDriver $driver): void {
$driver->click(
WebDriverBy::xpath(
'//*[@data-record-identifier="pages-35"]//*[contains(@class, "in2publish-link-publish")]/*[contains(@class, "in2publish-icon-publish")]',
),
);
});

TYPO3Helper::selectModuleByText($driver, 'Publish Overview');
TYPO3Helper::inContentIFrameContext($driver, static function (WebDriver $driver): void {
TYPO3Helper::selectModuleByText($localDriver, 'Publish Overview');
TYPO3Helper::inContentIFrameContext($localDriver, static function (WebDriver $driver): void {
self::assertPageContains($driver, '5c.1 Parent not published');
self::assertPageContains($driver, '5c.1.1 Child Ready to Publish');

Expand All @@ -106,6 +106,7 @@ public function testRecordWithUnfulfilledDependencyIsPublishableAfterDependencie
);
});

$driver->close();
$localDriver->close();
unset($localDriver);
}
}
30 changes: 18 additions & 12 deletions Tests/Browser/PublishChangedContentTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,17 @@ class PublishChangedContentTest extends AbstractBrowserTestCase
*/
public function testChangedPageContentCanBePublished(): void
{
$driver = WebDriverFactory::createChromeDriver();
TYPO3Helper::backendLogin($driver, 'https://local.v12.in2publish-core.de/typo3', 'admin', 'password');
$localDriver = WebDriverFactory::createChromeDriver();
TYPO3Helper::backendLogin($localDriver, 'https://local.v12.in2publish-core.de/typo3', 'admin', 'password');

TYPO3Helper::selectModuleByText($driver, 'Page');
TYPO3Helper::selectModuleByText($localDriver, 'Page');
TYPO3Helper::selectInPageTree(
$driver,
$localDriver,
['Home', 'EXT:in2publish_core', '1b Page content', '1b.1 Page content - changed'],
);
TYPO3Helper::selectModuleByText($driver, 'Publish Overview');
TYPO3Helper::selectModuleByText($localDriver, 'Publish Overview');

TYPO3Helper::inContentIFrameContext($driver, static function (WebDriver $driver): void {
TYPO3Helper::inContentIFrameContext($localDriver, static function (WebDriver $driver): void {
self::assertPageContains($driver, 'TYPO3 Content Publisher - publish pages and records overview');
self::assertElementIsVisible($driver, WebDriverBy::cssSelector('[data-record-identifier="pages-65"]'));
$recordRow = $driver->findElement(WebDriverBy::cssSelector('[data-record-identifier="pages-65"]'));
Expand All @@ -37,24 +37,31 @@ public function testChangedPageContentCanBePublished(): void
self::assertPageContains($driver, '1b.1 Header - changed');
});

TYPO3Helper::inContentIFrameContext($driver, static function (WebDriver $driver): void {
TYPO3Helper::inContentIFrameContext($localDriver, static function (WebDriver $driver): void {
$driver->click(WebDriverBy::cssSelector('.in2publish-icon-publish'));
});

// Workaround
sleep($this->sleepTime);
TYPO3Helper::inContentIFrameContext($driver, static function (WebDriver $driver): void {

TYPO3Helper::inContentIFrameContext($localDriver, static function (WebDriver $driver): void {
self::assertPageContains($driver, 'The selected record has been published successfully');
});

$localDriver->close();
unset($localDriver);

$foreignDriver = WebDriverFactory::createChromeDriver();
TYPO3Helper::backendLogin($foreignDriver, 'https://foreign.v12.in2publish-core.de/typo3', 'admin', 'password');
TYPO3Helper::selectModuleByText($foreignDriver, 'Page');
TYPO3Helper::selectInPageTree(
$foreignDriver,
['Home', 'EXT:in2publish_core', '1b Page content', '1b.1 Page content - changed'],
);

// Workaround
sleep(1);
sleep($this->sleepTime);

TYPO3Helper::inContentIFrameContext($foreignDriver, static function (WebDriver $driver): void {
$driver->findElement(WebDriverBy::xpath('//div[@data-table="tt_content" and @data-uid="49"]//a[@title="Edit"]'))->click();
self::assertElementContains(
Expand All @@ -63,9 +70,8 @@ public function testChangedPageContentCanBePublished(): void
WebDriverBy::cssSelector('[data-formengine-input-name="data[tt_content][49][header]"]'),
);
});
$foreignDriver->close();
$driver->close();

self::assertTrue(true);
$foreignDriver->close();
unset($foreignDriver);
}
}
24 changes: 14 additions & 10 deletions Tests/Browser/PublishChangedNewsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ class PublishChangedNewsTest extends AbstractBrowserTestCase
*/
public function testChangedPageContentCanBePublished(): void
{
$driver = WebDriverFactory::createChromeDriver();
TYPO3Helper::backendLogin($driver, 'https://local.v12.in2publish-core.de/typo3', 'admin', 'password');
$localDriver = WebDriverFactory::createChromeDriver();
TYPO3Helper::backendLogin($localDriver, 'https://local.v12.in2publish-core.de/typo3', 'admin', 'password');

TYPO3Helper::selectModuleByText($driver, 'Page');
TYPO3Helper::selectInPageTree($driver, ['Home', 'News Folder']);
TYPO3Helper::selectModuleByText($driver, 'Publish Overview');
TYPO3Helper::selectModuleByText($localDriver, 'Page');
TYPO3Helper::selectInPageTree($localDriver, ['Home', 'News Folder']);
TYPO3Helper::selectModuleByText($localDriver, 'Publish Overview');

TYPO3Helper::inContentIFrameContext($driver, static function (WebDriver $driver): void {
TYPO3Helper::inContentIFrameContext($localDriver, static function (WebDriver $driver): void {
self::assertPageContains($driver, 'TYPO3 Content Publisher - publish pages and records overview');
self::assertElementIsVisible($driver, WebDriverBy::cssSelector('[data-record-identifier="pages-33"]'));
$recordRow = $driver->findElement(WebDriverBy::cssSelector('[data-record-identifier="pages-33"]'));
Expand All @@ -49,23 +49,27 @@ public function testChangedPageContentCanBePublished(): void
);
});

TYPO3Helper::inContentIFrameContext($driver, static function (WebDriver $driver): void {
TYPO3Helper::inContentIFrameContext($localDriver, static function (WebDriver $driver): void {
$driver->click(WebDriverBy::cssSelector('.in2publish-icon-publish'));
self::assertPageContains($driver, 'The selected record has been published successfully');
});

$localDriver->close();
unset($localDriver);

$foreignDriver = WebDriverFactory::createChromeDriver();
TYPO3Helper::backendLogin($foreignDriver, 'https://foreign.v12.in2publish-core.de/typo3', 'admin', 'password');
TYPO3Helper::selectModuleByText($foreignDriver, 'List');
TYPO3Helper::selectInPageTree($foreignDriver, ['Home', 'News Folder']);

// Workaround
sleep($this->sleepTime);

TYPO3Helper::inContentIFrameContext($foreignDriver, static function (WebDriver $driver): void {
self::assertPageContains($driver, 'Content element with image - edited');
});
$foreignDriver->close();
$driver->close();

self::assertTrue(true);
$foreignDriver->close();
unset($foreignDriver);
}
}
27 changes: 16 additions & 11 deletions Tests/Browser/PublishChangedPagePropertiesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,17 @@ class PublishChangedPagePropertiesTest extends AbstractBrowserTestCase
*/
public function testChangedPagePropertiesCanBePublished(): void
{
$driver = WebDriverFactory::createChromeDriver();
TYPO3Helper::backendLogin($driver, 'https://local.v12.in2publish-core.de/typo3', 'admin', 'password');
$localDriver = WebDriverFactory::createChromeDriver();
TYPO3Helper::backendLogin($localDriver, 'https://local.v12.in2publish-core.de/typo3', 'admin', 'password');

TYPO3Helper::selectModuleByText($localDriver, 'Page');
TYPO3Helper::selectInPageTree($localDriver, ['Home', 'EXT:in2publish_core', '1a Page properties - changed']);
TYPO3Helper::selectModuleByText($localDriver, 'Publish Overview');

TYPO3Helper::selectModuleByText($driver, 'Page');
TYPO3Helper::selectInPageTree($driver, ['Home', 'EXT:in2publish_core', '1a Page properties - changed']);
TYPO3Helper::selectModuleByText($driver, 'Publish Overview');
// Workaround
sleep($this->sleepTime);

TYPO3Helper::inContentIFrameContext($driver, static function (WebDriver $driver): void {
TYPO3Helper::inContentIFrameContext($localDriver, static function (WebDriver $driver): void {
self::assertPageContains($driver, 'TYPO3 Content Publisher - publish pages and records overview');
self::assertElementIsVisible($driver, WebDriverBy::cssSelector('[data-record-identifier="pages-5"]'));
$recordRow = $driver->findElement(WebDriverBy::cssSelector('[data-record-identifier="pages-5"]'));
Expand All @@ -36,17 +37,22 @@ public function testChangedPagePropertiesCanBePublished(): void
self::assertPageContains($driver, 'Page title 1a Page properties - changed');
});

TYPO3Helper::inContentIFrameContext($driver, static function (WebDriver $driver): void {
TYPO3Helper::inContentIFrameContext($localDriver, static function (WebDriver $driver): void {
$driver->click(WebDriverBy::cssSelector('.in2publish-icon-publish'));
self::assertPageContains($driver, 'The selected record has been published successfully');
});

$localDriver->close();
unset($localDriver);

$foreignDriver = WebDriverFactory::createChromeDriver();
TYPO3Helper::backendLogin($foreignDriver, 'https://foreign.v12.in2publish-core.de/typo3', 'admin', 'password');
TYPO3Helper::selectModuleByText($foreignDriver, 'Page');
TYPO3Helper::selectInPageTree($foreignDriver, ['Home', 'EXT:in2publish_core', '1a Page properties - changed']);

// Workaround
sleep(1);
sleep($this->sleepTime);

TYPO3Helper::inContentIFrameContext($foreignDriver, static function (WebDriver $driver): void {
$driver->findElement(WebDriverBy::xpath('//a[@title="Edit"]'))->click();
self::assertElementContains(
Expand All @@ -55,9 +61,8 @@ public function testChangedPagePropertiesCanBePublished(): void
WebDriverBy::cssSelector('[data-formengine-input-name="data[pages][5][title]"]'),
);
});
$foreignDriver->close();
$driver->close();

self::assertTrue(true);
$foreignDriver->close();
unset($foreignDriver);
}
}
Loading

0 comments on commit 38aad35

Please sign in to comment.