486 Commits

Author SHA1 Message Date
Jun Pataleta
87e513e439 MDL-74800 core: block actions fix suggestion 2022-08-08 14:46:42 +02: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)
c21a82df58 MDL-72446 behat: Ensure that the day reset happens on enabled element
Before this change we were setting the month day to 1 unconditionally
and that was working ok for enabled by default elements.

But in a number or cases we were doing that against disabled elements
so the day reset was not happening. Now we wait for the element to
be enabled and only then proceed with the day reset.

Backed with tests using disabled form elements, so we have now
both enabled and disabled fields covered.
2022-03-31 11:29:22 +02:00
Andrew Nicols
c3404942e4 MDL-74116 behat: Fix browser instantiation for Selenium 4 2022-03-16 22:29:20 +08:00
Jake Dallimore
a745a7dfae Merge branch 'MDL-73899-master' of https://github.com/andrewnicols/moodle 2022-03-10 15:34:21 +08: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
Andrew Nicols
39588c2ee1 MDL-73899 behat: Fix coding style issues to change third-party status
This commit removes the moodle-behat-extension from the list of
third-party libraries.

In order to do this properly, all pending coding-style issues are fixed.
In addition the following niceties have also been included:
* convert long form array() syntax to short form
* alphabetically sort class imports (use)
* remove unused class imports
* correct documentation
* Normalise whitespace in concat operators
* Remove unnecessary file docblocks
2022-02-23 08:19:30 +08:00
Sara Arjona
78408e5017 Merge branch 'MDL-73883-master' of https://github.com/andrewnicols/moodle 2022-02-21 15:35:11 +01:00
Shamim Rezaie
7015cbf75f MDL-73592 phpunit: Run adhoc tasks after install 2022-02-18 02:09:49 +11:00
Andrew Nicols
0491ccb6c8 MDL-73883 behat: Display actual step during testing
Because of the way in which we check for exceptions, we always show the
following string during behat pretty output:

    behat_hooks::i_look_for_exceptions()

We can easily modify this to only show this value when the
i_look_for_exceptions() test itself fails, but otherwise to show the
actual step that is run.
2022-02-15 14:57:00 +08:00
Eloy Lafuente (stronk7)
83497580cb Merge branch 'MDL-73669-master' of https://github.com/marinaglancy/moodle 2022-02-10 16:39:06 +01:00
Marina Glancy
31751c2f32 MDL-73669 behat: allow multiple files with deprecated steps 2022-02-04 17:17:08 +01:00
Sara Arjona
bc77f8d9ea MDL-71724 lib: Set Moodle files after axe upgrade 2022-01-24 15:30:57 +01:00
Sara Arjona
e35a803476 MDL-71724 lib: Upgrade axe to 4.3.5 2022-01-24 15:30:57 +01:00
Ferran Recio
81b0bbe8cb MDL-73340 behat: add mobile and table size 2022-01-14 18:49:06 +01:00
Petr Skoda
2e95fabd95 MDL-73272 behat: move behat extension to core 2021-12-31 09:59:18 +13: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
Tim Hunt
11f8a08a0e MDL-73070 Behat: stop using no-longer-existant classes in behat_hooks 2021-11-23 10:58:49 +00:00
Paul Holden
7a7375df4d MDL-72696 behat: support inplace editable fields of type select.
If an inplace editable field is using the "select" type, we should
treat it as a select field when setting it's value during scenarios.
2021-11-08 13:09:05 +00: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
Andrew Nicols
0a0823672c MDL-72593 behat: Improve behat handling of file manager buttons
When using a try/catch for a find if the first match is not met then we
have an implicit 6 second delay waiting for the search to time out.

We can avoid this by combining the searches in a comma-separated
selection.

I have also taken the opportunity to convert the use of ->click() to the
i_click_on function which has the benefit of supporting wait for
pendingJS.
2021-09-21 15:59:46 +08:00
Andrew Nicols
e4ceff2a24 MDL-72593 behat: Load the Field node content locally for processing
The standard NodeElement functions for getAttribute, getTagName,
getParent, and friends go back to WebDriver and parse the DOM for each
request. This is insanely slow per request, and in the case of forms we
do a lot of checking to determine the field type.

This change modifies the form field detection to copy the entire node
content into a DOMDocument and parse the document locally.

This is significantly faster - in some cases where there are large
documents minutes faster.

I believe that this should be a safe change as the document fetched from
the browser is normalised to match the doctype specified.
2021-09-21 15:55:21 +08:00
Odei Alba
15c7a4bd57 MDL-46778 behat: Allow different database for behat 2021-09-02 14:56:12 +02:00
Víctor Déniz
5f0690f5db Merge branch '71992-master-fix-behat-tests-on-https' of https://github.com/DSI-Universite-Rennes2/moodle 2021-08-11 14:32:20 +01: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
Julien Boulen
8f26ad2a99 MDL-71992 behat: allow to run behat tests on a https site 2021-07-22 11:42:30 +02: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
Jake Dallimore
e5e5a06190 Merge branch 'MDL-52724-master' of git://github.com/merrill-oakland/moodle 2021-05-03 13:25:05 +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
Eric Merrill
59704c659c MDL-52724 editor_atto: Scrub atto html for invalid ol, ul, and li tags
Try to correct broken ul/ol/li tags, as they have an outsized impact
on course layout. Uses basic regex and loops to track open and closed
tags.

Also adds a deep clean option to the HTML cleaner, that runs less
frequent, more intensive cleanings. This is because normally _cleanHTML
gets called after each keystroke, which could cause problems with
large content on weak systems.

Behat changes are a fix for setting multiline strings in Atto, and
creating a multiline match step.
2021-04-08 15:20:24 -04:00
Eloy Lafuente (stronk7)
aa8c07276b MDL-71264 behat: Change date(time) element update order
This includes 2 change to the order date(time) elements are filled,
each one addressing one type of problem, where current order is
problematic and can lead to unexpected dates.

1) Changing date, when current month only has X days and target
   month has more than X days. Example, being 1 April, change
   the date to 31 May.
     This is solved by changing the order of introduction
     from current D => M => Y to Y => M => D.
2) Changing date, when target month only has X days and current
   month has more that X days. Example, being 31 March, change
   the date to 28 Feb.
     This is solved by always setting the D to 1, before the
     Y => M => D sequence commented @ 1) begins.
2021-04-06 16:25:46 +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