Add config file for server login credentials

This commit is contained in:
Anmol Gupta 2018-06-21 17:27:00 +05:30
parent 3c4bd634fc
commit e0149b70b4
1 changed files with 13 additions and 12 deletions

View File

@ -1,18 +1,25 @@
// This is our test!
// Import Flutter Driver API // Import Flutter Driver API
import 'package:flutter_driver/flutter_driver.dart'; import 'package:flutter_driver/flutter_driver.dart';
import 'package:test/test.dart'; import 'package:test/test.dart';
import 'package:invoiceninja/utils/keys.dart'; import 'package:invoiceninja/utils/keys.dart';
// env.dart defines configuration for laravel server
import './env.dart';
void main() { void main() {
group('LOGIN TEST', () { group('LOGIN TEST', () {
FlutterDriver driver; FlutterDriver driver;
String loginEmail, loginPassword, loginUrl, loginSecret;
setUp(() async { setUp(() async {
driver = await FlutterDriver.connect(); driver = await FlutterDriver.connect();
// read config file
loginEmail = Config.LOGIN_EMAIL;
loginPassword = Config.LOGIN_PASSWORD;
loginUrl = Config.LOGIN_URL;
loginSecret = Config.LOGIN_API_SECRET;
}); });
tearDown(() async { tearDown(() async {
@ -29,23 +36,17 @@ void main() {
test('Details filled by user and login', () async { test('Details filled by user and login', () async {
// details for sever running laravel
String email = 'sanghapal.ahankare@gmail.com';
String password = '12345qazdr';
String url = 'http://192.168.1.74';
String secret = 'asdf';
await driver.tap(find.byValueKey(LoginKeys.emailKeyString), timeout: new Duration(seconds: 60)); await driver.tap(find.byValueKey(LoginKeys.emailKeyString), timeout: new Duration(seconds: 60));
await driver.enterText(email); await driver.enterText(loginEmail);
await driver.tap(find.byValueKey(LoginKeys.passwordKeyString)); await driver.tap(find.byValueKey(LoginKeys.passwordKeyString));
await driver.enterText(password); await driver.enterText(loginPassword);
await driver.tap(find.byValueKey(LoginKeys.urlKeyString)); await driver.tap(find.byValueKey(LoginKeys.urlKeyString));
await driver.enterText(url); await driver.enterText(loginUrl);
await driver.tap(find.byValueKey(LoginKeys.secretKeyString)); await driver.tap(find.byValueKey(LoginKeys.secretKeyString));
await driver.enterText(secret); await driver.enterText(loginSecret);
await driver.tap(find.text('LOGIN')); await driver.tap(find.text('LOGIN'));