Skip to content

Commit 0c57438

Browse files
committed
Fix failing test in diff.feature
1 parent b6807fb commit 0c57438

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

modules/custom/wxt_core/tests/context/CkEditorContext.behat.inc

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,4 +184,28 @@ final class CkEditorContext extends DrupalSubContextBase {
184184
return explode(',', $keys);
185185
}
186186

187+
/**
188+
* Switches CKEditor 5 to source editing mode.
189+
*
190+
* @throws \Behat\Mink\Exception\ExpectationException
191+
* Thrown when the source editing button cannot be found.
192+
*
193+
* @When I switch CKEditor to source mode
194+
*/
195+
public function switchCkeditorToSourceMode() {
196+
$selector = 'button.ck-source-editing-button';
197+
$this->getSession()->wait(10000, "document.querySelector('$selector') !== null");
198+
199+
$element = $this->getSession()->getPage()->find('css', $selector);
200+
201+
if (!$element) {
202+
throw new ExpectationException(
203+
'Could not find the CKEditor source editing button.',
204+
$this->getSession()->getDriver()
205+
);
206+
}
207+
208+
$element->click();
209+
}
210+
187211
}

tests/features/workflow/diff.feature

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Feature: Diffing different revisions of content
99
When I visit "/drupal-10"
1010
And I follow "Edit"
1111
# CKEditor5 hides the textarea; switch to Source mode so body[0][value] is editable.
12-
And I click "button.ck-source-editing-button" element
12+
And I switch CKEditor to source mode
1313
And I enter "Second revision" for "body[0][value]"
1414
And I press "Save"
1515
And I follow "Edit"

0 commit comments

Comments
 (0)