$new_page_text =
$new_page_text . ' ' .
$theme . ' ' .
$block_plugin;
} $web_assert =
$this->
assertSession();
$page =
$this->
getSession()->
getPage();
$this->
enableTheme($theme);
$block =
$this->
placeBlock($block_plugin);
$block_selector =
$this->
getBlockSelector($block);
$block_id =
$block->
id();
$this->
drupalGet('user'
);
$link =
$web_assert->
waitForElement('css', "
$block_selector .contextual-links li a"
);
$this->
assertEquals('Quick edit',
$link->
getHtml(), "'Quick edit' is the first contextual link for the block."
);
$destination =
(string) $this->loggedInUser->
toUrl()->
toString();
$this->
assertStringContainsString("/admin/structure/block/manage/
$block_id/settings-tray?destination=
$destination",
$link->
getAttribute('href'
));
if (isset($toolbar_item)) { // Check that you can open a toolbar tray and it will be closed after
// entering edit mode.
if ($element =
$page->
find('css', "#toolbar-administration a.is-active"
)) { // If a tray was open from page load close it.
$element->
click();
$web_assert->
assertNoElementAfterWait('css', "#toolbar-administration a.is-active"
);
}