Problem/Motivation
\Drupal\Tests\settings_tray\FunctionalJavascript\SettingsTrayBlockFormTest::testBlocks() is failing because the \Drupal\Tests\settings_tray\FunctionalJavascript\SettingsTrayTestBase::openBlockForm() is failing to open the form. If you put a sleep in here...
protected function openBlockForm($block_selector, $contextual_link_container = '') {
if (!$contextual_link_container) {
$contextual_link_container = $block_selector;
}
// Ensure that contextual link element is present because this is required
// to open the off-canvas dialog in edit mode.
$contextual_link = $this->assertSession()->waitForElement('css', "$contextual_link_container .contextual-links a");
$this->assertNotEmpty($contextual_link);
// When page first loads Edit Mode is not triggered until first contextual
// link is added.
$this->assertNotEmpty($this->assertSession()->waitForElementVisible('css', '.dialog-off-canvas-main-canvas.js-settings-tray-edit-mode'));
// THIS SLEEP MAKES IT ALWAYS PASS...
sleep(1);
$block = $this->getSession()->getPage()->find('css', $block_selector);
$block->mouseOver();
$block->click();
$this->waitForOffCanvasToOpen();
$this->assertOffCanvasBlockFormIsValid();
}
Prior to #3316274: Stabilize FunctionalJavascript testing AJAX: add ::assertExpectedAjaxRequest() there was
// Ensure that all other Ajax activity is completed.
$this->assertSession()->assertWaitOnAjaxRequest();
Where the SLEEP above is...
It'll always pass... also if you change \Drupal\Tests\settings_tray\FunctionalJavascript\SettingsTrayTestBase::getTestThemes() to return only stark it'll pass... and if you get it to return ['stark, 'stable9'] it'll fail on stable9 and not stark. All very odd.