summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNathaniel Catchpole2018-05-17 10:39:12 (GMT)
committerNathaniel Catchpole2018-05-17 10:39:12 (GMT)
commit1ef022e7536656429eb2ed4e0d9c7c483dffbcaa (patch)
tree2f01c50a1474db9ada12150a8db8f8f05c2b9e0c
parentc8659444458d822e6c36147ba9e6ad4ff9c943c3 (diff)
Issue #2971472 by alexpott, vaplas, tedbow, borisson_: SettingsTrayBlockFormTest is taking 5 minutes to run
-rw-r--r--core/modules/settings_tray/tests/src/FunctionalJavascript/SettingsTrayBlockFormTest.php29
1 files changed, 23 insertions, 6 deletions
diff --git a/core/modules/settings_tray/tests/src/FunctionalJavascript/SettingsTrayBlockFormTest.php b/core/modules/settings_tray/tests/src/FunctionalJavascript/SettingsTrayBlockFormTest.php
index 5e38c1d..106dae4 100644
--- a/core/modules/settings_tray/tests/src/FunctionalJavascript/SettingsTrayBlockFormTest.php
+++ b/core/modules/settings_tray/tests/src/FunctionalJavascript/SettingsTrayBlockFormTest.php
@@ -40,14 +40,25 @@ class SettingsTrayBlockFormTest extends SettingsTrayTestBase {
/**
* 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 @@ class SettingsTrayBlockFormTest extends SettingsTrayTestBase {
$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 += [