‪TYPO3CMS  ‪main
ElementsBasicEmailCest.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 Codeception\Attribute\DataProvider;
21 use Codeception\Example;
22 use Facebook\WebDriver\WebDriverBy;
23 use Facebook\WebDriver\WebDriverKeys;
26 
31 {
35  public function ‪_before(‪ApplicationTester $I, ‪PageTree $pageTree): void
36  {
37  $I->useExistingSession('admin');
38  $I->click('List');
39  $pageTree->‪openPath(['styleguide TCA demo', 'elements basic']);
40  // Wait until DOM actually rendered everything
41  $I->switchToContentFrame();
42 
43  // Open record and wait until form is ready
44  $I->waitForText('elements basic', 20);
45  $editRecordLinkCssPath = '#recordlist-tx_styleguide_elements_basic a[aria-label="Edit record"]';
46  $I->click($editRecordLinkCssPath);
47  $I->waitForElementNotVisible('#t3js-ui-block');
48  $I->waitForText('Edit Form', 3, 'h1');
49 
50  // Make sure the test operates on the "email" tab
51  $I->click('email');
52  }
53 
57  private function ‪emailFieldsDataProvider(): array
58  {
59  return [
60  [
61  'label' => 'email_1',
62  'inputValue' => 'foo@example.com',
63  'expectedValue' => 'foo@example.com',
64  'expectedInternalValue' => 'foo@example.com',
65  'expectedValueAfterSave' => 'foo@example.com',
66  'comment' => '',
67  ],
68  ];
69  }
70 
71  #[DataProvider('emailFieldsDataProvider')]
72  public function ‪emailFields(‪ApplicationTester $I, Example $testData): void
73  {
74  $this->‪runInputFieldTest($I, $testData);
75  }
76 
78  {
79  $formSection = $this->‪getFormSectionByFieldLabel($I, 'email_5');
80  $select = $formSection->findElement(WebDriverBy::xpath('.//*/typo3-formengine-valuepicker/select'));
81  $input = $this->‪getInputField($formSection);
82  // Select second option from value picker.
83  $select->sendKeys(WebDriverKeys::ARROW_DOWN);
84  $select->sendKeys(WebDriverKeys::ARROW_DOWN);
85  $I->seeInField($input, 'info@example.org');
86  }
87 }
‪TYPO3\CMS\Core\Tests\Acceptance\Application\FormEngine
Definition: AbstractElementsBasicCest.php:18
‪TYPO3\CMS\Core\Tests\Acceptance\Application\FormEngine\ElementsBasicEmailCest\_before
‪_before(ApplicationTester $I, PageTree $pageTree)
Definition: ElementsBasicEmailCest.php:35
‪TYPO3\CMS\Core\Tests\Acceptance\Support\ApplicationTester
Definition: ApplicationTester.php:28
‪TYPO3\CMS\Core\Tests\Acceptance\Application\FormEngine\ElementsBasicEmailCest\canSelectValueFromValuePicker
‪canSelectValueFromValuePicker(ApplicationTester $I)
Definition: ElementsBasicEmailCest.php:77
‪TYPO3\CMS\Core\Tests\Acceptance\Application\FormEngine\AbstractElementsBasicCest\getInputField
‪getInputField(RemoteWebElement $formSection)
Definition: AbstractElementsBasicCest.php:85
‪TYPO3\CMS\Core\Tests\Acceptance\Support\Helper\AbstractTree\openPath
‪openPath(array $path)
Definition: AbstractTree.php:55
‪TYPO3\CMS\Core\Tests\Acceptance\Application\FormEngine\ElementsBasicEmailCest\emailFieldsDataProvider
‪emailFieldsDataProvider()
Definition: ElementsBasicEmailCest.php:57
‪TYPO3\CMS\Core\Tests\Acceptance\Application\FormEngine\ElementsBasicEmailCest\emailFields
‪emailFields(ApplicationTester $I, Example $testData)
Definition: ElementsBasicEmailCest.php:72
‪TYPO3\CMS\Core\Tests\Acceptance\Application\FormEngine\AbstractElementsBasicCest\runInputFieldTest
‪runInputFieldTest(ApplicationTester $I, Example $testData)
Definition: AbstractElementsBasicCest.php:35
‪TYPO3\CMS\Core\Tests\Acceptance\Application\FormEngine\AbstractElementsBasicCest\getFormSectionByFieldLabel
‪getFormSectionByFieldLabel(ApplicationTester $I, string $fieldLabel)
Definition: AbstractElementsBasicCest.php:102
‪TYPO3\CMS\Core\Tests\Acceptance\Application\FormEngine\AbstractElementsBasicCest
Definition: AbstractElementsBasicCest.php:31
‪TYPO3\CMS\Core\Tests\Acceptance\Support\Helper\PageTree
Definition: PageTree.php:26
‪TYPO3\CMS\Core\Tests\Acceptance\Application\FormEngine\ElementsBasicEmailCest
Definition: ElementsBasicEmailCest.php:31