File tree Expand file tree Collapse file tree 2 files changed +26
-2
lines changed
modules/custom/wxt_core/tests/context Expand file tree Collapse file tree 2 files changed +26
-2
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+ * Toggles CKEditor 5 in/out of source editing mode.
189+ *
190+ * @throws \Behat\Mink\Exception\ExpectationException
191+ * Thrown when the source editing button cannot be found.
192+ *
193+ * @When I toggle CKEditor source mode
194+ */
195+ public function toggleCkeditorToSourceMode () {
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,12 +9,12 @@ 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 toggle CKEditor source mode
1313 And I enter "Second revision" for "body[0][value]"
1414 And I press "Save"
1515 And I follow "Edit"
1616 # CKEditor5 hides the textarea; switch to Source mode so body[0][value] is editable.
17- And I click "button.ck- source-editing-button" element
17+ And I toggle CKEditor source mode
1818 And I enter "Third revision" for "body[0][value]"
1919 And I press "Save"
2020 And I compare the 1st and 2nd revisions
You can’t perform that action at this time.
0 commit comments