Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Plugins bot
moodle-plugins-snapshots
Commits
7043676e
Commit
7043676e
authored
Jan 16, 2017
by
Dan Poltawski
Browse files
Merge branch 'MDL-57452_behat_completion_fix_master' of
https://github.com/gthomas2/moodle
parents
75cb891b
3982685a
Changes
2
Hide whitespace changes
Inline
Side-by-side
completion/tests/behat/behat_completion.php
View file @
7043676e
...
...
@@ -121,13 +121,14 @@ class behat_completion extends behat_base {
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"
)
);
...
...
@@ -142,13 +143,14 @@ class behat_completion extends behat_base {
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"
)
);
...
...
completion/tests/behat/enable_manual_complete_mark.feature
View file @
7043676e
...
...
@@ -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
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment