275 Commits

Author SHA1 Message Date
Laurent David
387371bacd MDL-77037 core_courseformat: Refresh course index
* Refresh course index when language change
2023-03-09 08:41:02 +01:00
Simey Lameze
64799f9ace MDL-76542 behat: add step to go to user edit page directly 2023-02-08 12:22:29 +08:00
Marina Glancy
b1c97381b4 MDL-76356 various: avoid implicit conversion to int
PHP before version 8.1 automatically converted to int if the function
parameter (or array key) is expected to be int. PHP 8.1 shows notice in
this case
2023-01-10 15:27:11 +01:00
Ilya Tregubov
e93d2b0cbe Merge branch 'MDL-76399' of https://github.com/paulholden/moodle 2022-12-29 09:40:51 +07:00
Mark Johnson
b05efb43a4 MDL-75105 tool_behat: List available data generators
This will find all data generators that can be used in behat via the
'the following "something" exist:' step, and display them in a select
list on the step definitions page.

When a generator is selected, it will fetch the required fields for that
generator and display them on the page.
2022-12-21 08:38:09 +00:00
Paul Holden
7d78fb0928 MDL-76399 behat: improvements to "should exist in" thrown exception. 2022-12-16 12:30:03 +00:00
Paul Holden
e2a2332cc0 MDL-76398 behat: broader action menu partial matching by element.
For action menu elements whose trigger element isn't plain text
(e.g. a pix icon), we should be able to match via the title of
that element.
2022-12-02 09:54:49 +00:00
Marina Glancy
a800e7e62f MDL-74853 various: add second parameter to htmlentities functions
Default value of the $flag argument changed in PHP 8.1 from ENT_COMPAT to ENT_QUOTES | ENT_SUBSTITUTE
To ensure consistent behavior across different PHP version the second parameter is now required for the functions:
htmlspecialchars(), htmlentities(), htmlspecialchars_decode(), html_entity_decode() and get_html_translation_table()
2022-11-28 16:12:20 +01:00
Andrew Nicols
426ea50861 MDL-76169 behat: Normalise exception message in should (not) steps
These steps have accepted a NodeElement instance as an argument for some
time, but were trying to cast it to string when formulating exception
messages, making it harder to debug and, in the case of the 'should see'
step, not work at all.

This patch introduces a new function to produce a consistent naming for
them.
2022-11-03 21:39:15 +08:00
Andrew Nicols
232ebac338 MDL-76169 behat: Add improved steps for using action menus
This commit adds new steps related to action menus to support:
* Choosing an item in a named action menu
* Choosing an item in a named action menu within a container
* Confirming that an action menu item does or does not exist in a named
  action menu
* Confirming that an action menu item does or does not exist in a named
  action menu within a container

The existing action menu steps were insufficient as they assume that
there is only one action menu within he container, which is not
necessarily the case.

The existing action menu steps are not non-JS friendly and will error if
JS is disabled, without providing any fallback when one is easily
available.

Unfortunately these steps cannot be used to replace the existing steps
without manual intervention.
2022-11-03 21:39:15 +08:00
Jun Pataleta
c76a2a05ba Merge branch 'MDL-72558' of https://github.com/NoelDeMartin/moodle 2022-10-26 13:37:45 +08:00
Noel De Martin
594a64348a MDL-72558 behat: Remove legacy mobile app code 2022-10-13 09:18:40 +02:00
Simey Lameze
baa1e52530 MDL-75887 behat: Add ability to set value regardless of the editor
Prior to this commit, the behat_form_editor integration was hard-coded
to use Atto.

This change allows other editors to be used to set editor values, and
breaks that hard bond. Following this change, any editor is able to
define a behat_editor_[name].php file defining a function which meets
the following signature:

  set_editor_value(string $editorid, string $value): void

Each editor is responsible for checking whether its own API is available
and calling any relevant functions to force the editor to set the
content.

Please note: Behat is unable to determine the current editor in use on
the page automatically.
2022-10-12 06:44:09 +08:00
Andrew Nicols
13cc3607de MDL-75886 atto: Always use Atto for @atto tests
This change, which should be easy to mimic for other editors.

This will ensure that the correct editor is used for tests relating to
that editor, or its subplugins.
2022-10-05 09:54:21 +08:00
Andrew Nicols
5412ddbf97 MDL-75559 behat: Sort behat_hooks to top of context list 2022-09-12 12:32:35 +08:00
Shamim Rezaie
5d33ef3c21 MDL-75155 behat: Add select_menu field type
This commit introduces a new partial selector for select_menu fields,
and teaching the field manager how to recognise these, then introducing
a new field type which can handle setting values for this field.
2022-09-06 13:38:28 +10:00
Shamim Rezaie
cad62440e3 Merge branch 'MDL-73876-master' of https://github.com/ilyatregubov/moodle 2022-08-17 02:32:00 +10:00
Jun Pataleta
87e513e439 MDL-74800 core: block actions fix suggestion 2022-08-08 14:46:42 +02:00
Andrew Lyons
019c633bd9 MDL-73876 behat: Show exceptions stack trace 2022-08-04 16:50:59 +04:00
Andrew Nicols
6d46332a94 Merge branch 'MDL-74613-master' of https://github.com/NoelDeMartin/moodle 2022-06-30 11:02:41 +08:00
Alfonso Salces
db7178edca MDL-74674 core: create notification generators 2022-06-29 10:31:40 +02:00
Noel De Martin
bbaf83322f MDL-74613 grade: Add missing generators 2022-05-31 17:59:52 +02:00
Eloy Lafuente (stronk7)
3a016e2784 MDL-73824 gradebook: Add support for localised floats where missing
It has been detected, thanks to php80 specially, that there are
various places in core where support for localised floats is
missing. Before php80, some locale-dependent conversions were
performed by PHP, allowing things to work. But with php80 all
those comparisons are now locale-independent. See:

https://wiki.php.net/rfc/locale_independent_float_to_string

That implies that we now need to, always, unformat floats to
be internally the correct (decimal point as separator) in
order to compare it.

While this was visited in the php80 epic (MDL-70745), nothing
was found, all automated tests were passing ok. Problem is that
we run behat tests with en-AU laguage that has the decimal point
separator.

So, in this issue we are fixing all the problems detected by
running those Behat tests using localised (comma) decimal
separator.

Note that there may be other places still causing problems, but
it's really hard to find them programmatically, so we'll have to
wait for real use reports / issues and go fixing them while they
happen.

Back to this commit, this is the list of changes performed (note that
in the next commit, we'll be adding scenarios explicitly using
a localised decimal separator to ensure that they work ok).

A. Changes to various grade forms to ensure that, on their validation
  floats are unformatted properly. Also, changed the corresponding
  form element from current text/PARAM_RAW to proper float ones that
  take care of the conversion in a number of places (but when disabled,
  that's the reason we still have to unformat in validation.
  This includes the following forms:
    - edit_category_form
    - edit_item_form
  (this is the original problem reported that cause all the research
  to be performed against full behat runs)

B. Changes to edit_letter_form, so it uses a proper PARAM_LOCALISEDFLOAT
  (note this is the type of change that surely should be used for all
  the rest of /grade/edit/tree form, including those in the previous
  point).

C. Changes to the grade_item behat generator, so it's able to work with
  localised floats, un-formatting them when needed.
  At lib/behat/classes/behat_core_generator.php

D. Fix problem passing localised floats to scales, not displaying
  properly. At grade/report/singleview/classes/local/ui/finalgrade.php

E. Change the behat text matcher in order to allow comparison of
  localised floats when they are the current ones. Before this change
  the matches was using soft/lazy comparison, so '50' and '50.0000'
  match. Now, when the comma (for example) is used (and only then),
  '50' and '50,000' will also match. This comparison is in use in a
  bunch of tests and makes sense to make it localisation-aware.
  At grade/report/singleview/classes/local/ui/finalgrade.php

F. Fix a couple of number_format() uses in lesson, because they are
  not localised-aware. Switched to format_float(). At mod/lesson/locallib.php

G. Change the quiz_contains_the_following_questions() step to accept
  localised maxmark expectations. At mod/quiz/tests/behat/behat_mod_quiz.php

H. Change the quiz generator so it accepts localised gradepass.
  At mod/quiz/tests/generator/lib.php

I. Change the edit question form to show proper localised penalties,
  previously it was always showing point-decimal ones. Of course,
  leaving the values of the select element unmodified (internal floats).
  Related, also change a couple of tests to, instead of try to match the
  value (always internal floats), match the description (now localised),
  so we can test them with different separators. At:
    - question/type/ddimageortext/tests/behat/backup_and_restore.feature
    - question/type/ddmarker/tests/behat/backup_and_restore.feature
    - question/type/edit_question_form.php
2022-03-04 10:22:49 +01:00
Shamim Rezaie
7015cbf75f MDL-73592 phpunit: Run adhoc tasks after install 2022-02-18 02:09:49 +11:00
Marina Glancy
31751c2f32 MDL-73669 behat: allow multiple files with deprecated steps 2022-02-04 17:17:08 +01:00
Ferran Recio
81b0bbe8cb MDL-73340 behat: add mobile and table size 2022-01-14 18:49:06 +01:00
Simey Lameze
eadf157068 MDL-72984 admin: make support email setting mandatory 2021-12-20 13:22:35 +08:00
Bas Brands
35a5288554 MDL-71691 core_behat: behat fixes for changed course design 2021-12-08 13:14:05 +01:00
Paul Holden
3191443f47 MDL-72987 reportbuilder: reset manager cache between Behat tests. 2021-11-03 15:31:08 +00:00
Shamim Rezaie
18fb0358f3 Merge branch 'MDL-72874-master' of git://github.com/andrewnicols/moodle 2021-10-29 03:34:19 +11:00
Andrew Nicols
2d62323d42 MDL-72874 behat: Allow behat window sizes to be modified during run
In some situations it is useful to modify the requested screensize by a
modifier. This allows for failing tests to be rerun at a different
screensize, where the original screensize triggered a failure for some
size-related reason.
2021-10-21 10:22:49 +08:00
sam marshall
8b8ef39802 MDL-72849 tool_behat: Use of xpath name() not compatible with Firefox
The xpath name() function returns upper-case e.g. 'IMG' in Firefox and
lower-case e.g. 'img' in Chrome.
2021-10-19 13:47:20 +01:00
Bas Brands
3ff1b83239 MDL-71610 core_behat: update edit mode steps 2021-09-29 09:25:36 +02:00
Odei Alba
15c7a4bd57 MDL-46778 behat: Allow different database for behat 2021-09-02 14:56:12 +02:00
Ilya Tregubov
3420278c86 MDL-72262 behat: Make alias shorter to fix Oracle failures. 2021-08-02 08:24:59 +02:00
Andrew Nicols
776f4bd80c MDL-72179 behat: Make use of page resolvers 2021-07-26 15:14:28 +08:00
Andrew Nicols
950c7adb1c MDL-72179 behat: Add page resolver for activity names 2021-07-23 20:43:48 +08:00
Andrew Nicols
730d6cb94e MDL-72179 behat: Improve core page resolvers
This commit makes the following improvements to core page resolverss:
* allows for mixed case naming (course, Course, etc.)
* allows fields other than the idnumber to be specified:
** course: idnumber, shortname, fullname
** course category: idnumber, name

Whilst some of these fields are not unique, they will typically be
unique in most test scenarios. Where they are not then the idnumber
should be used in preference.
2021-07-23 20:28:10 +08:00
Andrew Nicols
87b50a42e8 MDL-72125 behat: Add get_activity_id() behat generators helper 2021-07-16 12:33:56 +08:00
Andrew Nicols
7cd408501b MDL-72125 testing: Set a default idnumber when creating activities
The activity generator currently requires an idnumber when creating
activities, but this is not a requirement when creating the same
activity through the UI. The requirement comes because we want to
provide a way to refer to activities in subsequent steps.

This commit modifies the behaviour such that the generator uses the name
of the activity as the default idnumber.

This has two  main benefits:
1. it simplfies generation of activities; and
2. it makes the language used when writing behat tests much more natural.

With this change, steps will refer to the activity by its idnumber/title
in all cases, rather than sometimes by an idnumber which bears no
relevance to the title.
2021-07-16 12:33:56 +08:00
Eloy Lafuente (stronk7)
0139d213ac Merge branch 'MDL-71874-master' of git://github.com/andrewnicols/moodle 2021-07-13 20:38:01 +02:00
Ferran Recio
21d93554d4 MDL-71863 courseformat: create courseformat subsystem 2021-06-28 13:50:18 +02:00
Michael Hawkins
18a7f0134d MDL-56873 admin: Set sensible default cURL security settings 2021-06-10 12:01:39 +08:00
Andrew Nicols
64e7326649 MDL-71874 behat: Show warning when using add to section without js 2021-06-09 16:26:43 +08:00
Andrew Nicols
c53d6ffdbe Merge branch 'MDL-70909-master' of git://github.com/ferranrecio/moodle 2021-04-28 10:20:03 +08:00
Ferran Recio
201a37e6aa MDL-70909 behat: context freeze and not freeze steps 2021-04-22 15:50:55 +02:00
Noel De Martin
168f28fa75 MDL-71386 behat: Support for 3.9.5+ mobile app 2021-04-22 12:14:18 +02:00
Adrian Greeve
00cb88c352 Merge branch 'MDL-65974-master-iteration03' of git://github.com/ferranrecio/moodle 2021-03-15 15:16:44 +08:00
Ferran Recio
1c839f9072 MDL-65974 course: move format_base to core_course\course_format 2021-03-11 17:36:34 +01:00
sam marshall
9ddb51b07e MDL-45242 Testing: Generators for user profile fields 2021-03-08 09:20:17 +00:00