$title) { // Open multiselect dialog. $dialog = $multiselect_form->getField($field)->edit(); $this->checkErrorsAndTitle($dialog, $title); // Set form element of current overlay dialog if multiple dialogs are opened. if ($count > 1) { $multiselect_form = $dialog->asForm(['normalized' => true]); } } $this->closeMultiselectDialogs(); } } /** * Function for closing all opened multiselect dialogs one by one. */ protected function closeMultiselectDialogs() { $dialogs = COverlayDialogElement::find()->all(); for ($i = $dialogs->count() - 1; $i >= 0; $i--) { $dialogs->get($i)->close(true); } } /** * Function for checking dialog title and error absence in it. * * @param COverlayDialogElement $dialog dialog form where checks are performed * @param string $title title of a dialog */ protected function checkErrorsAndTitle($dialog, $title) { $this->assertEquals($title, $dialog->getTitle()); // Check that opened dialog does not contain any error messages. $this->assertFalse($dialog->query('xpath:.//*[contains(@class, "msg-bad")]')->exists()); } }