MOBILE-4239 core: Enable DB logging when needed
parent
5f9b4c5218
commit
6515d03f7d
|
@ -19,6 +19,7 @@
|
||||||
require_once(__DIR__ . '/../../../../lib/behat/behat_base.php');
|
require_once(__DIR__ . '/../../../../lib/behat/behat_base.php');
|
||||||
require_once(__DIR__ . '/behat_app_helper.php');
|
require_once(__DIR__ . '/behat_app_helper.php');
|
||||||
|
|
||||||
|
use Behat\Behat\Hook\Scope\ScenarioScope;
|
||||||
use Behat\Gherkin\Node\TableNode;
|
use Behat\Gherkin\Node\TableNode;
|
||||||
use Behat\Mink\Exception\DriverException;
|
use Behat\Mink\Exception\DriverException;
|
||||||
use Behat\Mink\Exception\ExpectationException;
|
use Behat\Mink\Exception\ExpectationException;
|
||||||
|
@ -45,6 +46,27 @@ class behat_app extends behat_app_helper {
|
||||||
|
|
||||||
protected $windowsize = '360x720';
|
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.
|
* Opens the Moodle App in the browser and optionally logs in.
|
||||||
*
|
*
|
||||||
|
|
|
@ -18,7 +18,6 @@ import { SQLiteDB } from '@classes/sqlitedb';
|
||||||
import { SQLiteDBMock } from '@features/emulator/classes/sqlitedb';
|
import { SQLiteDBMock } from '@features/emulator/classes/sqlitedb';
|
||||||
import { CoreBrowser } from '@singletons/browser';
|
import { CoreBrowser } from '@singletons/browser';
|
||||||
import { makeSingleton, SQLite } from '@singletons';
|
import { makeSingleton, SQLite } from '@singletons';
|
||||||
import { CoreAppProvider } from './app';
|
|
||||||
import { CorePlatform } from '@services/platform';
|
import { CorePlatform } from '@services/platform';
|
||||||
|
|
||||||
const tableNameRegex = new RegExp([
|
const tableNameRegex = new RegExp([
|
||||||
|
@ -47,7 +46,7 @@ export class CoreDbProvider {
|
||||||
* @returns Whether queries should be logged.
|
* @returns Whether queries should be logged.
|
||||||
*/
|
*/
|
||||||
loggingEnabled(): boolean {
|
loggingEnabled(): boolean {
|
||||||
return CoreBrowser.hasDevelopmentSetting('DBLoggingEnabled') || CoreAppProvider.isAutomated();
|
return CoreBrowser.hasDevelopmentSetting('DBLoggingEnabled');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue