Merge pull request #2189 from crazyserver/MOBILE-3216
MOBILE-3216 core: Check if user agent is controlled by automationmain
commit
6959940c45
|
@ -101,7 +101,9 @@ export class CoreAppProvider {
|
||||||
}, 100);
|
}, 100);
|
||||||
|
|
||||||
// Export the app provider so Behat tests can change the forceOffline flag.
|
// Export the app provider so Behat tests can change the forceOffline flag.
|
||||||
(<any> window).appProvider = this;
|
if (CoreAppProvider.isAutomated()) {
|
||||||
|
(<any> window).appProvider = this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -159,6 +161,15 @@ export class CoreAppProvider {
|
||||||
return this.appCtrl.getRootNavs()[0];
|
return this.appCtrl.getRootNavs()[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns whether the user agent is controlled by automation. I.e. Behat testing.
|
||||||
|
*
|
||||||
|
* @return {boolean} True if the user agent is controlled by automation, false otherwise.
|
||||||
|
*/
|
||||||
|
static isAutomated(): boolean {
|
||||||
|
return !!navigator.webdriver;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if the app is running in a 64 bits desktop environment (not browser).
|
* Checks if the app is running in a 64 bits desktop environment (not browser).
|
||||||
*
|
*
|
||||||
|
|
|
@ -17,6 +17,7 @@ import { TranslateService } from '@ngx-translate/core';
|
||||||
import * as moment from 'moment';
|
import * as moment from 'moment';
|
||||||
import { Globalization } from '@ionic-native/globalization';
|
import { Globalization } from '@ionic-native/globalization';
|
||||||
import { Platform, Config } from 'ionic-angular';
|
import { Platform, Config } from 'ionic-angular';
|
||||||
|
import { CoreAppProvider } from '@providers/app';
|
||||||
import { CoreConfigProvider } from './config';
|
import { CoreConfigProvider } from './config';
|
||||||
import { CoreConfigConstants } from '../configconstants';
|
import { CoreConfigConstants } from '../configconstants';
|
||||||
|
|
||||||
|
@ -39,6 +40,13 @@ export class CoreLangProvider {
|
||||||
translate.use(this.defaultLanguage);
|
translate.use(this.defaultLanguage);
|
||||||
|
|
||||||
platform.ready().then(() => {
|
platform.ready().then(() => {
|
||||||
|
if (CoreAppProvider.isAutomated()) {
|
||||||
|
// Force current language to English when Behat is running.
|
||||||
|
this.changeCurrentLanguage('en');
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this.getCurrentLanguage().then((language) => {
|
this.getCurrentLanguage().then((language) => {
|
||||||
this.changeCurrentLanguage(language);
|
this.changeCurrentLanguage(language);
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue