259 Commits

Author SHA1 Message Date
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
Jun Pataleta
28dadc2fb9 Merge branch 'MDL-47410-master' of git://github.com/andrewnicols/moodle 2021-02-18 11:21:23 +08:00
Andrew Nicols
d6e50d14d2 Merge branch 'MDL-64554-master' of git://github.com/andrewnicols/moodle 2021-02-18 10:21:55 +08:00
Andrew Nicols
708ae8aa0f MDL-47410 behat: Perform exact match for date_time selectors 2021-02-18 09:34:45 +08:00
Marina Glancy
440073ff20 MDL-64554 user: make private files editor modal/ajax form 2021-02-17 18:06:57 +01:00
Andrew Nicols
ab024ac209 Merge branch 'MDL-47410-master' of git://github.com/mihailges/moodle 2021-02-17 09:34:22 +08:00
François Moreau
3776fbafb2 MDL-69762 core_contentbank: let users hide their content 2021-02-15 13:26:32 -05:00
Mihail Geshoski
afd1cf81b5 MDL-47410 behat: Create custom selector for the date and datetime fields
Creates a custom field selector to locate the requested date or datetime
form fields.
2021-02-11 11:49:18 +08:00
Andrew Nicols
793f131019 MDL-70734 behat: Increase the WebDriver Curl timeout 2021-01-31 18:21:41 +08:00
Andrew Nicols
bead2a1d96 MDL-66979 behat: Add a step to set a timeout factor for a test 2021-01-29 14:15:24 +08:00
Andrew Nicols
05fca85d8e MDL-66979 behat: Warn about old behat.yml file location 2021-01-23 20:43:20 +08:00
Andrew Nicols
14a267e862 MDL-66979 behat: Rename and warn on old config 2021-01-22 14:52:12 +08:00
Andrew Nicols
a9bd31810f MDL-66979 behat: Improve chromeOptions configuration
Simplify the chromeOptions configuration to improve readability.
2021-01-22 14:52:11 +08:00
Andrew Nicols
2a969d891a MDL-66979 behat: iFrames must have a name for switchTo
The W3C WebDriver protocol supports switching of contexts using a named
context, and not the class asscoiated with that context.
2021-01-22 14:52:10 +08:00
Andrew Nicols
041b75f00a MDL-66979 behat: Handle JS on elements better
This change introduces a new function to execute Javascript directly on
a node.

This should not, ordinarily, be used directly by steps, but may be
required in other parts of the Behat interaction.
2021-01-22 14:52:10 +08:00
Andrew Nicols
c96cde27ea MDL-66979 behat: Rename selenium config to webdriver
The PHP WebDriver Mink Driver does not necessarily require Selenium. It
supports Selenium 3 upwards, and can be used directly with ChromeDriver,
EdgeDriver, SafariDriver, GeckoDriver, and others.

It therefore uses a slightly different configuraitno path.
2021-01-22 14:52:09 +08:00
Andrew Nicols
50b9866e54 MDL-66979 behat: Core updates for W3C WebDriver
This commit updates core Behat features to make use of the
php-webdriver/webdriver library instead of the legacy Instaclick
library.

Most of these changes relate to use of features of WebDriver which we
are required to use directly rather than through the Mink Driver.
2021-01-22 14:52:09 +08:00