From e8e7f047a3d12f77965b57770e1457eeb0d03bee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pau=20Ferrer=20Oca=C3=B1a?= Date: Tue, 9 Jan 2024 15:42:33 +0100 Subject: [PATCH] MOBILE-3947 behat: Update findField to admit rte --- src/addons/mod/quiz/tests/behat/basic_usage.feature | 1 - src/testing/services/behat-dom.ts | 11 +++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/addons/mod/quiz/tests/behat/basic_usage.feature b/src/addons/mod/quiz/tests/behat/basic_usage.feature index 8d0ce09c933..d6005859d91 100755 --- a/src/addons/mod/quiz/tests/behat/basic_usage.feature +++ b/src/addons/mod/quiz/tests/behat/basic_usage.feature @@ -133,7 +133,6 @@ Feature: Attempt a quiz in app And I should find "Question 1" in the app And I should find "Question 2" in the app - @ionic7_failure Scenario: Attempt a quiz (all question types) Given I entered the quiz activity "Quiz 2" on course "Course 1" as "student1" in the app When I press "Attempt quiz now" in the app diff --git a/src/testing/services/behat-dom.ts b/src/testing/services/behat-dom.ts index a7fb274f1a4..296fe394609 100644 --- a/src/testing/services/behat-dom.ts +++ b/src/testing/services/behat-dom.ts @@ -424,11 +424,18 @@ export class TestingBehatDomUtilsService { * @returns Field element. */ findField(field: string): HTMLElement | HTMLInputElement | undefined { - const input = this.findElementBasedOnText( - { text: field, selector: 'input, textarea, [contenteditable="true"], ion-select, ion-datetime-button, ion-datetime' }, + const selector = + 'input, textarea, core-rich-text-editor, [contenteditable="true"], ion-select, ion-datetime-button, ion-datetime'; + + let input = this.findElementBasedOnText( + { text: field, selector }, { onlyClickable: false, containerName: '' }, ); + if (input?.tagName === 'CORE-RICH-TEXT-EDITOR') { + input = input.querySelector('[contenteditable="true"]') || undefined; + } + if (input) { return input; }