Merge pull request #66 from esarbanis/extract_localizations_for_test

Extract all i18n strings into a mixin so that it can be used in tests…
This commit is contained in:
Hillel Coren 2019-06-12 20:27:58 +03:00 committed by GitHub
commit 6c96cec2ed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 12352 additions and 12321 deletions

12331
lib/utils/i18n.dart Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,5 @@
import 'package:invoiceninja_flutter/utils/i18n.dart';
class TestLocalization extends LocaleCodeAware with LocalizationsProvider {
TestLocalization(String localeCode) : super(localeCode);
}

View File

@ -4,13 +4,18 @@ import 'package:invoiceninja_flutter/.env.dart';
import 'package:test/test.dart';
import 'package:invoiceninja_flutter/utils/keys.dart';
import 'localizations.dart';
void main() {
group('LOGIN TEST', () {
TestLocalization localization;
FlutterDriver driver;
String loginEmail, loginPassword, loginUrl, loginSecret;
setUp(() async {
localization = TestLocalization('en');
driver = await FlutterDriver.connect();
// read config file
@ -18,6 +23,7 @@ void main() {
loginPassword = Config.TEST_PASSWORD;
loginUrl = Config.TEST_URL;
loginSecret = Config.TEST_SECRET;
});
tearDown(() async {
@ -27,6 +33,7 @@ void main() {
});
test('No input provided by user test', () async {
await driver.tap(find.byValueKey(LoginKeys.loginSelfHost));
await driver.tap(find.byValueKey(LoginKeys.email));
await driver.enterText('');
@ -40,9 +47,9 @@ void main() {
await driver.tap(find.byValueKey(LoginKeys.secret));
await driver.enterText('');
await driver.tap(find.text('LOGIN'));
await driver.waitFor(find.text('Please enter your email'));
await driver.waitFor(find.text('Please enter your password'));
await driver.tap(find.text(LoginKeys.loginButton.toUpperCase()));
await driver.waitFor(find.text(localization.pleaseEnterYourEmail));
await driver.waitFor(find.text(localization.pleaseEnterYourPassword));
});
test('Details filled by user and login', () async {
@ -59,7 +66,7 @@ void main() {
await driver.tap(find.byValueKey(LoginKeys.secret));
await driver.enterText(loginSecret);
await driver.tap(find.text('LOGIN'));
await driver.tap(find.text(LoginKeys.loginButton.toUpperCase()));
await driver.waitFor(find.byType('DashboardScreen'), timeout: new Duration(seconds: 60));
});