Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integration #3570

Merged
merged 115 commits into from
Feb 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
115 commits
Select commit Hold shift + click to select a range
730571e
MOBILE-4069 book: Add basic usage behat tests
dpalou Jan 16, 2023
ed6cce6
MOBILE-4235 h5p: Fix regex applied by dependencies
dpalou Jan 19, 2023
f6e1b2d
Merge pull request #3526 from dpalou/MOBILE-4235
NoelDeMartin Jan 19, 2023
c2753de
MOBILE-4236 assets: Add TM to Moodle Logo
crazyserver Jan 20, 2023
68a0eff
Merge pull request #3528 from crazyserver/MOBILE-4236
dpalou Jan 20, 2023
32716ee
MOBILE-4238 Siteplugins: Filter text for collapsible title
alfonso-salces Jan 23, 2023
5ff6de1
Merge pull request #3529 from alfonso-salces/MOBILE-4238
NoelDeMartin Jan 23, 2023
5ecea64
Merge pull request #3525 from dpalou/MOBILE-4069
NoelDeMartin Jan 23, 2023
250c6c1
MOBILE-4239 core: Remove cannotconnect version
NoelDeMartin Jan 17, 2023
5f9b4c5
MOBILE-4239 core: Update LMS versions
NoelDeMartin Jan 17, 2023
6515d03
MOBILE-4239 core: Enable DB logging when needed
NoelDeMartin Jan 17, 2023
18f9e90
MOBILE-4234 mod_data: Correctly handle 0 in number fields
dpalou Jan 20, 2023
6cc23c0
Merge pull request #3531 from NoelDeMartin/MOBILE-4239
dpalou Jan 24, 2023
6373010
Merge pull request #3527 from dpalou/MOBILE-4234
NoelDeMartin Jan 24, 2023
8e568b8
MOBILE-4239 release: Update readme
jleyva Jan 26, 2023
4b6926e
Merge pull request #3537 from jleyva/MOBILE-4239-readme
dpalou Jan 27, 2023
14f48f3
MOBILE-4077 ReportBuilder: Add translations
alfonso-salces Jan 31, 2023
6f869d1
MOBILE-4077 ReportBuilder: Create handler and service
alfonso-salces Jan 31, 2023
cb2d17a
MOBILE-4077 ReportBuilder: Create page and module
alfonso-salces Jan 31, 2023
7b37a90
MOBILE-4077 ReportBuilder: Create tests
alfonso-salces Jan 31, 2023
c137025
Merge pull request #3533 from alfonso-salces/MOBILE-4077
NoelDeMartin Feb 1, 2023
51420ad
MOBILE-4065 chore: Change to strict comparison in event key names
crazyserver Feb 1, 2023
15cdc01
MOBILE-4065 course: Fix course and module cards
crazyserver Feb 1, 2023
fc98bf5
MOBILE-4077 ReportBuilder: Sort reports list and update lang strings
alfonso-salces Feb 7, 2023
9a16548
MOBILE-4077 ReportBuilder: Fix routing in mainmenu
alfonso-salces Feb 7, 2023
cbbc5d0
MOBILE-4077 ReportBuilder: Add filter advice in report-summary
alfonso-salces Feb 7, 2023
7fac689
MOBILE-4065 directive: Improve ariaButtonClick directive
crazyserver Feb 7, 2023
bff59a0
MOBILE-4065 calendar: Fix calendar days focus
crazyserver Feb 1, 2023
31a275a
MOBILE-4065 forum: Fix forum focus problems
crazyserver Feb 1, 2023
e75fb34
MOBILE-4065 chore: Update Ionic minor version to 5.9.4
crazyserver Feb 2, 2023
a2788e2
MOBILE-4065 styles: Fix items with input focus styles
crazyserver Feb 2, 2023
dab503b
Merge pull request #3541 from crazyserver/MOBILE-4065
dpalou Feb 7, 2023
f11819f
MOBILE-4069 behat: Fix timeline test
dpalou Feb 6, 2023
ebb6e39
MOBILE-4069 book: Fix PTR in book index page
dpalou Feb 7, 2023
8f82618
MOBILE-4069 behat: Allow searching text split in different elements
dpalou Feb 7, 2023
de60a89
Merge pull request #3542 from alfonso-salces/MOBILE-4077
NoelDeMartin Feb 7, 2023
0732722
MOBILE-4069 behat: Test book swipe and numbering
dpalou Feb 7, 2023
1b56572
Merge pull request #3543 from dpalou/MOBILE-4069
NoelDeMartin Feb 8, 2023
8a67824
MOBILE-4239 config: Increase version to 4.1.1
dpalou Feb 8, 2023
970079c
Merge pull request #3544 from dpalou/MOBILE-4239
moodlemobile Feb 8, 2023
7341ca2
MOBILE-4166 npm: Install ogv and video.js
dpalou Jan 24, 2023
47e5158
MOBILE-4166 core: Implement CoreDirectivesRegistry and deprecate old one
dpalou Jan 25, 2023
9419db0
MOBILE-4166 core: Use VideoJS in iOS for unsupported media
dpalou Jan 27, 2023
9b011ba
MOBILE-4166 core: Fix VideoJS in books and destroy players
dpalou Jan 31, 2023
884827a
MOBILE-4166 videojs: Support fullscreen and improve types
dpalou Feb 3, 2023
2258c11
MOBILE-4166 core: Move some CoreApp functions to CorePlatform
dpalou Feb 9, 2023
138377e
Merge pull request #3538 from dpalou/MOBILE-4166
NoelDeMartin Feb 9, 2023
5adad7f
MOBILE-4132 Book: Fix single activity navigation
alfonso-salces Feb 10, 2023
77fb8f7
Merge pull request #3545 from alfonso-salces/MOBILE-4132
dpalou Feb 13, 2023
8996cef
MOBILE-4069 a11y: Remove unneeded aria-labelledby
dpalou Feb 13, 2023
c08d638
MOBILE-4065 a11y: Hide pages under user tours
NoelDeMartin Feb 14, 2023
3dd3332
MOBILE-4069 behat: Increase Docker PHP version
dpalou Feb 13, 2023
4d124fb
Merge pull request #3547 from NoelDeMartin/MOBILE-4065
crazyserver Feb 14, 2023
24cfb83
Merge pull request #3546 from dpalou/MOBILE-4069
NoelDeMartin Feb 14, 2023
230b4b6
MOBILE-4254 behat: Configure snapshot tests
NoelDeMartin Jan 30, 2023
1ccbfe9
MOBILE-4254 ci: Upload behat faildumps artifacts
NoelDeMartin Feb 14, 2023
d55157b
MOBILE-4254 behat: Test course contents UI
NoelDeMartin Feb 15, 2023
f84a0c6
Merge pull request #3549 from NoelDeMartin/MOBILE-4254
dpalou Feb 16, 2023
0b9b617
MOBILE-4065 dev: Reset site onboarding when reseting tours
crazyserver Feb 13, 2023
50773aa
MOBILE-4065 a11y: Add aria-role region to headings order
crazyserver Feb 13, 2023
38de8c2
MOBILE-4065 theme: Add separate variables for calendar events
crazyserver Feb 13, 2023
a6de01f
MOBILE-4065 a11y: Fix lots of headings
crazyserver Feb 13, 2023
87a0721
MOBILE-4251 Feedback: Avoid displaying the preview button to students
alfonso-salces Feb 15, 2023
2f8abd5
Merge pull request #3548 from alfonso-salces/MOBILE-4251
dpalou Feb 17, 2023
6b9b956
MOBILE-4249 messages: Fix context menu items duplicated
dpalou Feb 17, 2023
ffdbf39
MOBILE-4249 ui: Fix context-menu not working in some split view
dpalou Feb 17, 2023
dac5834
MOBILE-4077 ReportBuilder: Show empty box when there isn't report det…
alfonso-salces Feb 17, 2023
3781835
MOBILE-4077 ReportBuilder: Fix reports broken when receive a number
alfonso-salces Feb 17, 2023
12546f6
Merge pull request #3550 from crazyserver/MOBILE-4065
dpalou Feb 17, 2023
3ca1094
Merge pull request #3551 from alfonso-salces/MOBILE-4077
dpalou Feb 17, 2023
70c07d4
MOBILE-4077 ReportBuilder: Fix report name format
alfonso-salces Feb 20, 2023
8c93c80
Merge pull request #3553 from alfonso-salces/MOBILE-4077
NoelDeMartin Feb 20, 2023
1538649
MOBILE-4251 Feedback: Hide preview button and revert some changes
alfonso-salces Feb 21, 2023
e849b04
Merge pull request #3554 from alfonso-salces/MOBILE-4251
dpalou Feb 21, 2023
4a7fec5
Merge pull request #3552 from dpalou/MOBILE-4249
crazyserver Feb 21, 2023
e1c431b
MOBILE-2314 core: Delegate registry functionality
NoelDeMartin Feb 21, 2023
bf7e66c
MOBILE-4166 ogvjs: Fix app not starting with old WebViews
dpalou Feb 21, 2023
f56fbd9
Merge pull request #3555 from dpalou/MOBILE-4166
NoelDeMartin Feb 21, 2023
1f2e97c
MOBILE-4166 videojs: Hide full screen button for audios
dpalou Feb 21, 2023
2bacbe7
Merge pull request #3557 from dpalou/MOBILE-4166
NoelDeMartin Feb 21, 2023
2a61ff4
MOBILE-2314 docker: Fix applying patches on build
NoelDeMartin Feb 21, 2023
b4435f8
MOBILE-2314 android: Update dev:android script
NoelDeMartin Feb 13, 2023
f5fa9d1
MOBILE-2314 core: Exclude emulator from production
NoelDeMartin Feb 2, 2023
ba723dd
MOBILE-2314 core: Implement custom modals
NoelDeMartin Feb 21, 2023
bb64922
MOBILE-2314 fileuploader: Create audio-histogram
NoelDeMartin Feb 21, 2023
d91f2ed
MOBILE-2314 fileuploader: Refactor audio recording
NoelDeMartin Feb 21, 2023
4013855
MOBILE-2314 fileuploader: Lazy load modal
NoelDeMartin Feb 21, 2023
495d395
MOBILE-2314 core: Remove cordova-plugin-media
NoelDeMartin Feb 2, 2023
b0fe993
MOBILE-2314 npm: Patch event-target-shim
NoelDeMartin Feb 2, 2023
5502e11
MOBILE-2314 npm: Patch mp3-mediarecorder
NoelDeMartin Feb 2, 2023
52cfb18
MOBILE-2134 core: Clean up copyright comments
NoelDeMartin Feb 22, 2023
4cb9a66
Merge pull request #3556 from NoelDeMartin/MOBILE-2314
dpalou Feb 22, 2023
8ee614a
MOBILE-4239 mediaplugin: Lazy load videojs
NoelDeMartin Feb 22, 2023
b7db250
Merge pull request #3559 from NoelDeMartin/MOBILE-4239
dpalou Feb 23, 2023
f0aa3ee
MOBILE-4239 geolocation: Add some logging in geolocation service
dpalou Feb 23, 2023
15a9c74
Merge pull request #3561 from dpalou/MOBILE-4239
crazyserver Feb 23, 2023
6d29a97
MOBILE-2314 fileuploader: Catch errors in recorder
NoelDeMartin Feb 23, 2023
579057d
Merge pull request #3562 from NoelDeMartin/MOBILE-2314
dpalou Feb 23, 2023
5ddcd6c
MOBILE-2314 core: Fix custom modals lifecycle
NoelDeMartin Feb 23, 2023
c74a495
MOBILE-2314 fileuploader: Improve recorder styles
NoelDeMartin Feb 23, 2023
4a93fd3
MOBILE-4077 ReportBuilder: Fix number rendering error and error handling
alfonso-salces Feb 23, 2023
5824cf0
Merge pull request #3563 from alfonso-salces/MOBILE-4077
dpalou Feb 23, 2023
a1cea17
MOBILE-2314 android: Declare audio permissions
NoelDeMartin Feb 23, 2023
2cf2591
Merge pull request #3564 from NoelDeMartin/MOBILE-2314
dpalou Feb 23, 2023
249e279
MOBILE-4077 ReportBuilder: Open in browser report detail if fails
alfonso-salces Feb 24, 2023
0419f5e
MOBILE-4239 style: Fix loading border radius
crazyserver Feb 24, 2023
edf0eab
MOBILE-4077 ReportBuilder: Fix report summary redirection
alfonso-salces Feb 24, 2023
fdf9f99
Merge pull request #3566 from crazyserver/MOBILE-4239
dpalou Feb 24, 2023
e20f2c9
Merge pull request #3565 from alfonso-salces/MOBILE-4077
dpalou Feb 24, 2023
b2ad637
MOBILE-4239 behat: Disable snapshot steps
NoelDeMartin Feb 27, 2023
034db01
Merge pull request #3568 from NoelDeMartin/MOBILE-4239-behat
dpalou Feb 28, 2023
6d65680
MOBILE-4069 behat: Fix timeline test
NoelDeMartin Feb 28, 2023
c5ec2d7
MOBILE-4239 behat: Scope report tests to 4.1
NoelDeMartin Feb 28, 2023
f1ee961
MOBILE-4239 behat: Skip flaky tests in jenkins
NoelDeMartin Feb 28, 2023
9a2720a
Merge pull request #3569 from NoelDeMartin/MOBILE-4239-behat
dpalou Feb 28, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
33 changes: 30 additions & 3 deletions .github/workflows/acceptance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
env:
MOODLE_DOCKER_DB: pgsql
MOODLE_DOCKER_BROWSER: chrome
MOODLE_DOCKER_PHP_VERSION: 7.4
MOODLE_DOCKER_PHP_VERSION: '8.0'
MOODLE_BRANCH: ${{ github.event.inputs.moodle_branch || 'master' }}
MOODLE_REPOSITORY: ${{ github.event.inputs.moodle_repository || 'https://github.com/moodle/moodle' }}
BEHAT_TAGS: ${{ github.event.inputs.behat_tags || '~@performance' }}
Expand All @@ -42,6 +42,12 @@ jobs:
git clone --branch master --depth 1 https://github.com/moodlehq/moodle-docker $GITHUB_WORKSPACE/moodle-docker
- name: Install npm packages
run: npm ci --no-audit
- name: Create Behat faildumps folder
run: |
mkdir moodle/behatfaildumps
chmod 777 moodle/behatfaildumps
- name: Install Behat Snapshots plugin
run: git clone --branch main --depth 1 https://github.com/NoelDeMartin/moodle-local_behatsnapshots $GITHUB_WORKSPACE/moodle/local/behatsnapshots
- name: Generate Behat tests plugin
run: |
export MOODLE_DOCKER_WWWROOT=$GITHUB_WORKSPACE/moodle
Expand All @@ -50,12 +56,21 @@ jobs:
run: |
export MOODLE_DOCKER_WWWROOT=$GITHUB_WORKSPACE/moodle
cp $GITHUB_WORKSPACE/moodle-docker/config.docker-template.php $GITHUB_WORKSPACE/moodle/config.php
sed -i "61c\$CFG->behat_faildump_path = '/var/www/html/behatfaildumps';" $GITHUB_WORKSPACE/moodle/config.php
sed -i "61i\$CFG->behat_increasetimeout = 2;" $GITHUB_WORKSPACE/moodle/config.php
sed -i "61i\$CFG->behat_ionic_wwwroot = 'http://moodleapp';" $GITHUB_WORKSPACE/moodle/config.php
sed -i "61i\$CFG->behat_snapshots_path = '/var/www/html/local/moodleappbehat/tests/behat/snapshots';" $GITHUB_WORKSPACE/moodle/config.php
echo "define('TEST_MOD_BIGBLUEBUTTONBN_MOCK_SERVER', 'http://bbbmockserver/hash' . sha1(\$CFG->behat_wwwroot));" >> $GITHUB_WORKSPACE/moodle/config.php
$GITHUB_WORKSPACE/moodle-docker/bin/moodle-docker-compose pull
$GITHUB_WORKSPACE/moodle-docker/bin/moodle-docker-compose up -d
$GITHUB_WORKSPACE/moodle-docker/bin/moodle-docker-wait-for-db
- name: Install Imagick PHP extension
run: |
export MOODLE_DOCKER_WWWROOT=$GITHUB_WORKSPACE/moodle
./moodle-docker/bin/moodle-docker-compose exec webserver apt-get update
./moodle-docker/bin/moodle-docker-compose exec webserver apt-get install -y libmagickwand-dev --no-install-recommends
./moodle-docker/bin/moodle-docker-compose exec webserver pecl install imagick
./moodle-docker/bin/moodle-docker-compose exec webserver docker-php-ext-enable imagick
- name: Compile & launch app with Docker
run: |
docker build --build-arg build_command="npm run build:test" -t moodlehq/moodleapp:behat .
Expand All @@ -65,8 +80,20 @@ jobs:
- name: Init Behat
run: |
export MOODLE_DOCKER_WWWROOT=$GITHUB_WORKSPACE/moodle
$GITHUB_WORKSPACE/moodle-docker/bin/moodle-docker-compose exec -T webserver sh -c "php admin/tool/behat/cli/init.php --parallel=8 --optimize-runs='@app&&$BEHAT_TAGS'"
$GITHUB_WORKSPACE/moodle-docker/bin/moodle-docker-compose exec -T webserver sh -c "php admin/tool/behat/cli/init.php --parallel=8 --optimize-runs='@app&&~@local&&$BEHAT_TAGS'"
- name: Run Behat tests
run: |
export MOODLE_DOCKER_WWWROOT=$GITHUB_WORKSPACE/moodle
$GITHUB_WORKSPACE/moodle-docker/bin/moodle-docker-compose exec -T webserver sh -c "php admin/tool/behat/cli/run.php --verbose --tags='@app&&$BEHAT_TAGS' --auto-rerun=3"
$GITHUB_WORKSPACE/moodle-docker/bin/moodle-docker-compose exec -T webserver sh -c "php admin/tool/behat/cli/run.php --verbose --tags='@app&&~@local&&$BEHAT_TAGS' --auto-rerun=3"
- name: Upload Snapshot failures
uses: actions/upload-artifact@v3
if: ${{ failure() }}
with:
name: snapshot_failures
path: moodle/local/moodleappbehat/tests/behat/snapshots/failures/*
- name: Upload Behat failures
uses: actions/upload-artifact@v3
if: ${{ failure() }}
with:
name: behat_failures
path: moodle/behatfaildumps
2 changes: 1 addition & 1 deletion .github/workflows/performance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
env:
MOODLE_DOCKER_DB: pgsql
MOODLE_DOCKER_BROWSER: chrome
MOODLE_DOCKER_PHP_VERSION: 7.4
MOODLE_DOCKER_PHP_VERSION: '8.0'
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v3
Expand Down
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ WORKDIR /app
# Prepare node dependencies
RUN apt-get update && apt-get install libsecret-1-0 -y
COPY package*.json ./
COPY patches ./patches
RUN echo "unsafe-perm=true" > ./.npmrc
RUN npm ci --no-audit

# Build source
Expand Down
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ Moodle App
This is the primary repository of source code for the official mobile app for Moodle.

* [User documentation](https://docs.moodle.org/en/Moodle_app)
* [Developer documentation](http://docs.moodle.org/dev/Moodle_App)
* [Development environment setup](https://docs.moodle.org/dev/Setting_up_your_development_environment_for_the_Moodle_App)
* [Developer documentation](https://moodledev.io/general/app)
* [Development environment setup](https://moodledev.io/general/app/development/setup)
* [Bug Tracker](https://tracker.moodle.org/browse/MOBILE)
* [Release Notes](https://docs.moodle.org/dev/Moodle_App_Release_Notes)
* [Release Notes](https://moodledev.io/general/app_releases)

This project is tested with BrowserStack.

License
-------
Expand Down
7 changes: 6 additions & 1 deletion angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,19 @@
"input": "src/theme/theme.scss"
}
],
"scripts": []
"scripts": [],
"webWorkerTsConfig": "tsconfig.worker.json"
},
"configurations": {
"production": {
"fileReplacements": [
{
"replace": "src/testing/testing.module.ts",
"with": "src/testing/testing.module.prod.ts"
},
{
"replace": "src/core/features/emulator/emulator.module.ts",
"with": "src/core/features/emulator/emulator.module.prod.ts"
}
],
"optimization": {
Expand Down
12 changes: 4 additions & 8 deletions config.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='utf-8'?>
<widget android-versionCode="41001" id="com.moodle.moodlemobile" ios-CFBundleVersion="4.1.0.1" version="4.1.0" versionCode="41001" xmlns="http://www.w3.org/ns/widgets" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<widget android-versionCode="41100" id="com.moodle.moodlemobile" ios-CFBundleVersion="4.1.1.0" version="4.1.1" versionCode="41100" xmlns="http://www.w3.org/ns/widgets" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>Moodle</name>
<description>Moodle official app</description>
<author email="mobile@moodle.com" href="http://moodle.com">Moodle Mobile team</author>
Expand Down Expand Up @@ -27,7 +27,7 @@
<preference name="UIWebViewBounce" value="false" />
<preference name="DisallowOverscroll" value="true" />
<preference name="prerendered-icon" value="true" />
<preference name="AppendUserAgent" value="MoodleMobile 4.1.0 (41001)" />
<preference name="AppendUserAgent" value="MoodleMobile 4.1.1 (41100)" />
<preference name="BackupWebStorage" value="none" />
<preference name="ScrollEnabled" value="false" />
<preference name="KeyboardDisplayRequiresUserAction" value="false" />
Expand Down Expand Up @@ -196,13 +196,9 @@
<param name="android-package" value="com.adobe.phonegap.push.PushPlugin" />
</feature>
</config-file>
<config-file parent="/*" target="res/xml/config.xml">
<feature name="Media">
<param name="android-package" value="org.apache.cordova.media.AudioHandler" />
</feature>
</config-file>
<config-file parent="/*" target="AndroidManifest.xml">
<uses-feature android:name="android.hardware.bluetooth" android:required="false" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
</config-file>
<config-file parent="/*" target="AndroidManifest.xml">
<queries>
Expand Down Expand Up @@ -236,7 +232,7 @@
<true />
</edit-config>
<edit-config file="*-Info.plist" mode="merge" target="CFBundleShortVersionString">
<string>4.1.0</string>
<string>4.1.1</string>
</edit-config>
<edit-config file="*-Info.plist" mode="overwrite" target="CFBundleLocalizations">
<array>
Expand Down
2 changes: 1 addition & 1 deletion gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,5 +71,5 @@ gulp.task('watch', () => {
});

gulp.task('watch-behat', () => {
gulp.watch(['./src/**/*.feature', './local_moodleappbehat'], { interval: 500 }, gulp.parallel('behat'));
gulp.watch(['./src/**/*.feature', './src/**/*.png', './local_moodleappbehat'], { interval: 500 }, gulp.parallel('behat'));
});
38 changes: 34 additions & 4 deletions local_moodleappbehat/tests/behat/behat_app.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
require_once(__DIR__ . '/../../../../lib/behat/behat_base.php');
require_once(__DIR__ . '/behat_app_helper.php');

use Behat\Behat\Hook\Scope\ScenarioScope;
use Behat\Gherkin\Node\TableNode;
use Behat\Mink\Exception\DriverException;
use Behat\Mink\Exception\ExpectationException;
Expand All @@ -45,6 +46,27 @@ class behat_app extends behat_app_helper {

protected $windowsize = '360x720';

/**
* @BeforeScenario
*/
public function before_scenario(ScenarioScope $scope) {
if (!$scope->getFeature()->hasTag('app')) {
return;
}

global $CFG;

$performanceLogs = $CFG->behat_profiles['default']['capabilities']['extra_capabilities']['goog:loggingPrefs']['performance'] ?? null;

if ($performanceLogs !== 'ALL') {
return;
}

// Enable DB Logging only for app tests with performance logs activated.
$this->getSession()->visit($this->get_app_url() . '/assets/env.json');
$this->execute_script("document.cookie = 'MoodleAppDBLoggingEnabled=true;path=/';");
}

/**
* Opens the Moodle App in the browser and optionally logs in.
*
Expand Down Expand Up @@ -215,13 +237,21 @@ public function i_load_more_items_in_the_app(bool $not = false) {
/**
* Trigger swipe gesture.
*
* @When /^I swipe to the (left|right) in the app$/
* @When /^I swipe to the (left|right) (in (".+") )?in the app$/
* @param string $direction Swipe direction
* @param bool $hasLocator Whether a reference locator is used.
* @param string $locator Reference locator.
*/
public function i_swipe_in_the_app(string $direction) {
$method = 'swipe' . ucwords($direction);
public function i_swipe_in_the_app(string $direction, bool $hasLocator = false, string $locator = '') {
if ($hasLocator) {
$locator = $this->parse_element_locator($locator);
}

$result = $this->zone_js("swipe('$direction'" . ($hasLocator ? ", $locator" : '') . ')');

$this->zone_js("getAngularInstance('ion-content', 'CoreSwipeNavigationDirective').$method()");
if ($result !== 'OK') {
throw new DriverException('Error when swiping - ' . $result);
}

$this->wait_for_pending_js();

Expand Down
Empty file.
4 changes: 2 additions & 2 deletions moodle.config.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"app_id": "com.moodle.moodlemobile",
"appname": "Moodle Mobile",
"versioncode": 41001,
"versionname": "4.1.0",
"versioncode": 41100,
"versionname": "4.1.1",
"cache_update_frequency_usually": 420000,
"cache_update_frequency_often": 1200000,
"cache_update_frequency_sometimes": 3600000,
Expand Down
Loading