File tree Expand file tree Collapse file tree 2 files changed +25
-1
lines changed
modules/custom/wxt_core/tests/context Expand file tree Collapse file tree 2 files changed +25
-1
lines changed Original file line number Diff line number Diff 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}
Original file line number Diff line number Diff 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"
You can’t perform that action at this time.
0 commit comments