Issue #3272797 by bnjmnm, phenaproxima, xjm: [random test failure] Restore LayoutBuilderTest::testConfigurableLayoutSections()
(cherry picked from commit ce4e8fa361
)
merge-requests/2071/head
parent
994805a99b
commit
a87055c118
|
@ -7,6 +7,7 @@ use Drupal\block_content\Entity\BlockContentType;
|
||||||
use Drupal\Core\Url;
|
use Drupal\Core\Url;
|
||||||
use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
|
use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
|
||||||
use Drupal\Tests\contextual\FunctionalJavascript\ContextualLinkClickTrait;
|
use Drupal\Tests\contextual\FunctionalJavascript\ContextualLinkClickTrait;
|
||||||
|
use Drupal\Tests\system\Traits\OffCanvasTestTrait;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests the Layout Builder UI.
|
* Tests the Layout Builder UI.
|
||||||
|
@ -17,6 +18,7 @@ class LayoutBuilderTest extends WebDriverTestBase {
|
||||||
|
|
||||||
use ContextualLinkClickTrait;
|
use ContextualLinkClickTrait;
|
||||||
use LayoutBuilderSortTrait;
|
use LayoutBuilderSortTrait;
|
||||||
|
use OffCanvasTestTrait;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
|
@ -27,6 +29,7 @@ class LayoutBuilderTest extends WebDriverTestBase {
|
||||||
'layout_builder',
|
'layout_builder',
|
||||||
'layout_test',
|
'layout_test',
|
||||||
'node',
|
'node',
|
||||||
|
'off_canvas_test',
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -285,17 +288,19 @@ class LayoutBuilderTest extends WebDriverTestBase {
|
||||||
$assert_session->linkExists('Add section');
|
$assert_session->linkExists('Add section');
|
||||||
$this->clickLink('Add section');
|
$this->clickLink('Add section');
|
||||||
$assert_session->assertWaitOnAjaxRequest();
|
$assert_session->assertWaitOnAjaxRequest();
|
||||||
$assert_session->elementExists('css', '#drupal-off-canvas');
|
$this->waitForOffCanvasArea();
|
||||||
|
|
||||||
$assert_session->linkExists('One column');
|
$assert_session->linkExists('One column');
|
||||||
$this->clickLink('One column');
|
$this->clickLink('One column');
|
||||||
$assert_session->assertWaitOnAjaxRequest();
|
$assert_session->assertWaitOnAjaxRequest();
|
||||||
|
$this->waitForOffCanvasArea();
|
||||||
|
|
||||||
// Add another section.
|
// Add another section.
|
||||||
$assert_session->linkExists('Add section');
|
$assert_session->linkExists('Add section');
|
||||||
$this->clickLink('Add section');
|
$this->clickLink('Add section');
|
||||||
|
|
||||||
|
$this->waitForOffCanvasArea();
|
||||||
$assert_session->waitForElementVisible('named', ['link', 'Layout plugin (with settings)']);
|
$assert_session->waitForElementVisible('named', ['link', 'Layout plugin (with settings)']);
|
||||||
$assert_session->elementExists('css', '#drupal-off-canvas');
|
|
||||||
|
|
||||||
$assert_session->linkExists('Layout plugin (with settings)');
|
$assert_session->linkExists('Layout plugin (with settings)');
|
||||||
$this->clickLink('Layout plugin (with settings)');
|
$this->clickLink('Layout plugin (with settings)');
|
||||||
|
@ -310,9 +315,10 @@ class LayoutBuilderTest extends WebDriverTestBase {
|
||||||
// Ensure validation error is displayed for ConfigureSectionForm.
|
// Ensure validation error is displayed for ConfigureSectionForm.
|
||||||
$assert_session->linkExists('Add section');
|
$assert_session->linkExists('Add section');
|
||||||
$this->clickLink('Add section');
|
$this->clickLink('Add section');
|
||||||
|
$this->waitForOffCanvasArea();
|
||||||
|
|
||||||
$assert_session->waitForElementVisible('named', ['link', 'Layout plugin (with settings)']);
|
$assert_session->waitForElementVisible('named', ['link', 'Layout plugin (with settings)']);
|
||||||
$this->clickLink('Layout plugin (with settings)');
|
$this->clickLink('Layout plugin (with settings)');
|
||||||
$this->markTestSkipped('Temporarily skipped due to random failures.');
|
|
||||||
$this->assertOffCanvasFormAfterWait('layout_builder_configure_section');
|
$this->assertOffCanvasFormAfterWait('layout_builder_configure_section');
|
||||||
$page->fillField('layout_settings[setting_1]', 'Test Validation Error Message');
|
$page->fillField('layout_settings[setting_1]', 'Test Validation Error Message');
|
||||||
$page->pressButton('Add section');
|
$page->pressButton('Add section');
|
||||||
|
@ -481,7 +487,8 @@ class LayoutBuilderTest extends WebDriverTestBase {
|
||||||
*/
|
*/
|
||||||
private function assertOffCanvasFormAfterWait(string $expected_form_id): void {
|
private function assertOffCanvasFormAfterWait(string $expected_form_id): void {
|
||||||
$this->assertSession()->assertWaitOnAjaxRequest();
|
$this->assertSession()->assertWaitOnAjaxRequest();
|
||||||
$off_canvas = $this->assertSession()->waitForElementVisible('css', '#drupal-off-canvas');
|
$this->waitForOffCanvasArea();
|
||||||
|
$off_canvas = $this->assertSession()->elementExists('css', '#drupal-off-canvas');
|
||||||
$this->assertNotNull($off_canvas);
|
$this->assertNotNull($off_canvas);
|
||||||
$form_id_element = $off_canvas->find('hidden_field_selector', ['hidden_field', 'form_id']);
|
$form_id_element = $off_canvas->find('hidden_field_selector', ['hidden_field', 'form_id']);
|
||||||
// Ensure the form ID has the correct value and that the form is visible.
|
// Ensure the form ID has the correct value and that the form is visible.
|
||||||
|
|
|
@ -18,6 +18,11 @@ trait OffCanvasTestTrait {
|
||||||
// The data-resize-done attribute is added by the off_canvas_test module's
|
// The data-resize-done attribute is added by the off_canvas_test module's
|
||||||
// wrapper around Drupal.offCanvas.resetSize.
|
// wrapper around Drupal.offCanvas.resetSize.
|
||||||
$this->assertNotEmpty($this->assertSession()->waitForElementVisible('css', '[data-resize-done="true"]'));
|
$this->assertNotEmpty($this->assertSession()->waitForElementVisible('css', '[data-resize-done="true"]'));
|
||||||
|
|
||||||
|
// Remove the data-resize-done attribute so in scenarios where off-canvas
|
||||||
|
// opens yet another off-canvas, waitForOffCanvasArea() is looking for the
|
||||||
|
// attribute on a new dialog, not an existing one.
|
||||||
|
$this->getSession()->executeScript('document.querySelector("[data-resize-done]").removeAttribute("data-resize-done")');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue