Skip to content
Snippets Groups Projects
Commit 1ef022e7 authored by catch's avatar catch
Browse files

Issue #2971472 by alexpott, vaplas, tedbow, borisson_:...

Issue #2971472 by alexpott, vaplas, tedbow, borisson_: SettingsTrayBlockFormTest is taking 5 minutes to run
parent c8659444
No related branches found
No related tags found
No related merge requests found
......@@ -40,14 +40,25 @@ protected function setUp() {
/**
* Tests opening off-canvas dialog by click blocks and elements in the blocks.
*
* @dataProvider providerTestBlocks
*/
public function testBlocks($theme, $block_plugin, $new_page_text, $element_selector, $label_selector, $button_text, $toolbar_item, $permissions) {
public function testBlocks() {
foreach ($this->getBlockTests() as $test) {
call_user_func_array([$this, 'doTestBlocks'], $test);
}
}
/**
* Tests opening off-canvas dialog by click blocks and elements in the blocks.
*/
protected function doTestBlocks($theme, $block_plugin, $new_page_text, $element_selector, $label_selector, $button_text, $toolbar_item, $permissions) {
if ($permissions) {
$this->grantPermissions(Role::load(Role::AUTHENTICATED_ID), $permissions);
}
if ($new_page_text) {
// Some asserts can be based on this value, so it should not be the same
// for different blocks, because it can be saved in the site config.
$new_page_text = $new_page_text . ' ' . $theme . ' ' . $block_plugin;
}
$web_assert = $this->assertSession();
$page = $this->getSession()->getPage();
$this->enableTheme($theme);
......@@ -131,12 +142,18 @@ public function testBlocks($theme, $block_plugin, $new_page_text, $element_selec
$web_assert->elementTextContains('css', '#drupal-live-announce', 'Exited edit mode.');
$web_assert->elementTextNotContains('css', '.contextual-toolbar-tab button', 'Editing');
$web_assert->elementAttributeNotContains('css', '.dialog-off-canvas-main-canvas', 'class', 'js-settings-tray-edit-mode');
// Clean up test data so each test does not impact the next.
$block->delete();
if ($permissions) {
user_role_revoke_permissions(Role::AUTHENTICATED_ID, $permissions);
}
}
/**
* Dataprovider for testBlocks().
* Creates tests for ::testBlocks().
*/
public function providerTestBlocks() {
public function getBlockTests() {
$blocks = [];
foreach ($this->getTestThemes() as $theme) {
$blocks += [
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment