mirror of
https://github.com/moodle/moodle.git
synced 2025-06-05 07:35:09 +02:00
MDL-65137 behat: Step "I press...the app" should be able to select image
This commit is contained in:
parent
3271c39c74
commit
2b27c49aad
36
course/tests/behat/app_course_completion.feature
Normal file
36
course/tests/behat/app_course_completion.feature
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
@core @core_course @app @javascript
|
||||||
|
Feature: Check course completion feature.
|
||||||
|
In order to track the progress of the course on mobile device
|
||||||
|
As a student
|
||||||
|
I need to be able to update the activity completion status.
|
||||||
|
|
||||||
|
Background:
|
||||||
|
Given the following "users" exist:
|
||||||
|
| username | firstname | lastname | email |
|
||||||
|
| student1 | Student | 1 | student1@example.com |
|
||||||
|
And the following "courses" exist:
|
||||||
|
| fullname | shortname | category | enablecompletion |
|
||||||
|
| Course 1 | C1 | 0 | 1 |
|
||||||
|
And the following "course enrolments" exist:
|
||||||
|
| user | course | role |
|
||||||
|
| student1 | C1 | student |
|
||||||
|
|
||||||
|
Scenario: Complete the activity manually by clicking at the completion checkbox.
|
||||||
|
Given the following "activities" exist:
|
||||||
|
| activity | name | course | idnumber | completion | completionview |
|
||||||
|
| forum | First forum | C1 | forum1 | 1 | 0 |
|
||||||
|
| forum | Second forum | C1 | forum2 | 1 | 0 |
|
||||||
|
When I enter the app
|
||||||
|
And I log in as "student1"
|
||||||
|
And I press "Course 1" near "Recently accessed courses" in the app
|
||||||
|
# Set activities as completed.
|
||||||
|
And I should see "0%"
|
||||||
|
And I press "Not completed: First forum. Select to mark as complete." in the app
|
||||||
|
And I should see "50%"
|
||||||
|
And I press "Not completed: Second forum. Select to mark as complete." in the app
|
||||||
|
And I should see "100%"
|
||||||
|
# Set activities as not completed.
|
||||||
|
And I press "Completed: First forum. Select to mark as not complete." in the app
|
||||||
|
And I should see "50%"
|
||||||
|
And I press "Completed: Second forum. Select to mark as not complete." in the app
|
||||||
|
And I should see "0%"
|
@ -239,10 +239,11 @@
|
|||||||
// Find all the Aria labels that contain this text.
|
// Find all the Aria labels that contain this text.
|
||||||
var exactLabelMatches = [];
|
var exactLabelMatches = [];
|
||||||
var anyLabelMatches = [];
|
var anyLabelMatches = [];
|
||||||
findPossibleMatches('//*[@aria-label and contains(@aria-label, "' + escapedText +
|
findPossibleMatches('//*[@aria-label and contains(@aria-label, "' + escapedText + '")]' +
|
||||||
'")]', function(match) {
|
'| //img[@alt and contains(@alt, "' + escapedText + '")]', function(match) {
|
||||||
// Add to array depending on if it's an exact or partial match.
|
// Add to array depending on if it's an exact or partial match.
|
||||||
if (match.getAttribute('aria-label').trim() === text) {
|
var attributeData = match.getAttribute('aria-label') || match.getAttribute('alt');
|
||||||
|
if (attributeData.trim() === text) {
|
||||||
exactLabelMatches.push(match);
|
exactLabelMatches.push(match);
|
||||||
} else {
|
} else {
|
||||||
anyLabelMatches.push(match);
|
anyLabelMatches.push(match);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user