122 Commits

Author SHA1 Message Date
Eloy Lafuente (stronk7)
b3a7c45930 MDL-72698 behat: fix problem with FF, not able to auto-scroll iframes
The "Save changes" button in the SCORM package falls out from the
viewport and that seems to be a problem for Firefox, not being able
to auto-scroll to it before clicking.

So we are just making the window 200 points taller and that
makes the button to be visible (within the viewport) and clickable.

Also, change the way we "wait" at the end of the scenario and,
instead of reloading, we re-visit one of the contents to allow
completion to be ready for final assertions.
2022-03-22 01:36:40 +01:00
Eloy Lafuente (stronk7)
2663e21be3 MDL-72698 behat: Reduce random scorm behat failures on slow envs
This just applies two "tricks" to make the test to behave better:
- Ensuring that the "wait until the page is loaded" happens in the scorm frame.
- Ensuring that the last item in the package gets some extra time
  by reloading the page completely at the end.

With them, a testing environment with a 100% of failures has become 100%
passing (25 repetitions). That should be good enough to reduce the
impact of that failure everywhere.

See the issue for more details.
2022-03-19 18:09:45 +01:00
Jake Dallimore
2a736da1ee Merge branch 'MDL-73448-master' of https://github.com/peterRd/moodle 2022-02-10 15:59:57 +08:00
Peter Dias
97fb06057b MDL-73448 scorm: Remove displayactivityname in scorm. 2022-02-10 15:23:36 +08:00
Eloy Lafuente (stronk7)
7a0d024e60 MDL-73659 phpunit: restore_date, api, rule, plugin, manager & helper
All restore_date_test, api_test, rule_test, plugin_test,
manager_test, helper_test testcase classes:

- Namespaced with component[\level2-API]
- Moved to level2-API subdirectory when required.
- Fixed incorrect use statements with leading backslash.
- Remove file phpdoc block
- Remove MOODLE_INTERNAL if not needed.
- Changed code to point to global scope when needed.
- Fix some relative paths and comments here and there.
- All them passing individually.
- Complete runs passing too.

Special mention to:

- All restore_date_test cases have been put under xxx\backup
  level 2 (valid API) namespace.
2022-02-05 00:03:32 +01:00
Eloy Lafuente (stronk7)
100bc51f1d MDL-73485 phpunit: externallib, generator and filter tescase names
All externallib_test, generator_test and filter_test classes:

- Namespaced with component[\level2-API]
- Moved to level2-API subdirectory when required.
- Fixed incorrect use statements with leading backslash.
- Changed code to point to global scope when needed.
- Fix some relative paths and comments here and there.
- All them passing individually.
- Complete runs passing too.

Special mention to tests under testing/tests:

1) The core_testing component doesn't exist.
2) But testing/tests are allowed because there is a suite pointing to it (phpunit.xml).
3) So, the only possible namespace for them is "core".
4) And to avoid problems with other core testcases (under lib/tests)
   they have been renamed to have testing_xxxx as prefix.

Finally, also modified calendar/tests/events/events_test.php because it uses
some renamed (core_calendar_externallib_testcase => \core_calendar\externallib_test)
classes.
2022-01-21 19:48:23 +01:00
Eloy Lafuente (stronk7)
0c53a3dec8 MDL-73476 phpunit: events, external and search tescase names
All events_test, external_test and search_test classes:

- Namespaced with component[\level2-API]
- Moved to level2-API subdirectory when required.
- Fixed incorrect use statements with leading backslash.
- Changed code to point to global scope when needed.
- Fix some relative paths and comments here and there.
- All them passing individually.
- Complete runs passing too.

Special mention to lib/external/tests/external_test.php:
- external is not a valid component
- hence, its only valid namespace is "core"
- also, it's testing lib/external/externallib.php
- hence, the file (and class) have been renamed to external_externallib_test.php
  (to avoid conflicts with other external_test that may exist in core)
2022-01-14 16:18:39 +01:00
Eloy Lafuente (stronk7)
511801cb46 MDL-73352 phpunit: lib_test and locallib_test testcase names
All lib_test and locallib_test classes:

- Namespaced with component (and API whenever makes sense).
- Fixed incorrect use statements with leading backslash.
- Changed code to point to global scope when needed or add new uses.
- All them passing individually.
- Complete runs passing too.

Special mention to tests under login/tests:

1) The core_login component doesn't exist.
2) But login/tests are allowed because there is a suite pointing to it (phpunit.xml).
3) So, the only possible namespace for them is "core".
4) And to avoid problems with other core testcases (under lib/tests)
   they have been renamed to have login_xxxx as prefix.
2021-12-30 16:21:42 +01:00
Eloy Lafuente (stronk7)
e4a2d9c1d4 MDL-73348 phpunit: normalize all privacy provider tests
As far as now all them have correct privacy level2 namespace:
- Move them to "privacy" subdir.
- Rename the files to "provider_test.php", this includes old
  privacy_test.php and privacy_provider_test.php files
- Rename the testcase to provider_test too (to match file name)

Also, change some relative paths and comments to point to new
locations.
2021-12-17 14:21:02 +01:00
Eloy Lafuente (stronk7)
57e6fb7ad9 MDL-73348 phpunit: privacy and privacy_provider testcase names
All privacy_test and privacy_provider_test classes:

- Namespaced with component\privacy.
- Fixed incorrect use statements with leading backslash.
- Changed code to point to global scope when needed.
- Renamed a few files to make all be privacy_test or privacy_provider_test.php
- All them passing individually.
- Complete runs passing too.
2021-12-17 14:21:02 +01:00
abgreeve
fcd4de8639 MDL-72090 navigation: Update to behat feature files for navigation.
This updates feature files to use the new steps to navigate to certain
pages.
2021-12-09 11:13:35 +08:00
Sujith Haridasan
621d0a8c72 MDL-71915 mod_scorm: Update behat tests
Update the behat tests as UI is updated for
tertiary navigation.
2021-12-06 09:27:58 +05:30
Sujith Haridasan
b98ea6f547 MDL-71915 mod_scorm: Update tertiary nav
Update the tertiary navigation for this activity.
2021-12-06 09:27:58 +05:30
Mihail Geshoski
7d821080f0 MDL-72093 navigation: Update behat tests 2021-09-14 12:02:35 +08:00
Andrew Nicols
c79d58a50b MDL-71209 behat: Fix behat for new changes
Co-authored-by: Ilya Tregubov <ilya@moodle.com>
2021-08-20 16:49:06 +02:00
Andrew Nicols
776f4bd80c MDL-72179 behat: Make use of page resolvers 2021-07-26 15:14:28 +08:00
Simey Lameze
f7155953f4 MDL-71796 mod_scorm: fix custom completion logic
AMOS BEGIN
 MOV [completiondetail:completionstatuscompletedandpassed,mod_scorm],[completiondetail:completionstatuscompletedorpassed,mod_scorm]
AMOS END
2021-07-05 17:46:31 +08:00
David Mudrák
ad30fde448 MDL-71425 lang: Fix reworded strings in tests 2021-05-04 17:45:18 +02:00
Michael Hawkins
2984de32ff MDL-71401 mod_scorm: Completion behat test fix 2021-05-04 12:19:29 +08:00
Michael Hawkins
f9c276632a MDL-71162 mod_scorm: Add behat testing for completion conditions 2021-04-29 00:41:07 +08:00
Shamim Rezaie
2ad16d8d9e MDL-70818 mod_scorm: implement activity_dates for the scorm module 2021-04-23 13:46:28 +10:00
Michael Hawkins
663b273a55 MDL-70935 mod_scorm: Custom completion implementation 2021-04-07 15:09:36 +08:00
Eloy Lafuente (stronk7)
8a14a7bd22 MDL-71036 phpunit: assertContains() now performs strict comparison
The methods assertContains() and assertNotContains() now perform
strict (type and value) comparison, pretty much like assertSame()
does.

A couple of new assertContainsEquals() and assertNotContainsEquals()
methods have been created to provide old (non-strict) behavior, pretty
much like assertEquals() do.

Apart from replacing the calls needing a relaxed comparison to those
new methods, there are also a couple of alternative, about how to
fix this, depending of every case:

- If the test is making any array_values() conversion, then it's better
  to remove that conversion and use assertArrayHasKey(), that is not
  strict.
- Sometimes if may be also possible to, simply, cast the expectation
  to the exact type coming in the array. I've not applied this technique
  to any of the cases in core.

Link: https://github.com/sebastianbergmann/phpunit/issues/3426
2021-03-11 23:04:31 +01:00
Andrew Nicols
dd8d8c7ac2 MDL-66979 scorm: Increase behat window size
On Firefox there can be some issues with ensuring that all nodes are
visible in order to click them.

This is likely an upstream geckodriver bug and not one that can be
easily addressed across all of Moodle.

In this instance the "Next" button is just outside the Visible Window,
but it is in an iFrame which is fully visible. In this situation
Firefox is unable to click the button but does not error.
2021-01-22 14:52:10 +08:00
Eloy Lafuente (stronk7)
d95c378771 MDL-67673 phpunit: Remove expectedException annotations
While this is not strictly required, because removal will
happen in PHPUnit 9.0, we are already getting rid of all
uses in core.

From release notes:https://phpunit.de/announcements/phpunit-8.html

The annotations `@expectedException`, `@expectedExceptionCode`,
`@expectedExceptionMessage`, and `@expectedExceptionMessageRegExp`
are now deprecated.
Using these annotations will trigger a deprecation warning
in PHPUnit 8 and in PHPUnit 9 these annotations will be removed.

Also, all uses of expectExceptionMessageRegExp() has been moved
to expectExceptionMessageMatches(). See https://github.com/sebastianbergmann/phpunit/issues/3957

TODO: Various weirdness found while doing the changes with these tests:
- vendor/bin/phpunit lib/tests/exporter_test.php (created MDL-69700)
- vendor/bin/phpunit competency/tests/external_test.php (same issue than prev one)
- vendor/bin/phpunit question/engine/tests/questionengine_test.php (created MDL-69624)
- vendor/bin/phpunit lib/tests/event_test.php (created MDL-69688)
2020-10-21 12:46:00 +02:00
Eloy Lafuente (stronk7)
f6711bb394 MDL-67673 phpunit: Fix the return type of template methods
All the setup/teardown/pre/post/conditions template methods
now are required to return void. This was warned with phpunit 7
and now is enforced.

At the same time, fix a few wrong function names,
provider data and param types, return statements...
2020-10-21 12:45:59 +02:00
Andrew Nicols
868a1c377d MDL-69072 mod_scorm: Stop mink reset after tests
This is now done for all scenarios. It is no longer necessary to do so
specifically for mod_scorm.
2020-06-26 21:17:23 +08:00
Andrew Nicols
7afd16ad84 MDL-66109 behat: Require newline at EOF
This change enables the gherkinlint rule to require a new line at the
end of the file. This change is in keeping with existing Moodle coding
style guidelines.
2020-05-11 11:07:49 +08:00
Sam Hemelryk
841d855993 MDL-67175 mod_scorm: sync XHR requests use sendBeacon when available
Totara reference TL-22621 (original code by Sam Hemelryk)
2add402f81
2020-02-07 08:05:14 +08:00
Juan Leyva
7a30377dc0 MDL-66554 mod_scorm: Set module viewed in WS 2019-08-29 20:45:43 +01:00
John Yao
96e444665e MDL-65517 block_timeline: Hide completed course modules in Timeline
When some activities are manually completed by students, some are still showing in students' timeline.
This commit fix that for module assign,chat,choice,feedback,lesson,quiz,scorm and workshop.
2019-07-12 09:16:40 +10:00
Andrew Nicols
17f0579797 MDL-65576 behat: Reset Selenium driver between scorm scenarios 2019-05-31 08:08:26 +08:00
Juan Leyva
b0cf7af4b7 MDL-64252 mod_scorm: New WS mod_scorm_get_scorm_access_information 2019-03-15 21:39:01 +01:00
Peter
538603b200 MDL-63148 mod_scorm: Accept userid param in event action
* Update lib scorm functions to accept and use a passed in userid
* Additional phpunit tests
2019-01-02 14:32:59 +08:00
Matteo Scaramuccia
f9df004724 MDL-63727 mod_scorm: Fixed typo in test_launch_sco() 2018-10-31 21:47:45 +01:00
Michael Hawkins
6d6e4b7a51 MDL-63501 mod_scorm: Add support for removal of context users
This issue is a part of the MDL-62560 Epic.
2018-10-22 12:48:34 +02:00
Neill Magill
196aa50489 MDL-62944 activities: Test adding activities with no calendar capability 2018-08-31 10:15:36 +01:00
Sara Arjona
1d76dd714c MDL-62449 scorm: Move related data to data in the privacy export 2018-06-18 10:42:26 +02:00
Sara Arjona
cd3ef1fbc4 MDL-62449 scorm: Add SCORM data to privacy export (name, description) 2018-06-18 10:42:26 +02:00
Sara Arjona
df7cc2cc7f MDL-61959 mod_scorm: Implement privacy API 2018-04-26 19:56:33 +02:00
Dan Marsden
fbfd69a865 MDL-32585 mod_scorm: Improve force new attempts setting.
AMOS BEGIN
 MOV [forcenewattempt,mod_scorm],[forcenewattempts,mod_scorm]
AMOS END
2018-04-10 13:38:51 +02:00
Simey Lameze
cadeb8d21c MDL-60061 mod_scorm: add unit tests for drag/drop 2017-12-12 15:15:09 +08:00
Damyon Wiese
032bda879c Merge branch 'MDL-52653-master' of http://github.com/damyon/moodle 2017-10-23 13:14:03 +08:00
Andrew Nicols
455b2c4b9f MDL-58605 mod_scorm: Simplify feature
The singlescobasic_missingorg.zip file includes a modified version of
the javascript which deliberately breaks content.

We need it to have different file names to not break other similar copies
of the file.
2017-10-23 07:56:10 +08:00
Christian Lawson-Perfect
5d1ad088ea MDL-52653 SCORM: fix scorm_check_mode on v1.3
SCORM 2004 uses the element 'cmi.completion_status' to store the
completion status of a SCO, not 'cmi.core.lesson_status'.

This amends scorm_check_mode so that the right element is looked up.

When scorm_version_check returns false, SCORM 1.2 is assumed.
2017-10-19 14:58:07 +08:00
Ankit Agarwal
0d14fcbc60 MDL-9367 restore: Roll only configuration dates
It was decided to roll only configuration dates and any date related to user content
such as 'timecreated' , 'timemodified' etc should not be rolled forward.
2017-08-01 10:46:37 +05:30
Damyon Wiese
4c8deb9cfa MDL-59032 scorm: Don't show action events to teachers 2017-06-06 15:57:23 +08:00
Marina Glancy
cd477f8c3e MDL-58665 mod_scorm: cache times in modinfo for performance 2017-05-01 16:59:04 +08:00
Jake Dallimore
8db355c58f MDL-58138 tests: unit and behat tests covering bulk and default tabs
Part of MDL-58138 epic
2017-04-19 08:56:11 +08:00
Mark Nelson
e1cd93ce20 MDL-58423 core_calendar: moved \core_calendar\event class
Part of MDL-55611 epic.
2017-04-04 11:01:49 +01:00