Commit f4e4dd42 authored by catch's avatar catch
Browse files

Issue #3521639 by mstrelan, smustgrave: [random test failure] Toolbar Test (toolbarTest.js)

parent b2df443d
Loading
Loading
Loading
Loading
Loading
+5 −22
Original line number Diff line number Diff line
@@ -13,27 +13,10 @@ const userOrientationBtn = `${itemUserTray} .toolbar-toggle-orientation button`;
module.exports = {
  '@tags': ['core'],
  before(browser) {
    browser
      .drupalInstall()
      .drupalInstallModule('toolbar', true)
      .drupalCreateUser({
        name: 'user',
        password: '123',
        permissions: [
          'access site reports',
          'access toolbar',
          'access administration pages',
          'administer menu',
          'administer modules',
          'administer site configuration',
          'administer account settings',
          'administer software updates',
          'access content',
          'administer permissions',
          'administer users',
        ],
      })
      .drupalLogin({ name: 'user', password: '123' });
    browser.drupalInstall({
      setupFile:
        'core/modules/toolbar/tests/src/Nightwatch/ToolbarTestSetup.php',
    });
  },
  beforeEach(browser) {
    // Set the resolution to the default desktop resolution. Ensure the default
@@ -189,7 +172,7 @@ module.exports = {
    browser.drupalRelativeURL('/admin');
    // Don't check the visibility as stark doesn't add the .path-admin class
    // to the <body> required to display the button.
    browser.assert.attributeContains(escapeSelector, 'href', '/user/2');
    browser.assert.attributeContains(escapeSelector, 'href', '/user/login');
  },
  'Aural view test: tray orientation': (browser) => {
    browser.waitForElementPresent(
+38 −0
Original line number Diff line number Diff line
<?php

declare(strict_types=1);

namespace Drupal\Tests\toolbar\Nightwatch;

use Drupal\Core\Extension\ModuleInstallerInterface;
use Drupal\TestSite\TestSetupInterface;
use Drupal\user\Entity\Role;
use Drupal\user\RoleInterface;

/**
 * Sets up the site for testing the toolbar module.
 */
class ToolbarTestSetup implements TestSetupInterface {

  /**
   * {@inheritdoc}
   */
  public function setup(): void {
    $module_installer = \Drupal::service('module_installer');
    assert($module_installer instanceof ModuleInstallerInterface);
    $module_installer->install(['toolbar']);

    $role = Role::load(RoleInterface::ANONYMOUS_ID);
    foreach ([
      'access toolbar',
      'access administration pages',
      'administer modules',
      'administer site configuration',
      'administer account settings',
    ] as $permission) {
      $role->grantPermission($permission);
    }
    $role->save();
  }

}