Loading core/modules/toolbar/tests/src/Nightwatch/Tests/toolbarTest.js +5 −22 Original line number Diff line number Diff line Loading @@ -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 Loading Loading @@ -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( Loading core/modules/toolbar/tests/src/Nightwatch/ToolbarTestSetup.php 0 → 100644 +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(); } } Loading
core/modules/toolbar/tests/src/Nightwatch/Tests/toolbarTest.js +5 −22 Original line number Diff line number Diff line Loading @@ -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 Loading Loading @@ -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( Loading
core/modules/toolbar/tests/src/Nightwatch/ToolbarTestSetup.php 0 → 100644 +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(); } }