public function ResponsivePreviewTest::testToolbarIntegration in Responsive Theme Preview 8
Tests that the toolbar integration works properly.
File
- tests/
src/ FunctionalJavascript/ ResponsivePreviewTest.php, line 60
Class
- ResponsivePreviewTest
- Tests the toolbar integration.
Namespace
Drupal\Tests\responsive_preview\FunctionalJavascriptCode
public function testToolbarIntegration() {
$entity = EntityTest::create();
$entity->name->value = $this
->randomMachineName();
$entity
->save();
$this
->drupalLogin($this->previewUser);
$this
->drupalGet($entity
->toUrl());
$this
->selectDevice('(//*[@id="responsive-preview-toolbar-tab"]//button[@data-responsive-preview-name])[1]');
$this
->assertSession()
->elementNotExists('xpath', '//*[@id="responsive-preview-orientation" and contains(@class, "rotated")]');
$this
->assertSession()
->assertWaitOnAjaxRequest();
$this
->assertTrue($this
->getSession()
->evaluateScript("jQuery('#responsive-preview-frame')[0].contentWindow.location.href.endsWith('/entity_test/1')"));
}