Skip to content

Commit

Permalink
MOBILE-3947 behat: Update findField to admit rte
Browse files Browse the repository at this point in the history
  • Loading branch information
crazyserver committed Jan 9, 2024
1 parent 835a218 commit e8e7f04
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
1 change: 0 additions & 1 deletion src/addons/mod/quiz/tests/behat/basic_usage.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 9 additions & 2 deletions src/testing/services/behat-dom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<HTMLElement>('[contenteditable="true"]') || undefined;
}

if (input) {
return input;
}
Expand Down

0 comments on commit e8e7f04

Please sign in to comment.