Skip to content

Commit 5d80761

Browse files
author
nod_
committed
Issue #3469573 by catch, pooja_sharma: Speed up ElementTest
1 parent f36220e commit 5d80761

File tree

1 file changed

+26
-11
lines changed

1 file changed

+26
-11
lines changed

modules/system/tests/src/Functional/Form/ElementTest.php

+26-11
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
* Tests building and processing of core form elements.
1111
*
1212
* @group Form
13-
* @group #slow
1413
*/
1514
class ElementTest extends BrowserTestBase {
1615

@@ -26,10 +25,26 @@ class ElementTest extends BrowserTestBase {
2625
*/
2726
protected $defaultTheme = 'starterkit_theme';
2827

28+
/**
29+
* Test form elements.
30+
*/
31+
public function testFormElements(): void {
32+
$this->testPlaceHolderText();
33+
$this->testOptions();
34+
$this->testRadiosChecked();
35+
$this->testWrapperIds();
36+
$this->testButtonClasses();
37+
$this->testGroupElements();
38+
$this->testRequiredFieldsetsAndDetails();
39+
$this->testFormAutocomplete();
40+
$this->testFormElementErrors();
41+
$this->testDetailsSummaryAttributes();
42+
}
43+
2944
/**
3045
* Tests placeholder text for elements that support placeholders.
3146
*/
32-
public function testPlaceHolderText(): void {
47+
protected function testPlaceHolderText(): void {
3348
$this->drupalGet('form-test/placeholder-text');
3449
foreach (['textfield', 'tel', 'url', 'password', 'email', 'number', 'textarea'] as $type) {
3550
$field = $this->assertSession()->fieldExists("edit-$type");
@@ -40,7 +55,7 @@ public function testPlaceHolderText(): void {
4055
/**
4156
* Tests expansion of #options for #type checkboxes and radios.
4257
*/
43-
public function testOptions(): void {
58+
protected function testOptions(): void {
4459
$this->drupalGet('form-test/checkboxes-radios');
4560

4661
// Verify that all options appear in their defined order.
@@ -81,7 +96,7 @@ public function testOptions(): void {
8196
/**
8297
* Tests correct checked attribute for radios element.
8398
*/
84-
public function testRadiosChecked(): void {
99+
protected function testRadiosChecked(): void {
85100
// Verify that there is only one radio option checked.
86101
$this->drupalGet('form-test/radios-checked');
87102
$this->assertSession()->elementsCount('xpath', '//input[@name="radios" and @checked]', 1);
@@ -110,7 +125,7 @@ public function testRadiosChecked(): void {
110125
/**
111126
* Tests wrapper ids for checkboxes and radios.
112127
*/
113-
public function testWrapperIds(): void {
128+
protected function testWrapperIds(): void {
114129
$this->drupalGet('form-test/checkboxes-radios');
115130

116131
// Verify that wrapper id is different from element id.
@@ -124,7 +139,7 @@ public function testWrapperIds(): void {
124139
/**
125140
* Tests button classes.
126141
*/
127-
public function testButtonClasses(): void {
142+
protected function testButtonClasses(): void {
128143
$this->drupalGet('form-test/button-class');
129144
// Just contains(@class, "button") won't do because then
130145
// "button--foo" would contain "button". Instead, check
@@ -138,7 +153,7 @@ public function testButtonClasses(): void {
138153
/**
139154
* Tests the #group property.
140155
*/
141-
public function testGroupElements(): void {
156+
protected function testGroupElements(): void {
142157
$this->drupalGet('form-test/group-details');
143158
$this->assertSession()->elementsCount('xpath', '//div[@class="details-wrapper"]//div[@class="details-wrapper"]//label', 1);
144159
$this->drupalGet('form-test/group-container');
@@ -154,7 +169,7 @@ public function testGroupElements(): void {
154169
/**
155170
* Tests the #required property on details and fieldset elements.
156171
*/
157-
public function testRequiredFieldsetsAndDetails(): void {
172+
protected function testRequiredFieldsetsAndDetails(): void {
158173
$this->drupalGet('form-test/group-details');
159174
$this->assertEmpty($this->cssSelect('summary.form-required'));
160175
$this->drupalGet('form-test/group-details/1');
@@ -168,7 +183,7 @@ public function testRequiredFieldsetsAndDetails(): void {
168183
/**
169184
* Tests a form with an autocomplete setting..
170185
*/
171-
public function testFormAutocomplete(): void {
186+
protected function testFormAutocomplete(): void {
172187
$this->drupalGet('form-test/autocomplete');
173188

174189
// Ensure that the user does not have access to the autocompletion.
@@ -190,7 +205,7 @@ public function testFormAutocomplete(): void {
190205
/**
191206
* Tests form element error messages.
192207
*/
193-
public function testFormElementErrors(): void {
208+
protected function testFormElementErrors(): void {
194209
$this->drupalGet('form_test/details-form');
195210
$this->submitForm([], 'Submit');
196211
$this->assertSession()->pageTextContains('I am an error on the details element.');
@@ -199,7 +214,7 @@ public function testFormElementErrors(): void {
199214
/**
200215
* Tests summary attributes of details.
201216
*/
202-
public function testDetailsSummaryAttributes(): void {
217+
protected function testDetailsSummaryAttributes(): void {
203218
$this->drupalGet('form-test/group-details');
204219
$this->assertSession()->elementExists('css', 'summary[data-summary-attribute="test"]');
205220
}

0 commit comments

Comments
 (0)