class WorkspaceToolbarIntegrationTest
Same name in this branch
- 11.x core/modules/workspaces/tests/src/FunctionalJavascript/WorkspaceToolbarIntegrationTest.php \Drupal\Tests\workspaces\FunctionalJavascript\WorkspaceToolbarIntegrationTest
Same name in other branches
- 9 core/modules/workspaces/tests/src/FunctionalJavascript/WorkspaceToolbarIntegrationTest.php \Drupal\Tests\workspaces\FunctionalJavascript\WorkspaceToolbarIntegrationTest
- 8.9.x core/modules/workspaces/tests/src/FunctionalJavascript/WorkspaceToolbarIntegrationTest.php \Drupal\Tests\workspaces\FunctionalJavascript\WorkspaceToolbarIntegrationTest
- 10 core/modules/workspaces/tests/src/FunctionalJavascript/WorkspaceToolbarIntegrationTest.php \Drupal\Tests\workspaces\FunctionalJavascript\WorkspaceToolbarIntegrationTest
Tests workspace settings stray integration.
@group workspaces_ui
Hierarchy
- class \Drupal\Tests\BrowserTestBase extends \PHPUnit\Framework\TestCase uses \Drupal\Core\Test\FunctionalTestSetupTrait, \Drupal\Tests\UiHelperTrait, \Drupal\Core\Test\TestSetupTrait, \Drupal\Tests\block\Traits\BlockCreationTrait, \Drupal\Tests\RandomGeneratorTrait, \Drupal\Tests\node\Traits\NodeCreationTrait, \Drupal\Tests\node\Traits\ContentTypeCreationTrait, \Drupal\Tests\ConfigTestTrait, \Drupal\Tests\TestRequirementsTrait, \Drupal\Tests\user\Traits\UserCreationTrait, \Drupal\Tests\XdebugRequestTrait, \Drupal\Tests\PhpUnitCompatibilityTrait, \Drupal\TestTools\Extension\DeprecationBridge\ExpectDeprecationTrait, \Drupal\Tests\ExtensionListTestTrait
- class \Drupal\FunctionalJavascriptTests\WebDriverTestBase extends \Drupal\Tests\BrowserTestBase
- class \Drupal\Tests\system\FunctionalJavascript\OffCanvasTestBase extends \Drupal\FunctionalJavascriptTests\WebDriverTestBase uses \Drupal\Tests\system\Traits\OffCanvasTestTrait
- class \Drupal\Tests\workspaces_ui\FunctionalJavascript\WorkspaceToolbarIntegrationTest extends \Drupal\Tests\system\FunctionalJavascript\OffCanvasTestBase
- class \Drupal\Tests\system\FunctionalJavascript\OffCanvasTestBase extends \Drupal\FunctionalJavascriptTests\WebDriverTestBase uses \Drupal\Tests\system\Traits\OffCanvasTestTrait
- class \Drupal\FunctionalJavascriptTests\WebDriverTestBase extends \Drupal\Tests\BrowserTestBase
Expanded class hierarchy of WorkspaceToolbarIntegrationTest
File
-
core/
modules/ workspaces_ui/ tests/ src/ FunctionalJavascript/ WorkspaceToolbarIntegrationTest.php, line 14
Namespace
Drupal\Tests\workspaces_ui\FunctionalJavascriptView source
class WorkspaceToolbarIntegrationTest extends OffCanvasTestBase {
/**
* {@inheritdoc}
*/
protected static $modules = [
'toolbar',
'workspaces',
'workspaces_ui',
];
/**
* {@inheritdoc}
*/
protected $defaultTheme = 'stark';
/**
* {@inheritdoc}
*/
protected function setUp() : void {
parent::setUp();
$admin_user = $this->drupalCreateUser([
'administer workspaces',
'access toolbar',
'access administration pages',
]);
$this->drupalLogin($admin_user);
}
/**
* Tests workspace canvas can be toggled with JavaScript.
*/
public function testWorkspaceCanvasToggling() : void {
$page = $this->getSession()
->getPage();
$assert_session = $this->assertSession();
// Set size for horizontal toolbar.
$this->getSession()
->resizeWindow(1200, 600);
$this->drupalGet('<front>');
// Wait for toolbar to appear.
$this->assertNotEmpty($assert_session->waitForElement('css', 'body.toolbar-horizontal'));
// Open workspace canvas.
$page->clickLink('Switch workspace');
$this->waitForOffCanvasToOpen('top');
$assert_session->elementExists('css', '.workspaces-dialog');
// Close Canvas.
$page->pressButton('Close');
$this->waitForOffCanvasToClose();
$assert_session->assertNoElementAfterWait('css', '.workspaces-dialog');
}
/**
* Tests workspace switch and landing page behavior.
*/
public function testWorkspaceSwitch() : void {
$page = $this->getSession()
->getPage();
$assert_session = $this->assertSession();
// Wait for toolbar to appear.
$this->getSession()
->resizeWindow(1200, 600);
$this->drupalGet('admin');
// Wait for toolbar to appear.
$this->assertNotEmpty($assert_session->waitForElement('css', 'body.toolbar-horizontal'));
// Open workspace canvas.
$page->clickLink('Switch workspace');
$this->waitForOffCanvasToOpen('top');
// Click 'stage' workspace and confirm switch.
$page->clickLink('Stage');
$this->assertElementVisibleAfterWait('css', '.workspace-activate-form.workspace-confirm-form');
$page->find('css', '.ui-dialog-buttonset .button--primary')
->click();
$assert_session->statusMessageContainsAfterWait('Stage is now the active workspace.', 'status');
// Make sure we stay on same page after switch.
$assert_session->addressEquals('admin');
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.