MOBILE-3947 behat: Dispatch ionChange event after setting a field

main
Pau Ferrer Ocaña 2024-01-09 11:18:23 +01:00
parent eb704d4203
commit b523757e81
2 changed files with 10 additions and 8 deletions

View File

@ -20,7 +20,6 @@ Feature: Test basic usage of survey activity in app
| activity | name | intro | course | idnumber | groupmode | | activity | name | intro | course | idnumber | groupmode |
| survey | Test survey name | Test survey | C1 | survey | 0 | | survey | Test survey name | Test survey | C1 | survey | 0 |
@ionic7_failure
Scenario: Answer a survey & View results (ATTLS) Scenario: Answer a survey & View results (ATTLS)
Given I entered the survey activity "Test survey name" on course "Course 1" as "student1" in the app Given I entered the survey activity "Test survey name" on course "Course 1" as "student1" in the app
And I set the following fields to these values in the app: And I set the following fields to these values in the app:
@ -79,7 +78,6 @@ Feature: Test basic usage of survey activity in app
And I should see "4th answer" And I should see "4th answer"
And I should see "5th answer" And I should see "5th answer"
@ionic7_failure
Scenario: Answer a survey & View results (Colles actual) Scenario: Answer a survey & View results (Colles actual)
Given the following "activities" exist: Given the following "activities" exist:
| activity | name | intro | template |course | idnumber | groupmode | | activity | name | intro | template |course | idnumber | groupmode |
@ -122,7 +120,6 @@ Feature: Test basic usage of survey activity in app
Then I should see "You've completed this survey. The graph below shows a summary of your results compared to the class averages." Then I should see "You've completed this survey. The graph below shows a summary of your results compared to the class averages."
And I should see "1 people have completed this survey so far" And I should see "1 people have completed this survey so far"
@ionic7_failure
Scenario: Answer a survey & View results (Colles preferred) Scenario: Answer a survey & View results (Colles preferred)
Given the following "activities" exist: Given the following "activities" exist:
| activity | name | intro | template | course | idnumber | groupmode | | activity | name | intro | template | course | idnumber | groupmode |
@ -165,7 +162,6 @@ Feature: Test basic usage of survey activity in app
Then I should see "You've completed this survey. The graph below shows a summary of your results compared to the class averages." Then I should see "You've completed this survey. The graph below shows a summary of your results compared to the class averages."
And I should see "1 people have completed this survey so far" And I should see "1 people have completed this survey so far"
@ionic7_failure
Scenario: Answer a survey & View results (Colles preferred and actual) Scenario: Answer a survey & View results (Colles preferred and actual)
Given the following "activities" exist: Given the following "activities" exist:
| activity | name | intro | template | course | idnumber | groupmode | | activity | name | intro | template | course | idnumber | groupmode |

View File

@ -631,7 +631,13 @@ export class TestingBehatDomUtilsService {
// Functions to get/set value depending on field type. // Functions to get/set value depending on field type.
const setValue = (text: string) => { const setValue = (text: string) => {
if (element.tagName === 'ION-SELECT' && 'value' in element) { if (! ('value' in element)) {
element.innerHTML = text;
return;
}
if (element.tagName === 'ION-SELECT') {
value = value.trim(); value = value.trim();
const optionValue = Array.from(element.querySelectorAll('ion-select-option')) const optionValue = Array.from(element.querySelectorAll('ion-select-option'))
.find((option) => option.innerHTML.trim() === value); .find((option) => option.innerHTML.trim() === value);
@ -639,11 +645,11 @@ export class TestingBehatDomUtilsService {
if (optionValue) { if (optionValue) {
element.value = optionValue.value; element.value = optionValue.value;
} }
} else if ('value' in element) {
element.value = text;
} else { } else {
element.innerHTML = text; element.value = text;
} }
element.dispatchEvent(new Event('ionChange'));
}; };
const getValue = () => { const getValue = () => {
if ('value' in element) { if ('value' in element) {