Proyectos de Subversion Moodle

Rev

Rev 1 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 1 Rev 1441
Línea 14... Línea 14...
14
// You should have received a copy of the GNU General Public License
14
// You should have received a copy of the GNU General Public License
15
// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
15
// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
Línea 16... Línea 16...
16
 
16
 
Línea 17... Línea -...
17
// NOTE: no MOODLE_INTERNAL test here, this file may be required by behat before including /config.php.
-
 
18
 
-
 
19
use Behat\Gherkin\Node\TableNode;
17
// NOTE: no MOODLE_INTERNAL test here, this file may be required by behat before including /config.php.
Línea 20... Línea 18...
20
 
18
 
21
require_once(__DIR__ . '/../../../lib/behat/behat_deprecated_base.php');
19
require_once(__DIR__ . '/../../../lib/behat/behat_deprecated_base.php');
22
 
20
 
Línea 33... Línea 31...
33
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
31
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
34
 */
32
 */
35
class behat_grade_deprecated extends behat_deprecated_base {
33
class behat_grade_deprecated extends behat_deprecated_base {
Línea 36... Línea 34...
36
 
34
 
-
 
35
    /**
-
 
36
     * Confirm if a value is within the search widget within the gradebook.
-
 
37
     *
-
 
38
     * Examples:
-
 
39
     * - I confirm "User" in "user" search within the gradebook widget exists
-
 
40
     * - I confirm "Group" in "group" search within the gradebook widget exists
-
 
41
     * - I confirm "Grade item" in "grade" search within the gradebook widget exists
-
 
42
     *
-
 
43
     * @Given /^I confirm "(?P<needle>(?:[^"]|\\")*)" in "(?P<haystack>(?:[^"]|\\")*)" search within the gradebook widget exists$/
-
 
44
     * @param string $needle The value to search for.
-
 
45
     * @param string $haystack The type of the search widget.
-
 
46
     * @deprecated since 4.5
-
 
47
     */
-
 
48
    public function i_confirm_in_search_within_the_gradebook_widget_exists($needle, $haystack) {
-
 
49
        $this->deprecated_message('behat_general::i_confirm_in_search_combobox_exists');
-
 
50
 
-
 
51
        $this->execute("behat_general::wait_until_the_page_is_ready");
-
 
52
 
-
 
53
        // Set the default field to search and handle any special preamble.
-
 
54
        $selector = '.usersearchdropdown';
-
 
55
        if (strtolower($haystack) === 'group') {
-
 
56
            $selector = '.groupsearchdropdown';
-
 
57
            $trigger = ".groupsearchwidget";
-
 
58
            $node = $this->find("css_element", $selector);
-
 
59
            if (!$node->isVisible()) {
-
 
60
                $this->execute("behat_general::i_click_on", [$trigger, "css_element"]);
-
 
61
            }
-
 
62
        } else if (strtolower($haystack) === 'grade') {
-
 
63
            $selector = '.gradesearchdropdown';
-
 
64
            $trigger = ".gradesearchwidget";
-
 
65
            $node = $this->find("css_element", $selector);
-
 
66
            if (!$node->isVisible()) {
-
 
67
                $this->execute("behat_general::i_click_on", [$trigger, "css_element"]);
-
 
68
            }
-
 
69
        }
-
 
70
 
-
 
71
        $this->execute("behat_general::assert_element_contains_text",
-
 
72
            [$needle, $selector, "css_element"]);
-
 
73
    }
-
 
74
 
-
 
75
    /**
-
 
76
     * Confirm if a value is not within the search widget within the gradebook.
-
 
77
     *
-
 
78
     * Examples:
-
 
79
     * - I confirm "User" in "user" search within the gradebook widget does not exist
37
    /**
80
     * - I confirm "Group" in "group" search within the gradebook widget does not exist
-
 
81
     * - I confirm "Grade item" in "grade" search within the gradebook widget does not exist
-
 
82
     *
38
     * Enters a quick feedback via the gradebook for a specific grade item and user when viewing
83
     * @Given /^I confirm "(?P<needle>(?:[^"]|\\")*)" in "(?P<haystack>(?:[^"]|\\")*)" search within the gradebook widget does not exist$/
-
 
84
     * @param string $needle The value to search for.
-
 
85
     * @param string $haystack The type of the search widget.
-
 
86
     * @deprecated since 4.5
-
 
87
     */
-
 
88
    public function i_confirm_in_search_within_the_gradebook_widget_does_not_exist($needle, $haystack) {
-
 
89
        $this->deprecated_message('behat_general::i_confirm_in_search_combobox_does_not_exist');
-
 
90
 
-
 
91
        $this->execute("behat_general::wait_until_the_page_is_ready");
-
 
92
 
-
 
93
        // Set the default field to search and handle any special preamble.
-
 
94
        $selector = '.usersearchdropdown';
-
 
95
        if (strtolower($haystack) === 'group') {
-
 
96
            $selector = '.groupsearchdropdown';
-
 
97
            $trigger = ".groupsearchwidget";
-
 
98
            $node = $this->find("css_element", $selector);
-
 
99
            if (!$node->isVisible()) {
-
 
100
                $this->execute("behat_general::i_click_on", [$trigger, "css_element"]);
-
 
101
            }
-
 
102
        } else if (strtolower($haystack) === 'grade') {
-
 
103
            $selector = '.gradesearchdropdown';
-
 
104
            $trigger = ".gradesearchwidget";
-
 
105
            $node = $this->find("css_element", $selector);
-
 
106
            if (!$node->isVisible()) {
-
 
107
                $this->execute("behat_general::i_click_on", [$trigger, "css_element"]);
-
 
108
            }
-
 
109
        }
-
 
110
 
-
 
111
        $this->execute("behat_general::assert_element_not_contains_text",
-
 
112
            [$needle, $selector, "css_element"]);
-
 
113
    }
-
 
114
 
-
 
115
    /**
-
 
116
     * Clicks on an option from the specified search widget in the current gradebook page.
-
 
117
     *
-
 
118
     * Examples:
-
 
119
     * - I click on "Student" in the "user" search widget
-
 
120
     * - I click on "Group" in the "group" search widget
39
     * the 'Grader report' with editing mode turned on.
121
     * - I click on "Grade item" in the "grade" search widget
40
     *
-
 
41
     * @deprecated since 4.2 - we don't allow edit feedback on grader report anymore.
-
 
42
     * @todo MDL-77107 This will be deleted in Moodle 4.6.
122
     *
43
     * @Given /^I give the feedback "(?P<grade_number>(?:[^"]|\\")*)" to the user "(?P<username_string>(?:[^"]|\\")*)" for the grade item "(?P<grade_activity_string>(?:[^"]|\\")*)"$/
123
     * @Given /^I click on "(?P<needle>(?:[^"]|\\")*)" in the "(?P<haystack>(?:[^"]|\\")*)" search widget$/
44
     * @param string $feedback
124
     * @param string $needle The value to search for.
45
     * @param string $userfullname the user's fullname as returned by fullname()
125
     * @param string $haystack The type of the search widget.
46
     * @param string $itemname
126
     * @deprecated since 4.5
47
     */
127
     */
48
    public function i_give_the_feedback($feedback, $userfullname, $itemname) {
128
    public function i_click_on_in_search_widget(string $needle, string $haystack) {
Línea 49... Línea -...
49
        $this->deprecated_message(['behat_grade::i_give_the_feedback']);
-
 
50
 
129
        $this->deprecated_message('behat_general::i_click_on_in_search_combobox');
Línea -... Línea 130...
-
 
130
 
-
 
131
        $this->execute("behat_general::wait_until_the_page_is_ready");
-
 
132
 
-
 
133
        // Set the default field to search and handle any special preamble.
-
 
134
        $string = get_string('searchusers', 'core');
-
 
135
        $selector = '.usersearchdropdown';
-
 
136
        if (strtolower($haystack) === 'group') {
-
 
137
            $string = get_string('searchgroups', 'core');
-
 
138
            $selector = '.groupsearchdropdown';
-
 
139
            $trigger = ".groupsearchwidget";
-
 
140
            $node = $this->find("css_element", $selector);
-
 
141
            if (!$node->isVisible()) {
-
 
142
                $this->execute("behat_general::i_click_on", [$trigger, "css_element"]);
-
 
143
            }
-
 
144
        } else if (strtolower($haystack) === 'grade') {
-
 
145
            $string = get_string('searchitems', 'core');
-
 
146
            $selector = '.gradesearchdropdown';
-
 
147
            $trigger = ".gradesearchwidget";
-
 
148
            $node = $this->find("css_element", $selector);
-
 
149
            if (!$node->isVisible()) {
-
 
150
                $this->execute("behat_general::i_click_on", [$trigger, "css_element"]);
51
        $gradelabel = $userfullname . ' ' . $itemname;
151
            }
-
 
152
        }
-
 
153
 
-
 
154
        $this->execute("behat_forms::set_field_value", [$string, $needle]);
-
 
155
        $this->execute("behat_general::wait_until_exists", [$needle, "list_item"]);
-
 
156
 
-
 
157
        $this->execute('behat_general::i_click_on_in_the', [
-
 
158
            $needle, "list_item",
52
        $fieldstr = get_string('useractivityfeedback', 'gradereport_grader', $gradelabel);
159
            $selector, "css_element",
53
 
160
        ]);