Skip to content
Snippets Groups Projects
Verified Commit 1d5a6d44 authored by Théodore Biadala's avatar Théodore Biadala
Browse files

Issue #3469573 by catch, pooja_sharma: Speed up ElementTest

(cherry picked from commit 6aae9276)
parent 89f81f39
Branches
Tags
17 merge requests!10663Issue #3495778: Update phpdoc in FileSaveHtaccessLoggingTest,!10451Issue #3472458 by watergate, smustgrave: CKEditor 5 show blocks label is not translated,!103032838547 Fix punctuation rules for inline label suffix colon with CSS only,!10150Issue #3467294 by quietone, nod_, smustgrave, catch, longwave: Change string...,!10130Resolve #3480321 "Second level menu",!9936Issue #3483087: Check the module:// prefix in the translation server path and replace it with the actual module path,!9933Issue #3394728 by ankondrat4: Undefined array key "#prefix" and deprecated function: explode() in Drupal\file\Element\ManagedFile::uploadAjaxCallback(),!9914Issue #3451136 by quietone, gapple, ghost of drupal past: Improve...,!9882Draft: Issue #3481777 In bulk_form ensure the triggering element is the bulk_form button,!9839Issue #3445469 by pooja_sharma, smustgrave: Add additional test coverage for...,!9815Issue #3480025: There is no way to remove entity cache items,!9757Issue #3478869 Add "All" or overview links to parent links,!9752Issue #3439910 by pooja_sharma, vensires: Fix Toolbar tests that rely on UID1's super user behavior,!9749Issue #3439910 by pooja_sharma, vensires: Fix Toolbar tests that rely on UID1's super user behavior,!9678Issue #3465132 by catch, Spokje, nod_: Show test run time by class in run-tests.sh output,!9578Issue #3304746 by scott_euser, casey, smustgrave: BigPipe cannot handle (GET)...,!9449Issue #3344041: Allow textarea widgets to be used for text (formatted) fields
Pipeline #261208 passed
Pipeline: drupal

#261209

    ......@@ -10,7 +10,6 @@
    * Tests building and processing of core form elements.
    *
    * @group Form
    * @group #slow
    */
    class ElementTest extends BrowserTestBase {
    ......@@ -26,10 +25,26 @@ class ElementTest extends BrowserTestBase {
    */
    protected $defaultTheme = 'starterkit_theme';
    /**
    * Test form elements.
    */
    public function testFormElements(): void {
    $this->testPlaceHolderText();
    $this->testOptions();
    $this->testRadiosChecked();
    $this->testWrapperIds();
    $this->testButtonClasses();
    $this->testGroupElements();
    $this->testRequiredFieldsetsAndDetails();
    $this->testFormAutocomplete();
    $this->testFormElementErrors();
    $this->testDetailsSummaryAttributes();
    }
    /**
    * Tests placeholder text for elements that support placeholders.
    */
    public function testPlaceHolderText(): void {
    protected function testPlaceHolderText(): void {
    $this->drupalGet('form-test/placeholder-text');
    foreach (['textfield', 'tel', 'url', 'password', 'email', 'number', 'textarea'] as $type) {
    $field = $this->assertSession()->fieldExists("edit-$type");
    ......@@ -40,7 +55,7 @@ public function testPlaceHolderText(): void {
    /**
    * Tests expansion of #options for #type checkboxes and radios.
    */
    public function testOptions(): void {
    protected function testOptions(): void {
    $this->drupalGet('form-test/checkboxes-radios');
    // Verify that all options appear in their defined order.
    ......@@ -81,7 +96,7 @@ public function testOptions(): void {
    /**
    * Tests correct checked attribute for radios element.
    */
    public function testRadiosChecked(): void {
    protected function testRadiosChecked(): void {
    // Verify that there is only one radio option checked.
    $this->drupalGet('form-test/radios-checked');
    $this->assertSession()->elementsCount('xpath', '//input[@name="radios" and @checked]', 1);
    ......@@ -110,7 +125,7 @@ public function testRadiosChecked(): void {
    /**
    * Tests wrapper ids for checkboxes and radios.
    */
    public function testWrapperIds(): void {
    protected function testWrapperIds(): void {
    $this->drupalGet('form-test/checkboxes-radios');
    // Verify that wrapper id is different from element id.
    ......@@ -124,7 +139,7 @@ public function testWrapperIds(): void {
    /**
    * Tests button classes.
    */
    public function testButtonClasses(): void {
    protected function testButtonClasses(): void {
    $this->drupalGet('form-test/button-class');
    // Just contains(@class, "button") won't do because then
    // "button--foo" would contain "button". Instead, check
    ......@@ -138,7 +153,7 @@ public function testButtonClasses(): void {
    /**
    * Tests the #group property.
    */
    public function testGroupElements(): void {
    protected function testGroupElements(): void {
    $this->drupalGet('form-test/group-details');
    $this->assertSession()->elementsCount('xpath', '//div[@class="details-wrapper"]//div[@class="details-wrapper"]//label', 1);
    $this->drupalGet('form-test/group-container');
    ......@@ -154,7 +169,7 @@ public function testGroupElements(): void {
    /**
    * Tests the #required property on details and fieldset elements.
    */
    public function testRequiredFieldsetsAndDetails(): void {
    protected function testRequiredFieldsetsAndDetails(): void {
    $this->drupalGet('form-test/group-details');
    $this->assertEmpty($this->cssSelect('summary.form-required'));
    $this->drupalGet('form-test/group-details/1');
    ......@@ -168,7 +183,7 @@ public function testRequiredFieldsetsAndDetails(): void {
    /**
    * Tests a form with an autocomplete setting..
    */
    public function testFormAutocomplete(): void {
    protected function testFormAutocomplete(): void {
    $this->drupalGet('form-test/autocomplete');
    // Ensure that the user does not have access to the autocompletion.
    ......@@ -190,7 +205,7 @@ public function testFormAutocomplete(): void {
    /**
    * Tests form element error messages.
    */
    public function testFormElementErrors(): void {
    protected function testFormElementErrors(): void {
    $this->drupalGet('form_test/details-form');
    $this->submitForm([], 'Submit');
    $this->assertSession()->pageTextContains('I am an error on the details element.');
    ......@@ -199,7 +214,7 @@ public function testFormElementErrors(): void {
    /**
    * Tests summary attributes of details.
    */
    public function testDetailsSummaryAttributes(): void {
    protected function testDetailsSummaryAttributes(): void {
    $this->drupalGet('form-test/group-details');
    $this->assertSession()->elementExists('css', 'summary[data-summary-attribute="test"]');
    }
    ......
    0% Loading or .
    You are about to add 0 people to the discussion. Proceed with caution.
    Please register or to comment