‪TYPO3CMS  ‪main
FileClipboardCest.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\Remote\RemoteWebElement;
24 
29 {
30  private string ‪$copyModeCopy = '#clipboard-copymode-copy';
31  private string ‪$copyModeMove = '#clipboard-copymode-move';
32 
33  public function ‪_before(‪ApplicationTester $I, ‪FileTree $tree): void
34  {
35  $I->useExistingSession('admin');
36  $I->amOnPage('/typo3/module/file/list');
37  $I->switchToContentFrame();
38  }
39 
40  public function ‪seeSwitchModes(‪ApplicationTester $I): void
41  {
42  $I->waitForElementVisible($this->copyModeMove);
43  $I->seeCheckboxIsChecked($this->copyModeMove);
44  $I->waitForElementVisible($this->copyModeCopy);
45  $I->dontSeeCheckboxIsChecked($this->copyModeCopy);
46  $I->click('//*/label[@for="clipboard-copymode-copy"]');
47  $I->waitForElementVisible($this->copyModeMove);
48  $I->dontSeeCheckboxIsChecked($this->copyModeMove);
49  $I->waitForElementVisible($this->copyModeCopy);
50  $I->seeCheckboxIsChecked($this->copyModeCopy);
51  }
52 
54  {
55  $fileName = 'bus_lane.jpg';
56  $I->click('//*[text()=" View"]');
57  $I->click('//*[text()="List"]');
58  $I->waitForText('styleguide');
59  $I->click('styleguide');
60  $I->waitForText($fileName);
61  $this->‪openActionDropdown($I, $fileName)->click();
62  $I->click('Cut');
63  $I->see($fileName, '[data-clipboard-panel] a');
64  $I->click('Remove element', '[data-clipboard-panel]');
65  $I->dontSee($fileName, '[data-clipboard-panel] a');
66  }
67 
69  {
70  $expectedFiles = ['bus_lane.jpg', 'telephone_box.jpg', 'underground.jpg'];
71  $I->click('//*[text()=" View"]');
72  $I->click('//*[text()="List"]');
73  $I->waitForText('styleguide');
74  $I->click('styleguide');
75 
76  $I->amGoingTo('add multiple elements to clipboard');
77  $I->wait(1);
78  $I->click('Clipboard #1 (multi-selection mode)');
79  $I->click('.t3js-multi-record-selection-check-actions-toggle');
80  $I->click('button[data-multi-record-selection-check-action="check-all"]');
81  $I->click('button[data-multi-record-selection-action="copyMarked"]');
82 
83  foreach ($expectedFiles as $file) {
84  $I->see($file, '[data-clipboard-panel]');
85  }
86 
87  $I->amGoingTo('remove all elements from clipboard');
88  $I->click('Remove all', '[data-clipboard-panel]');
89 
90  foreach ($expectedFiles as $file) {
91  $I->dontSee($file, '[data-clipboard-panel]');
92  }
93  }
94 
95  private function ‪openActionDropdown(‪ApplicationTester $I, string $title): RemoteWebElement
96  {
97  $I->comment('Get open action dropdown "' . $title . '"');
98  return $I->executeInSelenium(
99  static function (RemoteWebDriver $webDriver) use ($title) {
100  return $webDriver->findElement(
101  \Facebook\WebDriver\WebDriverBy::xpath(
102  '//button[contains(text(),"' . $title . '")]/parent::node()/parent::node()//a[contains(@href, "#actions_") and contains(@data-bs-toggle, "dropdown")]'
103  )
104  );
105  }
106  );
107  }
108 }
‪TYPO3\CMS\Core\Tests\Acceptance\Application\FileList\FileClipboardCest\seeAddRemoveSingleRecord
‪seeAddRemoveSingleRecord(ApplicationTester $I)
Definition: FileClipboardCest.php:53
‪TYPO3\CMS\Core\Tests\Acceptance\Application\FileList\FileClipboardCest\openActionDropdown
‪openActionDropdown(ApplicationTester $I, string $title)
Definition: FileClipboardCest.php:95
‪TYPO3\CMS\Core\Tests\Acceptance\Application\FileList\FileClipboardCest\$copyModeCopy
‪string $copyModeCopy
Definition: FileClipboardCest.php:30
‪TYPO3\CMS\Core\Tests\Acceptance\Support\ApplicationTester
Definition: ApplicationTester.php:28
‪TYPO3\CMS\Core\Tests\Acceptance\Application\FileList\FileClipboardCest\seeSwitchModes
‪seeSwitchModes(ApplicationTester $I)
Definition: FileClipboardCest.php:40
‪TYPO3\CMS\Core\Tests\Acceptance\Application\FileList
Definition: FileClipboardCest.php:18
‪TYPO3\CMS\Core\Tests\Acceptance\Application\FileList\FileClipboardCest
Definition: FileClipboardCest.php:29
‪TYPO3\CMS\Core\Tests\Acceptance\Application\FileList\FileClipboardCest\$copyModeMove
‪string $copyModeMove
Definition: FileClipboardCest.php:31
‪TYPO3\CMS\Core\Tests\Acceptance\Support\Helper\FileTree
Definition: FileTree.php:23
‪TYPO3\CMS\Core\Tests\Acceptance\Application\FileList\FileClipboardCest\_before
‪_before(ApplicationTester $I, FileTree $tree)
Definition: FileClipboardCest.php:33
‪TYPO3\CMS\Core\Tests\Acceptance\Application\FileList\FileClipboardCest\seeAddRemoveMultipleRecords
‪seeAddRemoveMultipleRecords(ApplicationTester $I)
Definition: FileClipboardCest.php:68