diff --git a/core/modules/contextual/tests/src/FunctionalJavascript/EditModeTest.php b/core/modules/contextual/tests/src/FunctionalJavascript/EditModeTest.php index 9fdef448d7..dc978aad1d 100644 --- a/core/modules/contextual/tests/src/FunctionalJavascript/EditModeTest.php +++ b/core/modules/contextual/tests/src/FunctionalJavascript/EditModeTest.php @@ -11,10 +11,11 @@ */ class EditModeTest extends JavascriptTestBase { + /** + * CSS selector for Drupal's announce element. + */ const ANNOUNCE_SELECTOR = '#drupal-live-announce'; - const EDIT_BUTTON_SELECTOR = '#toolbar-bar div.contextual-toolbar-tab button'; - /** * {@inheritdoc} */ @@ -33,17 +34,17 @@ class EditModeTest extends JavascriptTestBase { */ protected function setUp() { parent::setUp(); - $user = $this->createUser([ + + $this->drupalLogin($this->createUser([ 'administer blocks', 'access contextual links', 'access toolbar', - ]); - $this->drupalLogin($user); + ])); $this->placeBlock('system_powered_by_block', ['id' => 'powered']); } /** - * Test Drupal.announce messages appear. + * Tests that Drupal.announce messages appear. */ public function testAnnounceEditMode() { $web_assert = $this->assertSession(); @@ -67,15 +68,15 @@ public function testAnnounceEditMode() { } /** - * Press the toolbar edit mode. + * Presses the toolbar edit mode. */ protected function pressToolbarEditButton() { - $edit_button = $this->getSession()->getPage()->find('css', static::EDIT_BUTTON_SELECTOR); + $edit_button = $this->getSession()->getPage()->find('css', '#toolbar-bar div.contextual-toolbar-tab button'); $edit_button->press(); } /** - * Assert that the correct message was announced when entering edit mode. + * Asserts that the correct message was announced when entering edit mode. */ protected function assertAnnounceEditMode() { $web_assert = $this->assertSession();