You are here

public function WorkspaceToolbarIntegrationTest::testWorkspaceCanvasToggling in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/workspaces/tests/src/FunctionalJavascript/WorkspaceToolbarIntegrationTest.php \Drupal\Tests\workspaces\FunctionalJavascript\WorkspaceToolbarIntegrationTest::testWorkspaceCanvasToggling()

Test workspace canvas can be toggled with JavaScript.

File

core/modules/workspaces/tests/src/FunctionalJavascript/WorkspaceToolbarIntegrationTest.php, line 40

Class

WorkspaceToolbarIntegrationTest
Tests workspace settings stray integration.

Namespace

Drupal\Tests\workspaces\FunctionalJavascript

Code

public function testWorkspaceCanvasToggling() {
  $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');
}