Unverified Commit 7578516f authored by Alex Pott's avatar Alex Pott
Browse files

Issue #3231416 by mherchel, ankithashetty, Gauravmahlawat, chetanbharambe,...

Issue #3231416 by mherchel, ankithashetty, Gauravmahlawat, chetanbharambe, davidwbarratt: Olivero should not expect its default menu blocks to always exist
parent ec2c23d6
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
/**
 * @file
 * Log all errors.
 */

Drupal.errorLog = [];

window.addEventListener('error', (e) => {
  Drupal.errorLog.push(e);
});
+11 −0
Original line number Diff line number Diff line
/**
* DO NOT EDIT THIS FILE.
* See the following change record for more information,
* https://www.drupal.org/node/2815083
* @preserve
**/

Drupal.errorLog = [];
window.addEventListener('error', function (e) {
  Drupal.errorLog.push(e);
});
 No newline at end of file
+5 −0
Original line number Diff line number Diff line
log-errors:
  js:
    js/log-errors.js: { weight: -15 }
  dependencies:
    - core/drupal
+7 −0
Original line number Diff line number Diff line
@@ -14,3 +14,10 @@ function olivero_test_preprocess_field_multiple_value_form(&$variables) {
    $variables['element']['#disabled'] = TRUE;
  }
}

/**
 * Implements hook_preprocess_html().
 */
function olivero_test_preprocess_html(&$variables) {
  $variables['#attached']['library'][] = 'olivero_test/log-errors';
}
+57 −0
Original line number Diff line number Diff line
module.exports = {
  '@tags': ['core', 'olivero'],
  before(browser) {
    browser
      .drupalInstall({
        setupFile:
          'core/tests/Drupal/TestSite/TestSiteOliveroInstallTestScript.php',
        installProfile: 'minimal',
      })
      .drupalLoginAsAdmin(() => {
        browser
          .drupalRelativeURL('/admin/structure/block')

          // Disable narrow search form block.
          .click(
            '[data-drupal-selector="edit-blocks-olivero-search-form-narrow-operations"] .dropbutton-toggle button',
          )
          .click('[href*="olivero_search_form_narrow/disable"]')

          // Disable main menu block.
          .click(
            '[data-drupal-selector="edit-blocks-olivero-main-menu-operations"] .dropbutton-toggle button',
          )
          .click('[href*="olivero_main_menu/disable"]')

          // Disable wide search form block.
          .click(
            '[data-drupal-selector="edit-blocks-olivero-search-form-wide-operations"] .dropbutton-toggle button',
          )
          .click('[href*="olivero_search_form_wide/disable"]')

          // Disable user account menu block.
          .click(
            '[data-drupal-selector="edit-blocks-olivero-account-menu-operations"] .dropbutton-toggle button',
          )
          .click('[href*="olivero_account_menu/disable"]');
      });
  },
  after(browser) {
    browser.drupalUninstall();
  },
  'Verify no console errors': (browser) => {
    browser
      .drupalRelativeURL('/')
      .waitForElementVisible('body')
      .execute(
        // eslint-disable-next-line func-names, prefer-arrow-callback, no-shadow
        function () {
          return Drupal.errorLog.length === 0;
        },
        [],
        (result) => {
          browser.assert.ok(result.value, 'Verify no console errors exist.');
        },
      );
  },
};
Loading