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:
commit
6c96cec2ed
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,5 @@
|
|||
import 'package:invoiceninja_flutter/utils/i18n.dart';
|
||||
|
||||
class TestLocalization extends LocaleCodeAware with LocalizationsProvider {
|
||||
TestLocalization(String localeCode) : super(localeCode);
|
||||
}
|
||||
|
|
@ -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));
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in New Issue