Unverified Commit cb1f6e05 authored by Alex Pott's avatar Alex Pott
Browse files

task: #3586616 Remove search from olivero_test module

By: quietone
By: dcam
parent 468b3079
Loading
Loading
Loading
Loading
Loading
+36 −0
Original line number Diff line number Diff line
<?php

declare(strict_types=1);

namespace Drupal\Tests\search\Nightwatch\Olivero;

use Drupal\Core\Extension\ModuleInstallerInterface;
use Drupal\Core\Extension\ThemeInstallerInterface;
use Drupal\TestSite\TestSetupInterface;

/**
 * Setup file used by TestSiteInstallTestScript.
 *
 * @see \Drupal\KernelTests\Scripts\TestSiteApplicationTest
 */
class TestSiteOliveroInstallTestScript implements TestSetupInterface {

  /**
   * {@inheritdoc}
   */
  public function setup(): void {
    // Install required module for the Olivero front page.
    $module_installer = \Drupal::service('module_installer');
    assert($module_installer instanceof ModuleInstallerInterface);
    $module_installer->install(['olivero_test']);
    $module_installer->install(['search']);

    // Install Olivero and set it as the default theme.
    $theme_installer = \Drupal::service('theme_installer');
    assert($theme_installer instanceof ThemeInstallerInterface);
    $theme_installer->install(['olivero'], TRUE);
    $system_theme_config = \Drupal::configFactory()->getEditable('system.theme');
    $system_theme_config->set('default', 'olivero')->save();
  }

}
+45 −0
Original line number Diff line number Diff line
module.exports = {
  '@tags': ['core', 'olivero'],
  before(browser) {
    browser
      .drupalInstall({
        setupFile:
          'core/modules/search/tests/src/Nightwatch/Tests/Olivero/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 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"]');
      });
  },
  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.');
        },
      );
  },
};
+1 −1
Original line number Diff line number Diff line
@@ -12,7 +12,7 @@ module.exports = {
    browser
      .drupalInstall({
        setupFile:
          'core/tests/Drupal/TestSite/TestSiteOliveroInstallTestScript.php',
          'core/modules/search/tests/src/Nightwatch/Tests/Olivero/TestSiteOliveroInstallTestScript.php',
        installProfile: 'minimal',
      })
      // Create user that can search.
+0 −1
Original line number Diff line number Diff line
@@ -9,7 +9,6 @@ dependencies:
  - drupal:form_test
  - drupal:image
  - drupal:path
  - drupal:search
  - drupal:taxonomy
  - drupal:views
  - drupal:js_message_test
+0 −12
Original line number Diff line number Diff line
@@ -11,24 +11,12 @@ module.exports = {
        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',