File tree Expand file tree Collapse file tree 2 files changed +23
-2
lines changed
local_moodleappbehat/tests/behat Expand file tree Collapse file tree 2 files changed +23
-2
lines changed Original file line number Diff line number Diff line change 1919require_once (__DIR__ . '/../../../../lib/behat/behat_base.php ' );
2020require_once (__DIR__ . '/behat_app_helper.php ' );
2121
22+ use Behat \Behat \Hook \Scope \ScenarioScope ;
2223use Behat \Gherkin \Node \TableNode ;
2324use Behat \Mink \Exception \DriverException ;
2425use Behat \Mink \Exception \ExpectationException ;
@@ -45,6 +46,27 @@ class behat_app extends behat_app_helper {
4546
4647 protected $ windowsize = '360x720 ' ;
4748
49+ /**
50+ * @BeforeScenario
51+ */
52+ public function before_scenario (ScenarioScope $ scope ) {
53+ if (!$ scope ->getFeature ()->hasTag ('app ' )) {
54+ return ;
55+ }
56+
57+ global $ CFG ;
58+
59+ $ performanceLogs = $ CFG ->behat_profiles ['default ' ]['capabilities ' ]['extra_capabilities ' ]['goog:loggingPrefs ' ]['performance ' ] ?? null ;
60+
61+ if ($ performanceLogs !== 'ALL ' ) {
62+ return ;
63+ }
64+
65+ // Enable DB Logging only for app tests with performance logs activated.
66+ $ this ->getSession ()->visit ($ this ->get_app_url () . '/assets/env.json ' );
67+ $ this ->execute_script ("document.cookie = 'MoodleAppDBLoggingEnabled=true;path=/'; " );
68+ }
69+
4870 /**
4971 * Opens the Moodle App in the browser and optionally logs in.
5072 *
Original file line number Diff line number Diff line change @@ -18,7 +18,6 @@ import { SQLiteDB } from '@classes/sqlitedb';
1818import { SQLiteDBMock } from '@features/emulator/classes/sqlitedb' ;
1919import { CoreBrowser } from '@singletons/browser' ;
2020import { makeSingleton , SQLite } from '@singletons' ;
21- import { CoreAppProvider } from './app' ;
2221import { CorePlatform } from '@services/platform' ;
2322
2423const tableNameRegex = new RegExp ( [
@@ -47,7 +46,7 @@ export class CoreDbProvider {
4746 * @returns Whether queries should be logged.
4847 */
4948 loggingEnabled ( ) : boolean {
50- return CoreBrowser . hasDevelopmentSetting ( 'DBLoggingEnabled' ) || CoreAppProvider . isAutomated ( ) ;
49+ return CoreBrowser . hasDevelopmentSetting ( 'DBLoggingEnabled' ) ;
5150 }
5251
5352 /**
You can’t perform that action at this time.
0 commit comments