Commit 94e8a471 authored by catch's avatar catch
Browse files

Issue #3387772 by Spokje: [random test failure] Random failure in...

Issue #3387772 by Spokje: [random test failure] Random failure in ThrobberTest::testProgressThrobberPosition

(cherry picked from commit 6da04293)
parent c23f2145
Loading
Loading
Loading
Loading
Loading
+11 −24
Original line number Diff line number Diff line
@@ -28,18 +28,6 @@ class ThrobberTest extends WebDriverTestBase {
   */
  protected $defaultTheme = 'stark';

  /**
   * {@inheritdoc}
   */
  protected function setUp(): void {
    parent::setUp();

    $admin_user = $this->drupalCreateUser([
      'administer views',
    ]);
    $this->drupalLogin($admin_user);
  }

  /**
   * Tests theming throbber element.
   */
@@ -47,6 +35,11 @@ public function testThemingThrobberElement() {
    $session = $this->getSession();
    $web_assert = $this->assertSession();
    $page = $session->getPage();
    $admin_user = $this->drupalCreateUser([
      'administer views',
      'administer blocks',
    ]);
    $this->drupalLogin($admin_user);

    $custom_ajax_progress_indicator_fullscreen = <<<JS
      Drupal.theme.ajaxProgressIndicatorFullscreen = function () {
@@ -92,23 +85,17 @@ public function testThemingThrobberElement() {
    $this->assertNotNull($web_assert->waitForElement('css', '.custom-ajax-progress-throbber'), 'Custom ajaxProgressThrobber.');
    hold_test_response(FALSE);
    $web_assert->assertNoElementAfterWait('css', '.custom-ajax-progress-throbber');
  }

  /**
   * Tests progress throbber element position.
   */
  public function testProgressThrobberPosition() {
    $this->drupalLogin($this->rootUser);

    // Test progress throbber position on a dropbutton in a table display.
    $this->drupalGet('/admin/structure/block');
    $this->clickLink('Place block');
    hold_test_response(FALSE);
    $this->assertSession()->waitForText('Place Block');
    $this->clickLink('Place block');
    $web_assert->assertWaitOnAjaxRequest();
    $this->assertNotEmpty($web_assert->waitForElementVisible('css', '#drupal-modal'));
    hold_test_response(TRUE);
    $this->assertSession()->elementExists('xpath', '//div[contains(@class, "dropbutton-wrapper")]/following-sibling::div[contains(@class, "ajax-progress-throbber")]');
    $this->clickLink('Place block');
    $this->assertNotNull($web_assert->waitForElement('xpath', '//div[contains(@class, "dropbutton-wrapper")]/following-sibling::div[contains(@class, "ajax-progress-throbber")]'));
    hold_test_response(FALSE);
    $this->assertSession()->assertNoElementAfterWait('css', '.ajax-progress-throbber');
    $web_assert->assertNoElementAfterWait('css', '.ajax-progress-throbber');
  }

}