TYPO3 CMS  TYPO3_8-7
LanguageCest.php
Go to the documentation of this file.
1 <?php
3 
4 /*
5  * This file is part of the TYPO3 CMS project.
6  *
7  * It is free software; you can redistribute it and/or modify it under
8  * the terms of the GNU General Public License, either version 2
9  * of the License, or any later version.
10  *
11  * For the full copyright and license information, please read the
12  * LICENSE.txt file that was distributed with this source code.
13  *
14  * The TYPO3 project - inspiring people to share!
15  */
16 
18 
23 {
27  public function _before(BackendTester $I)
28  {
29  $I->useExistingSession('admin');
30 
31  $I->see('Languages');
32  $I->click('Languages');
33 
34  // Increase duration for notification viewing, avoids vanish before the message is tested
35  $I->executeJS('TYPO3.Notification.duration = 100;');
36 
37  // switch to content iframe
38  $I->switchToContentFrame();
39  }
40 
45  {
46  $I->see('Installed Languages');
47 
48  $I->wantTo('See the table of languages');
49  $I->waitForElementVisible('#typo3-language-list');
50  }
51 
56  {
57  $I->wantTo('Filter the list of translations with a valid language');
58  $I->fillField('#typo3-language-searchfield', 'Danish');
59  $I->canSeeNumberOfElements('#typo3-language-list tbody tr', 1);
60  $I->seeElement('#language-da');
61 
62  $I->fillField('#typo3-language-searchfield', '');
63 
64  $I->wantTo('Filter the list of translations with an valid locale');
65  $I->fillField('#typo3-language-searchfield', 'pt_BR');
66  $I->canSeeNumberOfElements('#typo3-language-list tbody tr', 1);
67  $I->seeElement('#language-pt_BR');
68  $I->see('Brazilian Portuguese');
69  }
70 
75  {
76  $I->wantTo('Activate a language');
77  $I->seeElement('#language-pt_BR.disabled');
78 
79  $I->click('#language-pt_BR td a.activateLanguageLink');
80  $this->seeAlert($I, 'Success', 'Language was successfully activated.');
81 
82  $I->wantTo('Deactivate a language');
83  $I->seeElement('#language-pt_BR.enabled');
84 
85  $I->click('#language-pt_BR td a.deactivateLanguageLink');
86  $this->seeAlert($I, 'Success', 'Language was successfully deactivated.');
87  }
88 
92  public function downloadALanguage(BackendTester $I)
93  {
94  $I->wantTo('Download a language with no selection and see error message');
95  $I->seeElement('#language-pt_BR.disabled');
96 
97  $I->click('a[data-action="updateActiveLanguages"]');
98  $this->seeAlert($I, 'Error', 'No language activated. Please activate at least one language.');
99 
100  // Download only a single translation for a specific extension for performance reasons
101  $I->wantTo('Download a single translation for a selected language');
102 
103  $I->click('#language-pt_BR td a.activateLanguageLink');
104 
105  $I->selectOption('.t3-js-jumpMenuBox', 'Translation Overview');
106  $I->waitForElementVisible('#typo3-translation-list');
107  $I->waitForElementVisible('#extension-beuser td a.updateTranslationLink');
108  $I->click('#extension-beuser td a.updateTranslationLink');
109  $I->waitForElement('#extension-beuser td:nth-child(3).complete');
110  $this->seeAlert($I, 'Success', 'The translation update has been successfully completed.');
111  }
112 
117  {
118  $I->wantToTest('Select Translation Overview');
119  $I->selectOption('.t3-js-jumpMenuBox', 'Translation Overview');
120  $I->waitForElementVisible('#typo3-translation-list');
121  $I->see('Translation Overview');
122  }
123 
128  {
129  $I->wantToTest('Select Translation Overview and Filter');
130  $I->selectOption('.t3-js-jumpMenuBox', 'Translation Overview');
131  $I->waitForElementVisible('#typo3-translation-list');
132 
133  $I->wantTo('Filter the list of translations with a valid Extension');
134  $I->fillField('#typo3-language-searchfield', 'TYPO3 Core');
135  $I->canSeeNumberOfElements('#typo3-translation-list tbody tr', 1);
136 
137  $I->wantTo('Filter the list of translations with an invalid Extension');
138  $I->fillField('#typo3-language-searchfield', 'TYPO3 FooBar');
139  $I->canSeeNumberOfElements('#typo3-translation-list tbody tr', 1);
140  }
141 
147  protected function seeAlert(BackendTester $I, $alertTitle, $alertMessage)
148  {
149  // switch back to body
150  $I->switchToIFrame();
151 
152  $I->wait(1);
153  $I->waitForElement('//div[contains(@role, "alert")]', 10);
154  $I->see($alertTitle);
155  $I->see($alertMessage);
156 
157  $I->switchToContentFrame();
158  }
159 }
seeAlert(BackendTester $I, $alertTitle, $alertMessage)