diff --git a/core/modules/config/tests/src/FunctionalJavascript/ConfigEntityTest.php b/core/modules/config/tests/src/FunctionalJavascript/ConfigEntityTest.php index fc7faef..cb4af16 100644 --- a/core/modules/config/tests/src/FunctionalJavascript/ConfigEntityTest.php +++ b/core/modules/config/tests/src/FunctionalJavascript/ConfigEntityTest.php @@ -23,6 +23,7 @@ class ConfigEntityTest extends JavascriptTestBase { public function testCRUDUI() { $this->drupalLogin($this->drupalCreateUser(['administer site configuration'])); $assert_session = $this->assertSession(); + $page = $this->getSession()->getPage(); $id = 'id'; $label1 = 'Label 1'; @@ -35,9 +36,9 @@ public function testCRUDUI() { // Create a configuration entity. $this->drupalGet('admin/structure/config_test/add'); - $field_id = $assert_session->waitForField('id'); - $field_label = $assert_session->waitForField('label'); - $button_save = $assert_session->waitForButton('Save'); + $field_id = $page->findField('id'); + $field_label = $page->findField('label'); + $button_save = $page->findButton('Save'); // Set values for the configuration entity and submit the form. $field_id->setValue($id); @@ -64,7 +65,7 @@ public function testCRUDUI() { $this->drupalGet("admin/structure/config_test/manage/$id"); $this->clickLink(t('Delete')); $assert_session->addressEquals("admin/structure/config_test/manage/$id/delete"); - $assert_session->waitForButton('Delete')->click(); + $page->findButton('Delete')->click(); $assert_session->addressEquals('admin/structure/config_test'); $assert_session->responseNotContains($message_update); @@ -106,7 +107,7 @@ public function testCRUDUI() { $message_insert = new FormattableMarkup('%label configuration has been created.', ['%label' => '0']); $assert_session->responseContains($message_insert); $this->assertHref("admin/structure/config_test/manage/0"); - $delete_link = $this->waitForHref("admin/structure/config_test/manage/0/delete"); + $delete_link = $this->findHref("admin/structure/config_test/manage/0/delete"); // Expand the options. $ul = $delete_link->getParent()->getParent(); @@ -115,7 +116,7 @@ public function testCRUDUI() { // Navigate to the delete page and submit the delete form. $delete_link->click(); - $assert_session->waitForButton('Delete')->click(); + $page->findButton('Delete')->click(); $entity = \Drupal::entityTypeManager()->getStorage('config_test')->load('0'); $this->assertFalse($entity, 'Test entity deleted'); @@ -125,8 +126,8 @@ public function testCRUDUI() { $this->drupalGet('admin/structure/config_test/add'); // Test that the dependent element is not shown initially. - $field_size = $assert_session->waitForField('size'); - $field_size_value = $assert_session->waitForField('size_value'); + $field_size = $page->findField('size'); + $field_size_value = $page->findField('size_value'); $this->assertNotNull($field_size); $this->assertNull($field_size_value); @@ -155,7 +156,7 @@ public function testCRUDUI() { * The value of href attribute. */ protected function assertHref($href) { - $this->assertNotEmpty($this->waitForHref($href)); + $this->assertNotEmpty($this->findHref($href)); } /** @@ -165,22 +166,20 @@ protected function assertHref($href) { * The value of href attribute. */ protected function assertNotHref($href) { - $this->assertEmpty($this->waitForHref($href)); + $this->assertEmpty($this->findHref($href)); } /** - * Waits for a element with specified href and returns it when available. + * Finds element with specified value of href attribute. * * @param string $href - * The href attribute of element. - * @param int $timeout - * (Optional) Timeout in milliseconds, defaults to 10000. + * The value of href attribute. * * @return \Behat\Mink\Element\NodeElement|null * The page element node if found, NULL if not. */ - protected function waitForHref($href, $timeout = 10000) { - return $this->assertSession()->waitForElement('css', '[href="' . base_path() . $href . '"]', $timeout); + protected function findHref($href) { + return $this->getSession()->getPage()->find('css', '[href="' . base_path() . $href . '"]'); } }