‪TYPO3CMS  11.5
InlineContentElementLocalizeSynchronizeCest.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
5 /*
6  * This file is part of the TYPO3 CMS project.
7  *
8  * It is free software; you can redistribute it and/or modify it under
9  * the terms of the GNU General Public License, either version 2
10  * of the License, or any later version.
11  *
12  * For the full copyright and license information, please read the
13  * LICENSE.txt file that was distributed with this source code.
14  *
15  * The TYPO3 project - inspiring people to share!
16  */
17 
19 
20 use Facebook\WebDriver\Remote\RemoteWebDriver;
21 use Facebook\WebDriver\WebDriverBy;
24 
26 {
27  public function ‪_before(‪ApplicationTester $I, ‪PageTree $pageTree): void
28  {
29  $I->useExistingSession('admin');
30 
31  $I->click('Page');
32  $I->waitForElement('svg .nodes .node');
33  $pageTree->‪openPath(['styleguide TCA demo', 'staticdata']);
34  $I->switchToContentFrame();
35  $I->waitForText('staticdata', 20);
36  }
37 
39  {
40  // Add a content element type images and localize it
41  $I->click('.module-body td[data-language-uid="0"] span[data-identifier="actions-add"]');
42  $I->switchToWindow();
43  $I->waitForText('Images Only');
44  $I->click('Images Only');
45  $I->switchToContentFrame();
46  $I->waitForText('Create new Page Content on page "staticdata"', 3, 'h1');
47  $I->click('Images');
48  // Inline add record in Resources tab
49  $I->click('Images');
50  $I->click('span[data-identifier="actions-insert-record"]', 'div.active');
51  $I->switchToWindow();
52  $I->wait(2);
53  $I->switchToIFrame('modal_frame');
54  // Find page 'styleguide' in page tree of modal and click it
55  $context = $I->executeInSelenium(function (RemoteWebDriver $webdriver) {
56  $context = $webdriver->findElement(WebDriverBy::cssSelector('div.element-browser-main-sidebar'));
57  return $context->findElement(WebDriverBy::xpath('//*[text()=\'styleguide\']/..'));
58  });
59  // Add an image, closes modal again
60  $context->findElement(WebDriverBy::cssSelector('text.node-name'))->click();
61  $I->waitForElementVisible('#typo3-filelist a[data-file-name="telephone_box.jpg"]');
62  $I->click('#typo3-filelist a[data-file-name="telephone_box.jpg"]');
63  // Save, go back to page
64  $I->switchToWindow();
65  $I->switchToContentFrame();
66  $I->waitForElementVisible('.module-docheader a[title="Close"]');
67  $I->click('.module-docheader a[title="Close"]');
68  $I->switchToWindow();
69  $I->wait(1);
70  $I->waitForText('Save and close');
71  $I->click('Save and close');
72  $I->wait(1);
73  // Switch to "All languages" view and localize content element
74  $I->switchToContentFrame();
75  $I->waitForElementVisible('select[name=actionMenu]');
76  $I->selectOption('select[name=actionMenu]', 'Languages');
77  $I->waitForElementVisible('select[name=languageMenu]');
78  $I->selectOption('select[name=languageMenu]', 'All languages');
79  $I->waitForText('Translate');
80  $I->click('Translate');
81  $I->switchToWindow();
82  $I->waitForText('Localize page "staticdata - language 1" into styleguide demo language danish');
83  $I->click('span[data-identifier="actions-localize"]');
84  $I->click('Next');
85  $I->waitForText('Normal');
86  $I->click('Next');
87  $I->switchToContentFrame();
88  $I->waitForText('(copy 1)');
89  // Edit default language content element again and add another image
90  $I->click('.module-body td[data-language-uid="0"] span[data-identifier="actions-open"]');
91  $I->waitForText('Edit Page Content on page "staticdata"', 3, 'h1');
92  $I->click('Images');
93  $I->click('span[data-identifier="actions-insert-record"]', 'div.active');
94  $I->switchToWindow();
95  $I->wait(2);
96  $I->switchToIFrame('modal_frame');
97  // Find page 'styleguide' in page tree of modal and click it
98  $context = $I->executeInSelenium(function (RemoteWebDriver $webdriver) {
99  $context = $webdriver->findElement(WebDriverBy::cssSelector('div.element-browser-main-sidebar'));
100  return $context->findElement(WebDriverBy::xpath('//*[text()=\'styleguide\']/..'));
101  });
102  // Add an image, closes modal again
103  $context->findElement(WebDriverBy::cssSelector('text.node-name'))->click();
104  $I->waitForElementVisible('#typo3-filelist a[data-file-name="underground.jpg"]');
105  $I->click('#typo3-filelist a[data-file-name="underground.jpg"]');
106  // Save, go back to page
107  $I->switchToWindow();
108  $I->switchToContentFrame();
109  $I->click('.module-docheader a[title="Close"]');
110  $I->switchToWindow();
111  $I->wait(1);
112  $I->waitForText('Save and close');
113  $I->click('Save and close');
114  $I->wait(1);
115  $I->waitForElementNotVisible('.t3js-modal.show');
116  // Open the localized element and see that the second image can be synchronized
117  $I->switchToContentFrame();
118  $I->waitForText('(copy 1)');
119  $I->click('.module-body td[data-language-uid="1"] span[data-identifier="actions-open"]');
120  $I->waitForText('Edit Page Content " (copy 1)" on page "staticdata"', 3, 'h1');
121  $I->click('Images');
122  $I->waitForText('underground.jpg');
123  $I->click('span[data-identifier="actions-document-localize"]');
124  // Synchronized image has been opened
125  $I->waitForText('Image Metadata');
126  }
127 }
‪TYPO3\CMS\Core\Tests\Acceptance\Application\FormEngine\InlineContentElementLocalizeSynchronizeCest
Definition: InlineContentElementLocalizeSynchronizeCest.php:26
‪TYPO3\CMS\Core\Tests\Acceptance\Application\FormEngine\InlineContentElementLocalizeSynchronizeCest\_before
‪_before(ApplicationTester $I, PageTree $pageTree)
Definition: InlineContentElementLocalizeSynchronizeCest.php:27
‪TYPO3\CMS\Core\Tests\Acceptance\Application\FormEngine\InlineContentElementLocalizeSynchronizeCest\addingResourceToDefaultLangPageAddResourceToLocalizedPage
‪addingResourceToDefaultLangPageAddResourceToLocalizedPage(ApplicationTester $I)
Definition: InlineContentElementLocalizeSynchronizeCest.php:38
‪TYPO3\CMS\Core\Tests\Acceptance\Application\FormEngine
Definition: AbstractElementsBasicCest.php:18
‪TYPO3\CMS\Core\Tests\Acceptance\Support\ApplicationTester
Definition: ApplicationTester.php:27
‪TYPO3\CMS\Core\Tests\Acceptance\Support\Helper\PageTree\openPath
‪openPath(array $path)
Definition: PageTree.php:76
‪TYPO3\CMS\Core\Tests\Acceptance\Support\Helper\PageTree
Definition: PageTree.php:31