MOBILE-4061 survey: Import and fix legacy tests from moodlemobileapp

main
Pau Ferrer Ocaña 2022-06-09 14:54:04 +02:00
parent e337bc64d5
commit af7e8115a5
5 changed files with 407 additions and 26 deletions

View File

@ -50,14 +50,12 @@
<!-- Subquestion -->
<ng-container *ngIf="question.parent !== 0">
<ion-radio-group [(ngModel)]="answers[question.name]" [required]="question.required" [name]="question.name">
<ion-row *ngIf="question.parent !== 0" class="ion-align-items-center ion-padding-horizontal" [class.even]="isEven">
<ion-row class="ion-align-items-center ion-padding-horizontal" [class.even]="isEven">
<ion-col size="7">
<ion-label id="addon-mod_survey-{{question.id}}">
<span [core-mark-required]="question.required">
<span id="addon-mod_survey-{{question.name}}" [core-mark-required]="question.required">
<strong>{{question.num}}.</strong> {{ question.text }}
</span>
</ion-label>
</ion-col>
<!-- Tablet view: radio buttons -->
@ -69,8 +67,8 @@
</ion-col>
<ion-col class="ion-hide-md-up" size="5">
<ion-select class="ion-padding" [(ngModel)]="answers[question.name]" [required]="question.required"
[attr.aria-labelledby]="'addon-mod_survey-'+question.id" interface="action-sheet" [name]="question.name"
[interfaceOptions]="{header: question.text}">
[attr.aria-labelledby]="'addon-mod_survey-'+question.name" interface="action-sheet"
[name]="question.name" [interfaceOptions]="{header: question.text}">
<ion-select-option value="-1" selected disabled>{{ 'core.choose' | translate }}</ion-select-option>
<ion-select-option *ngFor="let option of question.optionsArray; let value=index;" [value]="value +1">
{{option}}
@ -85,17 +83,18 @@
<ng-container *ngIf="(!question.multiArray || question.multiArray.length == 0) && question.parent === 0">
<ion-row class="ion-align-items-center ion-padding" *ngIf="question.type > 0" [class.even]="isEven">
<ion-col size="7">
<ion-label id="addon-mod_survey-{{question.id}}">
<span [core-mark-required]="question.required">
<span id="addon-mod_survey-{{question.name}}" [core-mark-required]="question.required">
<strong>{{question.num}}.</strong> {{ question.text }}
</span>
</ion-label>
</ion-col>
<ion-col size="5">
<ion-select class="ion-padding" [(ngModel)]="answers[question.name]" [required]="question.required"
[attr.aria-labelledby]="'addon-mod_survey-'+question.id" interface="action-sheet" [name]="question.name"
[attr.aria-labelledby]="'addon-mod_survey-'+question.name" interface="action-sheet" [name]="question.name"
[interfaceOptions]="{header: question.text}">
<ion-select-option *ngFor="let option of question.optionsArray; let value=index;" [value]="value">
<ion-select-option [value]="question.required ? '-1' : '0'" selected [disabled]="question.required">
{{ 'core.choose' | translate }}
</ion-select-option>
<ion-select-option *ngFor="let option of question.optionsArray; let value=index;" [value]="value +1">
{{option}}
</ion-select-option>
</ion-select>
@ -103,13 +102,13 @@
</ion-row>
<ion-item *ngIf="question.type === 0" class="ion-text-wrap" [class.even]="isEven">
<ion-label position="floating" id="addon-mod_survey-{{question.id}}">
<ion-label position="floating" id="addon-mod_survey-{{question.name}}">
<span [core-mark-required]="question.required">
<strong>{{question.num}}.</strong> {{ question.text }}
</span>
</ion-label>
<ion-textarea [(ngModel)]="answers[question.name]" [name]="question.name"
[attr.aria-labelledby]="'addon-mod_survey-'+question.id" [required]="question.required">
[attr.aria-labelledby]="'addon-mod_survey-'+question.name" [required]="question.required">
</ion-textarea>
</ion-item>
</ng-container>

View File

@ -68,7 +68,6 @@ export class AddonModSurveyHelperProvider {
formatQuestions(questions: AddonModSurveyQuestion[]): AddonModSurveyQuestionFormatted[] {
const strIPreferThat = Translate.instant('addon.mod_survey.ipreferthat');
const strIFoundThat = Translate.instant('addon.mod_survey.ifoundthat');
const strChoose = Translate.instant('core.choose');
const formatted: AddonModSurveyQuestionFormatted[] = [];
const parents = this.getParentQuestions(questions);
@ -112,9 +111,6 @@ export class AddonModSurveyHelperProvider {
// It's a single question.
q1.name = 'q' + q1.id;
q1.num = num++;
if (q1.type > 0) { // Add "choose" option since this question is not required.
q1.optionsArray.unshift(strChoose);
}
}
formatted.push(q1);

View File

@ -0,0 +1,386 @@
@mod @mod_survey @app @javascript
Feature: Test basic usage of survey activity in app
In order to participate in surveys while using the mobile app
As a student
I need basic survey functionality to work
Background:
Given the following "courses" exist:
| fullname | shortname |
| Course 1 | C1 |
And the following "users" exist:
| username |
| student1 |
| teacher1 |
And the following "course enrolments" exist:
| user | course | role |
| student1 | C1 | student |
| teacher1 | C1 | editingteacher |
And the following "activities" exist:
| activity | name | intro | course | idnumber | groupmode |
| survey | Test survey name | Test survey | C1 | survey | 0 |
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
And I press "Choose" near "1. In evaluating what someone says, I focus on the quality of their argument, not on the person who's presenting it." in the app
And I press "Strongly agree" in the app
And I press "Choose" near "2. I like playing devil's advocate - arguing the opposite of what someone is saying." in the app
And I press "Strongly disagree" in the app
And I press "Choose" near "3. I like to understand where other people are 'coming from', what experiences have led them to feel the way they do." in the app
And I press "Somewhat agree" in the app
And I press "Choose" near "4. The most important part of my education has been learning to understand people who are very different to me." in the app
And I press "Somewhat disagree" in the app
And I press "Choose" near "5. I feel that the best way for me to achieve my own identity is to interact with a variety of other people." in the app
And I press "Somewhat agree" near "Neither agree nor disagree" in the app
And I press "Choose" near "6. I enjoy hearing the opinions of people who come from backgrounds different to mine - it helps me to understand how the same things can be seen in such different ways." in the app
And I press "Somewhat agree" near "Neither agree nor disagree" in the app
And I press "Choose" near "7. I find that I can strengthen my own position through arguing with someone who disagrees with me." in the app
And I press "Somewhat agree" near "Neither agree nor disagree" in the app
And I press "Choose" near "8. I am always interested in knowing why people say and believe the things they do." in the app
And I press "Somewhat agree" near "Neither agree nor disagree" in the app
And I press "Choose" near "9. I often find myself arguing with the authors of books that I read, trying to logically figure out why they're wrong." in the app
And I press "Somewhat agree" near "Neither agree nor disagree" in the app
And I press "Choose" near "10. It's important for me to remain as objective as possible when I analyze something." in the app
And I press "Somewhat agree" near "Neither agree nor disagree" in the app
And I press "Choose" near "11. I try to think with people instead of against them." in the app
And I press "Somewhat agree" near "Neither agree nor disagree" in the app
And I press "Choose" near "12. I have certain criteria I use in evaluating arguments." in the app
And I press "Somewhat agree" near "Neither agree nor disagree" in the app
And I press "Choose" near "13. I'm more likely to try to understand someone else's opinion than to try to evaluate it." in the app
And I press "Somewhat agree" near "Neither agree nor disagree" in the app
And I press "Choose" near "14. I try to point out weaknesses in other people's thinking to help them clarify their arguments." in the app
And I press "Somewhat agree" near "Neither agree nor disagree" in the app
And I press "Choose" near "15. I tend to put myself in other people's shoes when discussing controversial issues, to see why they think the way they do." in the app
And I press "Somewhat agree" near "Neither agree nor disagree" in the app
And I press "Choose" near "16. One could call my way of analysing things 'putting them on trial' because I am careful to consider all the evidence." in the app
And I press "Somewhat agree" near "Neither agree nor disagree" in the app
And I press "Choose" near "17. I value the use of logic and reason over the incorporation of my own concerns when solving problems." in the app
And I press "Somewhat agree" near "Neither agree nor disagree" in the app
And I press "Choose" near "18. I can obtain insight into opinions that differ from mine through empathy." in the app
And I press "Somewhat agree" near "Neither agree nor disagree" in the app
And I press "Choose" near "19. When I encounter people whose opinions seem alien to me, I make a deliberate effort to 'extend' myself into that person, to try to see how they could have those opinions." in the app
And I press "Somewhat agree" near "Neither agree nor disagree" in the app
And I press "Choose" near "20. I spend time figuring out what's 'wrong' with things. For example, I'll look for something in a literary interpretation that isn't argued well enough." in the app
And I press "Somewhat agree" near "Neither agree nor disagree" in the app
And I press "Submit" in the app
And I press "OK" in the app
And I press "Results" in the app
And I press "OK" in the app
And I switch to the browser tab opened by the app
And I log in as "student1"
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"
Scenario: Answer a survey & View results (Critical incidents)
Given the following "activities" exist:
| activity | name | intro | template |course | idnumber | groupmode |
| survey | Test survey critical incidents | Test survey1 | 5 | C1 | survey1 | 0 |
Given I entered the survey activity "Test survey critical incidents" on course "Course 1" as "student1" in the app
And I set the field "At what moment in class were you most engaged as a learner?" to "1st answer" in the app
And I set the field "At what moment in class were you most distanced as a learner?" to "2nd answer" in the app
And I set the field "What action from anyone in the forums did you find most affirming or helpful?" to "3rd answer" in the app
And I set the field "What action from anyone in the forums did you find most puzzling or confusing?" to "4th answer" in the app
And I set the field "What event surprised you most?" to "5th answer" in the app
And I press "Submit" in the app
And I press "OK" in the app
Then I should see "Results"
When I press "Results" in the app
And I press "OK" in the app
And I switch to the browser tab opened by the app
And I log in as "student1"
Then I should see "Test survey critical incidents"
And I should see "1st answer"
And I should see "2nd answer"
And I should see "3rd answer"
And I should see "4th answer"
And I should see "5th answer"
Scenario: Answer a survey & View results (Colles actual)
Given the following "activities" exist:
| activity | name | intro | template |course | idnumber | groupmode |
| survey | Test survey Colles (actual) | Test survey1 | 1 | C1 | survey1 | 0 |
Given I entered the survey activity "Test survey Colles (actual)" on course "Course 1" as "student1" in the app
And I press "Choose" near "1. my learning focuses on issues that interest me." in the app
And I press "Sometimes" in the app
And I press "Choose" near "2. what I learn is important for my professional practice." in the app
And I press "Sometimes" in the app
And I press "Choose" near "3. I learn how to improve my professional practice." in the app
And I press "Sometimes" in the app
And I press "Choose" near "4. what I learn connects well with my professional practice." in the app
And I press "Sometimes" in the app
And I press "Choose" near "5. I think critically about how I learn." in the app
And I press "Sometimes" in the app
And I press "Choose" near "6. I think critically about my own ideas." in the app
And I press "Sometimes" in the app
And I press "Choose" near "7. I think critically about other students' ideas." in the app
And I press "Sometimes" in the app
And I press "Choose" near "8. I think critically about ideas in the readings." in the app
And I press "Sometimes" in the app
And I press "Choose" near "9. I explain my ideas to other students." in the app
And I press "Sometimes" in the app
And I press "Choose" near "10. I ask other students to explain their ideas." in the app
And I press "Sometimes" in the app
And I press "Choose" near "11. other students ask me to explain my ideas." in the app
And I press "Sometimes" in the app
And I press "Choose" near "12. other students respond to my ideas." in the app
And I press "Sometimes" in the app
And I press "Choose" near "13. the tutor stimulates my thinking." in the app
And I press "Sometimes" in the app
And I press "Choose" near "14. the tutor encourages me to participate." in the app
And I press "Sometimes" in the app
And I press "Choose" near "15. the tutor models good discourse." in the app
And I press "Sometimes" in the app
And I press "Choose" near "16. the tutor models critical self-reflection." in the app
And I press "Sometimes" in the app
And I press "Choose" near "17. other students encourage my participation." in the app
And I press "Sometimes" in the app
And I press "Choose" near "18. other students praise my contribution." in the app
And I press "Sometimes" in the app
And I press "Choose" near "19. other students value my contribution." in the app
And I press "Sometimes" in the app
And I press "Choose" near "20. other students empathise with my struggle to learn." in the app
And I press "Sometimes" in the app
And I press "Choose" near "21. I make good sense of other students' messages." in the app
And I press "Sometimes" in the app
And I press "Choose" near "22. other students make good sense of my messages." in the app
And I press "Sometimes" in the app
And I press "Choose" near "23. I make good sense of the tutor's messages." in the app
And I press "Sometimes" in the app
And I press "Choose" near "24. the tutor makes good sense of my messages." in the app
And I press "Sometimes" in the app
And I press "Choose" near "25. How long did this survey take you to complete?" in the app
And I press "under 1 min" in the app
And I press "Submit" in the app
And I press "OK" in the app
Then I should see "You have completed this survey"
When I press "Results" in the app
And I press "OK" in the app
And I switch to the browser tab opened by the app
And I log in as "student1"
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"
Scenario: Answer a survey & View results (Colles preferred)
Given the following "activities" exist:
| activity | name | intro | template | course | idnumber | groupmode |
| survey | Test survey Colles (preferred) | Test survey1 | 2 | C1 | survey1 | 0 |
Given I entered the survey activity "Test survey Colles (preferred)" on course "Course 1" as "student1" in the app
And I press "Choose" near "1. my learning focuses on issues that interest me." in the app
And I press "Sometimes" in the app
And I press "Choose" near "2. what I learn is important for my professional practice." in the app
And I press "Sometimes" in the app
And I press "Choose" near "3. I learn how to improve my professional practice." in the app
And I press "Sometimes" in the app
And I press "Choose" near "4. what I learn connects well with my professional practice." in the app
And I press "Sometimes" in the app
And I press "Choose" near "5. I think critically about how I learn." in the app
And I press "Sometimes" in the app
And I press "Choose" near "6. I think critically about my own ideas." in the app
And I press "Sometimes" in the app
And I press "Choose" near "7. I think critically about other students' ideas." in the app
And I press "Sometimes" in the app
And I press "Choose" near "8. I think critically about ideas in the readings." in the app
And I press "Sometimes" in the app
And I press "Choose" near "9. I explain my ideas to other students." in the app
And I press "Sometimes" in the app
And I press "Choose" near "10. I ask other students to explain their ideas." in the app
And I press "Sometimes" in the app
And I press "Choose" near "11. other students ask me to explain my ideas." in the app
And I press "Sometimes" in the app
And I press "Choose" near "12. other students respond to my ideas." in the app
And I press "Sometimes" in the app
And I press "Choose" near "13. the tutor stimulates my thinking." in the app
And I press "Sometimes" in the app
And I press "Choose" near "14. the tutor encourages me to participate." in the app
And I press "Sometimes" in the app
And I press "Choose" near "15. the tutor models good discourse." in the app
And I press "Sometimes" in the app
And I press "Choose" near "16. the tutor models critical self-reflection." in the app
And I press "Sometimes" in the app
And I press "Choose" near "17. other students encourage my participation." in the app
And I press "Sometimes" in the app
And I press "Choose" near "18. other students praise my contribution." in the app
And I press "Sometimes" in the app
And I press "Choose" near "19. other students value my contribution." in the app
And I press "Sometimes" in the app
And I press "Choose" near "20. other students empathise with my struggle to learn." in the app
And I press "Sometimes" in the app
And I press "Choose" near "21. I make good sense of other students' messages." in the app
And I press "Sometimes" in the app
And I press "Choose" near "22. other students make good sense of my messages." in the app
And I press "Sometimes" in the app
And I press "Choose" near "23. I make good sense of the tutor's messages." in the app
And I press "Sometimes" in the app
And I press "Choose" near "24. the tutor makes good sense of my messages." in the app
And I press "Sometimes" in the app
And I press "Choose" near "25. How long did this survey take you to complete?" in the app
And I press "under 1 min" in the app
And I press "Submit" in the app
And I press "OK" in the app
Then I should see "You have completed this survey"
When I press "Results" in the app
And I press "OK" in the app
And I switch to the browser tab opened by the app
And I log in as "student1"
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"
Scenario: Answer a survey & View results (Colles preferred and actual)
Given the following "activities" exist:
| activity | name | intro | template | course | idnumber | groupmode |
| survey | Test survey Colles (preferred and actual) | Test survey1 | 3 | C1 | survey1 | 0 |
Given I entered the survey activity "Test survey Colles (preferred and actual)" on course "Course 1" as "student1" in the app
And I press "Choose" near "1. I prefer that my learning focuses on issues that interest me." in the app
And I press "Sometimes" in the app
And I press "Choose" near "2. I found that my learning focuses on issues that interest me." in the app
And I press "Sometimes" in the app
And I press "Choose" near "3. I prefer that what I learn is important for my professional practice." in the app
And I press "Sometimes" in the app
And I press "Choose" near "4. I found that what I learn is important for my professional practice." in the app
And I press "Sometimes" in the app
And I press "Choose" near "5. I prefer that I learn how to improve my professional practice." in the app
And I press "Sometimes" in the app
And I press "Choose" near "6. I found that I learn how to improve my professional practice." in the app
And I press "Sometimes" in the app
And I press "Choose" near "7. I prefer that what I learn connects well with my professional practice." in the app
And I press "Sometimes" in the app
And I press "Choose" near "8. I found that what I learn connects well with my professional practice." in the app
And I press "Sometimes" in the app
And I press "Choose" near "9. I prefer that I think critically about how I learn." in the app
And I press "Sometimes" in the app
And I press "Choose" near "10. I found that I think critically about how I learn." in the app
And I press "Sometimes" in the app
And I press "Choose" near "11. I prefer that I think critically about my own ideas." in the app
And I press "Sometimes" in the app
And I press "Choose" near "12. I found that I think critically about my own ideas." in the app
And I press "Sometimes" in the app
And I press "Choose" near "13. I prefer that I think critically about other students' ideas." in the app
And I press "Sometimes" in the app
And I press "Choose" near "14. I found that I think critically about other students' ideas." in the app
And I press "Sometimes" in the app
And I press "Choose" near "15. I prefer that I think critically about ideas in the readings." in the app
And I press "Sometimes" in the app
And I press "Choose" near "16. I found that I think critically about ideas in the readings." in the app
And I press "Sometimes" in the app
And I press "Choose" near "17. I prefer that I explain my ideas to other students." in the app
And I press "Sometimes" in the app
And I press "Choose" near "18. I found that I explain my ideas to other students." in the app
And I press "Sometimes" in the app
And I press "Choose" near "19. I prefer that I ask other students to explain their ideas." in the app
And I press "Sometimes" in the app
And I press "Choose" near "20. I found that I ask other students to explain their ideas." in the app
And I press "Sometimes" in the app
And I press "Choose" near "21. I prefer that other students ask me to explain my ideas." in the app
And I press "Sometimes" in the app
And I press "Choose" near "22. I found that other students ask me to explain my ideas." in the app
And I press "Sometimes" in the app
And I press "Choose" near "23. I prefer that other students respond to my ideas." in the app
And I press "Sometimes" in the app
And I press "Choose" near "24. I found that other students respond to my ideas." in the app
And I press "Sometimes" in the app
And I press "Choose" near "25. I prefer that the tutor stimulates my thinking." in the app
And I press "Sometimes" in the app
And I press "Choose" near "26. I found that the tutor stimulates my thinking." in the app
And I press "Sometimes" in the app
And I press "Choose" near "27. I prefer that the tutor encourages me to participate." in the app
And I press "Sometimes" in the app
And I press "Choose" near "28. I found that the tutor encourages me to participate." in the app
And I press "Sometimes" in the app
And I press "Choose" near "29. I prefer that the tutor models good discourse." in the app
And I press "Sometimes" in the app
And I press "Choose" near "30. I found that the tutor models good discourse." in the app
And I press "Sometimes" in the app
And I press "Choose" near "31. I prefer that the tutor models critical self-reflection." in the app
And I press "Sometimes" in the app
And I press "Choose" near "32. I found that the tutor models critical self-reflection." in the app
And I press "Sometimes" in the app
And I press "Choose" near "33. I prefer that other students encourage my participation." in the app
And I press "Sometimes" in the app
And I press "Choose" near "34. I found that other students encourage my participation." in the app
And I press "Sometimes" in the app
And I press "Choose" near "35. I prefer that other students praise my contribution." in the app
And I press "Sometimes" in the app
And I press "Choose" near "36. I found that other students praise my contribution." in the app
And I press "Sometimes" in the app
And I press "Choose" near "37. I prefer that other students value my contribution." in the app
And I press "Sometimes" in the app
And I press "Choose" near "38. I found that other students value my contribution." in the app
And I press "Sometimes" in the app
And I press "Choose" near "39. I prefer that other students empathise with my struggle to learn." in the app
And I press "Sometimes" in the app
And I press "Choose" near "40. I found that other students empathise with my struggle to learn." in the app
And I press "Sometimes" in the app
And I press "Choose" near "41. I prefer that I make good sense of other students' messages." in the app
And I press "Sometimes" in the app
And I press "Choose" near "42. I found that I make good sense of other students' messages." in the app
And I press "Sometimes" in the app
And I press "Choose" near "43. I prefer that other students make good sense of my messages." in the app
And I press "Sometimes" in the app
And I press "Choose" near "44. I found that other students make good sense of my messages." in the app
And I press "Sometimes" in the app
And I press "Choose" near "45. I prefer that I make good sense of the tutor's messages." in the app
And I press "Sometimes" in the app
And I press "Choose" near "46. I found that I make good sense of the tutor's messages." in the app
And I press "Sometimes" in the app
And I press "Choose" near "47. I prefer that the tutor makes good sense of my messages." in the app
And I press "Sometimes" in the app
And I press "Choose" near "48. I found that the tutor makes good sense of my messages." in the app
And I press "Sometimes" in the app
And I press "Choose" near "49. How long did this survey take you to complete?" in the app
And I press "1-2 min" in the app
And I press "Submit" in the app
And I press "OK" in the app
Then I should see "You have completed this survey"
When I press "Results" in the app
And I press "OK" in the app
And I switch to the browser tab opened by the app
And I log in as "student1"
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"
Scenario: Answer survey offline & Sync survey
Given the following "activities" exist:
| activity | name | intro | template | course | idnumber | groupmode |
| survey | Test survey critical incidents | Test survey1 | 5 | C1 | survey1 | 0 |
Given I entered the survey activity "Test survey critical incidents" on course "Course 1" as "student1" in the app
And I switch offline mode to "true"
And I press "Submit" in the app
And I press "OK" in the app
Then I should see "This Survey has offline data to be synchronised."
When I switch offline mode to "false"
And I press the back button in the app
And I press "Test survey critical incidents" in the app
And I press "Information" in the app
And I press "Refresh" in the app
Then I should see "Results"
And I should see "You have completed this survey."
But I should not see "This Survey has offline data to be synchronised."
Scenario: Prefetch & Auto-sync survey
Given the following "activities" exist:
| activity | name | intro | template | course | idnumber | groupmode |
| survey | Test survey critical incidents | Test survey1 | 5 | C1 | survey1 | 0 |
Given I entered the course "Course 1" as "student1" in the app
And I press "Course downloads" in the app
And I press "Download" within "Test survey critical incidents" "ion-item" in the app
And I press the back button in the app
And I switch offline mode to "true"
And I press "Test survey name" in the app
Then I should see "There was a problem connecting to the site. Please check your connection and try again."
When I press "OK" in the app
And I press the back button in the app
And I press "Test survey critical incidents" in the app
And I press "Submit" in the app
And I press "OK" in the app
Then I should see "This Survey has offline data to be synchronised."
When I switch offline mode to "false"
And I run cron tasks in the app
Then I should not see "This Survey has offline data to be synchronised."
And I should see "You have completed this survey."

View File

@ -220,7 +220,7 @@ export class TestsBehatDomUtils {
}
return Array.from(uniqueElements);
};
}
/**
* Get parent element, including Shadow DOM parents.
@ -378,7 +378,7 @@ export class TestsBehatDomUtils {
const withinElementsAncestors = this.getTopAncestors(withinElements);
if (withinElementsAncestors.length > 1) {
throw new Error('Too many matches for within text');
throw new Error('Too many matches for within text ('+withinElementsAncestors.length+')');
}
topContainer = container = withinElementsAncestors[0];
@ -396,7 +396,7 @@ export class TestsBehatDomUtils {
const nearElementsAncestors = this.getTopAncestors(nearElements);
if (nearElementsAncestors.length > 1) {
throw new Error('Too many matches for near text');
throw new Error('Too many matches for near text ('+nearElementsAncestors.length+')');
}
container = this.getParentElement(nearElementsAncestors[0]);

View File

@ -214,7 +214,7 @@ export class TestsBehatRuntime {
return 'ERROR: Could not find backdrop';
}
if (backdrops.length > 1) {
return 'ERROR: Found too many backdrops';
return 'ERROR: Found too many backdrops ('+backdrops.length+')';
}
const backdrop = backdrops[0];
backdrop.click();
@ -378,7 +378,7 @@ export class TestsBehatRuntime {
titles = titles.filter((title) => TestsBehatDomUtils.isElementVisible(title, document.body));
if (titles.length > 1) {
return 'ERROR: Too many possible titles.';
return 'ERROR: Too many possible titles ('+titles.length+').';
} else if (!titles.length) {
return 'ERROR: No title found.';
} else {