diff --git a/src/addons/mod/quiz/tests/behat/basic_usage.feature b/src/addons/mod/quiz/tests/behat/basic_usage.feature index 8d0ce09c9..d6005859d 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 a7fb274f1..babfb4222 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; } @@ -441,7 +448,17 @@ export class TestingBehatDomUtilsService { if (label) { const inputId = label.getAttribute('for'); - return (inputId && document.getElementById(inputId)) || undefined; + if (inputId) { + return document.getElementById(inputId) || undefined; + } + + input = this.getShadowDOMHost(label) || undefined; + + // Add support for other input types if required by adding them to the array. + const ionicInputFields = ['ION-INPUT', 'ION-TEXTAREA', 'ION-SELECT', 'ION-DATETIME', 'ION-TOGGLE']; + if (input && ionicInputFields.includes(input.tagName)) { + return input; + } } }