function WorkspaceToolbarIntegrationTest::testWorkspaceSwitch

Same name in other branches
  1. 8.9.x core/modules/workspaces/tests/src/FunctionalJavascript/WorkspaceToolbarIntegrationTest.php \Drupal\Tests\workspaces\FunctionalJavascript\WorkspaceToolbarIntegrationTest::testWorkspaceSwitch()
  2. 10 core/modules/workspaces/tests/src/FunctionalJavascript/WorkspaceToolbarIntegrationTest.php \Drupal\Tests\workspaces\FunctionalJavascript\WorkspaceToolbarIntegrationTest::testWorkspaceSwitch()
  3. 11.x core/modules/workspaces/tests/src/FunctionalJavascript/WorkspaceToolbarIntegrationTest.php \Drupal\Tests\workspaces\FunctionalJavascript\WorkspaceToolbarIntegrationTest::testWorkspaceSwitch()
  4. 11.x core/modules/workspaces_ui/tests/src/FunctionalJavascript/WorkspaceToolbarIntegrationTest.php \Drupal\Tests\workspaces_ui\FunctionalJavascript\WorkspaceToolbarIntegrationTest::testWorkspaceSwitch()

Tests workspace switch and landing page behavior.

File

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

Class

WorkspaceToolbarIntegrationTest
Tests workspace settings stray integration.

Namespace

Drupal\Tests\workspaces\FunctionalJavascript

Code

public function testWorkspaceSwitch() {
    $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.