Skip to content

Commit

Permalink
Fix test fails on drupal 10.3.7 (#1021)
Browse files Browse the repository at this point in the history
* the existing selector matches multiple so allow refining
  • Loading branch information
demeritcowboy authored Nov 13, 2024
1 parent 4df2f24 commit a343775
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions tests/src/FunctionalJavascript/WebformCivicrmTestBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ abstract class WebformCivicrmTestBase extends CiviCrmTestBase {

use WebformBrowserTestTrait;
use \Drupal\Tests\mink_civicrm_helpers\Traits\Utils;
use \Drupal\Tests\system\Traits\OffCanvasTestTrait;

/**
* {@inheritdoc}
Expand All @@ -23,6 +24,7 @@ abstract class WebformCivicrmTestBase extends CiviCrmTestBase {
'webform_civicrm',
'token',
'ckeditor5',
'off_canvas_test',
'mink_civicrm_helpers',
];

Expand Down Expand Up @@ -351,11 +353,13 @@ public function assertFieldValue($selector, $value, $isRadio = FALSE) {
* TRUE if only one option is enabled on the element.
* @param string $asList
* TRUE if element need to be rendered as select element.
* @param string $secondarySelector
* optional secondary selector
*/
protected function editCivicrmOptionElement($selector, $multiple = TRUE, $enableStatic = FALSE, $default = NULL, $type = NULL, $singleOption = FALSE, $asList = FALSE) {
$checkbox_edit_button = $this->assertSession()->elementExists('css', '[data-drupal-selector="' . $selector . '"] a.webform-ajax-link');
protected function editCivicrmOptionElement($selector, $multiple = TRUE, $enableStatic = FALSE, $default = NULL, $type = NULL, $singleOption = FALSE, $asList = FALSE, $secondarySelector = 'li.edit') {
$checkbox_edit_button = $this->assertSession()->elementExists('css', '[data-drupal-selector="' . $selector . '"] ' . ($secondarySelector ? "$secondarySelector " : '') . 'a.webform-ajax-link');
$checkbox_edit_button->click();
$this->assertSession()->waitForField('drupal-off-canvas');
$this->waitForOffCanvasArea();
$this->htmlOutput();
if ($type) {
$this->assertSession()->elementExists('css', '[data-drupal-selector="edit-change-type"]')->click();
Expand Down

0 comments on commit a343775

Please sign in to comment.