Skip to content

Commit

Permalink
Merge branch 'MDL-57452_behat_completion_fix_master' of https://githu…
Browse files Browse the repository at this point in the history
  • Loading branch information
danpoltawski committed Jan 16, 2017
2 parents 75cb891 + 3982685 commit 7043676
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
6 changes: 4 additions & 2 deletions completion/tests/behat/behat_completion.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,13 +121,14 @@ public function completion_is_toggled_in_course($completionstatus) {
public function activity_marked_as_complete($activityname, $activitytype, $completiontype) {
if ($completiontype == "manual") {
$imgalttext = get_string("completion-alt-manual-y", 'core_completion', $activityname);
$xpathtocheck = "//input[@type='image'][contains(@alt, '$imgalttext')]";
} else {
$imgalttext = get_string("completion-alt-auto-y", 'core_completion', $activityname);
$xpathtocheck = "//img[contains(@alt, '$imgalttext')]";
}
$activityxpath = "//li[contains(concat(' ', @class, ' '), ' modtype_" . strtolower($activitytype) . " ')]";
$activityxpath .= "[descendant::*[contains(text(), '" . $activityname . "')]]";

$xpathtocheck = "//img[contains(@alt, '$imgalttext')]";
$this->execute("behat_general::should_exist_in_the",
array($xpathtocheck, "xpath_element", $activityxpath, "xpath_element")
);
Expand All @@ -142,13 +143,14 @@ public function activity_marked_as_complete($activityname, $activitytype, $compl
public function activity_marked_as_not_complete($activityname, $activitytype, $completiontype) {
if ($completiontype == "manual") {
$imgalttext = get_string("completion-alt-manual-n", 'core_completion', $activityname);
$xpathtocheck = "//input[@type='image'][contains(@alt, '$imgalttext')]";
} else {
$imgalttext = get_string("completion-alt-auto-n", 'core_completion', $activityname);
$xpathtocheck = "//img[contains(@alt, '$imgalttext')]";
}
$activityxpath = "//li[contains(concat(' ', @class, ' '), ' modtype_" . strtolower($activitytype) . " ')]";
$activityxpath .= "[descendant::*[contains(text(), '" . $activityname . "')]]";

$xpathtocheck = "//img[contains(@alt, '$imgalttext')]";
$this->execute("behat_general::should_exist_in_the",
array($xpathtocheck, "xpath_element", $activityxpath, "xpath_element")
);
Expand Down
7 changes: 4 additions & 3 deletions completion/tests/behat/enable_manual_complete_mark.feature
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,16 @@ Feature: Allow students to manually mark an activity as complete
And I set the following fields to these values:
| Enable completion tracking | Yes |
And I press "Save and display"
When I add a "Forum" to section "1" and I fill the form with:
And I add a "Forum" to section "1" and I fill the form with:
| Forum name | Test forum name |
| Description | Test forum description |
Then "Student First" user has not completed "Test forum name" activity
And "Student First" user has not completed "Test forum name" activity
And I log out
And I log in as "student1"
And I am on site homepage
And I follow "Course 1"
And I press "Mark as complete: Test forum name"
When I press "Mark as complete: Test forum name"
Then the "Test forum name" "forum" activity with "manual" completion should be marked as complete
And I log out
And I log in as "teacher1"
And I am on site homepage
Expand Down

0 comments on commit 7043676

Please sign in to comment.