Tests
This commit is contained in:
parent
be43cbb5c7
commit
a73d066274
|
|
@ -1,5 +1,6 @@
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
|
import 'dart:math';
|
||||||
import 'package:invoiceninja_flutter/.env.dart';
|
import 'package:invoiceninja_flutter/.env.dart';
|
||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
@ -423,7 +424,9 @@ Middleware<AppState> _createAccountLoaded() {
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
for (int i = 0; i < response.userCompanies.length; i++) {
|
for (int i = 0;
|
||||||
|
i < min(response.userCompanies.length, kMaxNumberOfCompanies);
|
||||||
|
i++) {
|
||||||
final UserCompanyEntity userCompany = response.userCompanies[i];
|
final UserCompanyEntity userCompany = response.userCompanies[i];
|
||||||
|
|
||||||
if (i == 0) {
|
if (i == 0) {
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ import 'package:material_design_icons_flutter/material_design_icons_flutter.dart
|
||||||
|
|
||||||
class DecoratedFormField extends StatelessWidget {
|
class DecoratedFormField extends StatelessWidget {
|
||||||
const DecoratedFormField({
|
const DecoratedFormField({
|
||||||
this.formKey,
|
Key key,
|
||||||
this.controller,
|
this.controller,
|
||||||
this.label,
|
this.label,
|
||||||
this.onSavePressed,
|
this.onSavePressed,
|
||||||
|
|
@ -36,9 +36,8 @@ class DecoratedFormField extends StatelessWidget {
|
||||||
this.isPercent = false,
|
this.isPercent = false,
|
||||||
this.showClear = true,
|
this.showClear = true,
|
||||||
this.inputFormatters,
|
this.inputFormatters,
|
||||||
});
|
}) : super(key: key);
|
||||||
|
|
||||||
final Key formKey;
|
|
||||||
final TextEditingController controller;
|
final TextEditingController controller;
|
||||||
final String label;
|
final String label;
|
||||||
final String hint;
|
final String hint;
|
||||||
|
|
@ -119,7 +118,7 @@ class DecoratedFormField extends StatelessWidget {
|
||||||
}
|
}
|
||||||
|
|
||||||
return TextFormField(
|
return TextFormField(
|
||||||
key: formKey ?? ValueKey(label),
|
key: ValueKey(label), // Enables tests to find fields
|
||||||
focusNode: focusNode,
|
focusNode: focusNode,
|
||||||
controller: controller,
|
controller: controller,
|
||||||
autofocus: autofocus,
|
autofocus: autofocus,
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ class GrowableFormField extends StatefulWidget {
|
||||||
this.initialValue,
|
this.initialValue,
|
||||||
this.onChanged,
|
this.onChanged,
|
||||||
this.keyboardType,
|
this.keyboardType,
|
||||||
});
|
}) : super(key: key);
|
||||||
|
|
||||||
final String initialValue;
|
final String initialValue;
|
||||||
final ValueChanged<String> onChanged;
|
final ValueChanged<String> onChanged;
|
||||||
|
|
@ -45,7 +45,6 @@ class _GrowableFormFieldState extends State<GrowableFormField> {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return DecoratedFormField(
|
return DecoratedFormField(
|
||||||
formKey: widget.key,
|
|
||||||
focusNode: _focusNode,
|
focusNode: _focusNode,
|
||||||
initialValue: widget.initialValue,
|
initialValue: widget.initialValue,
|
||||||
onChanged: widget.onChanged,
|
onChanged: widget.onChanged,
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ class _PasswordFormFieldState extends State<PasswordFormField> {
|
||||||
final localization = AppLocalization.of(context);
|
final localization = AppLocalization.of(context);
|
||||||
|
|
||||||
return DecoratedFormField(
|
return DecoratedFormField(
|
||||||
formKey: ValueKey(widget.labelText ?? localization.password),
|
key: ValueKey(widget.labelText ?? localization.password),
|
||||||
controller: widget.controller,
|
controller: widget.controller,
|
||||||
onSavePressed: widget.onSavePressed,
|
onSavePressed: widget.onSavePressed,
|
||||||
autocorrect: false,
|
autocorrect: false,
|
||||||
|
|
|
||||||
|
|
@ -131,7 +131,7 @@ class ClientEditDetailsState extends State<ClientEditDetails> {
|
||||||
FormCard(
|
FormCard(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
DecoratedFormField(
|
DecoratedFormField(
|
||||||
formKey: ValueKey(localization.name),
|
key: ValueKey(localization.name),
|
||||||
autofocus: true,
|
autofocus: true,
|
||||||
controller: _nameController,
|
controller: _nameController,
|
||||||
validator: (String val) => !viewModel.client.hasNameSet
|
validator: (String val) => !viewModel.client.hasNameSet
|
||||||
|
|
|
||||||
|
|
@ -215,7 +215,7 @@ class ExpenseEditSettingsState extends State<ExpenseEditSettings> {
|
||||||
_setCurrency(currency),
|
_setCurrency(currency),
|
||||||
),
|
),
|
||||||
DecoratedFormField(
|
DecoratedFormField(
|
||||||
formKey: ValueKey('__${expense.invoiceCurrencyId}__'),
|
key: ValueKey('__${expense.invoiceCurrencyId}__'),
|
||||||
controller: _exchangeRateController,
|
controller: _exchangeRateController,
|
||||||
keyboardType:
|
keyboardType:
|
||||||
TextInputType.numberWithOptions(decimal: true),
|
TextInputType.numberWithOptions(decimal: true),
|
||||||
|
|
|
||||||
|
|
@ -633,7 +633,7 @@ class InvoiceEditDesktopState extends State<InvoiceEditDesktop>
|
||||||
children: [
|
children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
child: DecoratedFormField(
|
child: DecoratedFormField(
|
||||||
formKey: ValueKey(
|
key: ValueKey(
|
||||||
'__exchange_rate_${invoice.clientId}__'),
|
'__exchange_rate_${invoice.clientId}__'),
|
||||||
label: localization.exchangeRate,
|
label: localization.exchangeRate,
|
||||||
initialValue: formatNumber(
|
initialValue: formatNumber(
|
||||||
|
|
|
||||||
|
|
@ -389,7 +389,7 @@ class InvoiceEditDetailsState extends State<InvoiceEditDetails> {
|
||||||
.onChanged(invoice.rebuild((b) => b..designId = value?.id)),
|
.onChanged(invoice.rebuild((b) => b..designId = value?.id)),
|
||||||
),
|
),
|
||||||
DecoratedFormField(
|
DecoratedFormField(
|
||||||
formKey: ValueKey('__exchange_rate_${invoice.clientId}__'),
|
key: ValueKey('__exchange_rate_${invoice.clientId}__'),
|
||||||
label: localization.exchangeRate,
|
label: localization.exchangeRate,
|
||||||
initialValue: formatNumber(invoice.exchangeRate, context,
|
initialValue: formatNumber(invoice.exchangeRate, context,
|
||||||
formatNumberType: FormatNumberType.inputAmount),
|
formatNumberType: FormatNumberType.inputAmount),
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@ class InvoiceEditItemsDesktop extends StatefulWidget {
|
||||||
class _InvoiceEditItemsDesktopState extends State<InvoiceEditItemsDesktop> {
|
class _InvoiceEditItemsDesktopState extends State<InvoiceEditItemsDesktop> {
|
||||||
final _debouncer = Debouncer();
|
final _debouncer = Debouncer();
|
||||||
int _updatedAt;
|
int _updatedAt;
|
||||||
|
|
||||||
void _updateTable() {
|
void _updateTable() {
|
||||||
setState(() {
|
setState(() {
|
||||||
_updatedAt = DateTime.now().millisecondsSinceEpoch;
|
_updatedAt = DateTime.now().millisecondsSinceEpoch;
|
||||||
|
|
@ -517,7 +517,7 @@ class _InvoiceEditItemsDesktopState extends State<InvoiceEditItemsDesktop> {
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.only(right: kTableColumnGap),
|
padding: const EdgeInsets.only(right: kTableColumnGap),
|
||||||
child: DecoratedFormField(
|
child: DecoratedFormField(
|
||||||
formKey: ValueKey('__line_item_${index}_cost__'),
|
key: ValueKey('__line_item_${index}_cost__'),
|
||||||
textAlign: TextAlign.right,
|
textAlign: TextAlign.right,
|
||||||
initialValue: formatNumber(
|
initialValue: formatNumber(
|
||||||
lineItems[index].cost, context,
|
lineItems[index].cost, context,
|
||||||
|
|
@ -536,7 +536,7 @@ class _InvoiceEditItemsDesktopState extends State<InvoiceEditItemsDesktop> {
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.only(right: kTableColumnGap),
|
padding: const EdgeInsets.only(right: kTableColumnGap),
|
||||||
child: DecoratedFormField(
|
child: DecoratedFormField(
|
||||||
formKey: ValueKey('__line_item_${index}_quantity__'),
|
key: ValueKey('__line_item_${index}_quantity__'),
|
||||||
textAlign: TextAlign.right,
|
textAlign: TextAlign.right,
|
||||||
initialValue: formatNumber(
|
initialValue: formatNumber(
|
||||||
lineItems[index].quantity, context,
|
lineItems[index].quantity, context,
|
||||||
|
|
@ -555,7 +555,7 @@ class _InvoiceEditItemsDesktopState extends State<InvoiceEditItemsDesktop> {
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.only(right: kTableColumnGap),
|
padding: const EdgeInsets.only(right: kTableColumnGap),
|
||||||
child: DecoratedFormField(
|
child: DecoratedFormField(
|
||||||
formKey: ValueKey('__line_item_${index}_discount__'),
|
key: ValueKey('__line_item_${index}_discount__'),
|
||||||
textAlign: TextAlign.right,
|
textAlign: TextAlign.right,
|
||||||
initialValue: formatNumber(
|
initialValue: formatNumber(
|
||||||
lineItems[index].discount, context,
|
lineItems[index].discount, context,
|
||||||
|
|
|
||||||
|
|
@ -206,7 +206,7 @@ class _FileImportState extends State<_FileImport> {
|
||||||
|
|
||||||
final field = DecoratedFormField(
|
final field = DecoratedFormField(
|
||||||
enabled: false,
|
enabled: false,
|
||||||
formKey: ValueKey(uploadPart.key +
|
key: ValueKey(uploadPart.key +
|
||||||
(multipartFile != null ? multipartFile.filename : '')),
|
(multipartFile != null ? multipartFile.filename : '')),
|
||||||
label: localization.lookup(uploadPart.value),
|
label: localization.lookup(uploadPart.value),
|
||||||
initialValue: !_multipartFiles.containsKey(uploadPart.key)
|
initialValue: !_multipartFiles.containsKey(uploadPart.key)
|
||||||
|
|
|
||||||
|
|
@ -220,7 +220,7 @@ class _TaskEditDesktopState extends State<TaskEditDesktop> {
|
||||||
isMoney: false,
|
isMoney: false,
|
||||||
),
|
),
|
||||||
DecoratedFormField(
|
DecoratedFormField(
|
||||||
formKey: ValueKey('__rate__'),
|
key: ValueKey('__rate__'),
|
||||||
controller: _rateController,
|
controller: _rateController,
|
||||||
label: rateLabel,
|
label: rateLabel,
|
||||||
keyboardType: TextInputType.numberWithOptions(
|
keyboardType: TextInputType.numberWithOptions(
|
||||||
|
|
|
||||||
|
|
@ -171,7 +171,7 @@ class _TaskEditDetailsState extends State<TaskEditDetails> {
|
||||||
autocorrect: false,
|
autocorrect: false,
|
||||||
),
|
),
|
||||||
DecoratedFormField(
|
DecoratedFormField(
|
||||||
formKey: ValueKey('__rate__'),
|
key: ValueKey('__rate__'),
|
||||||
controller: _rateController,
|
controller: _rateController,
|
||||||
label: rateLabel,
|
label: rateLabel,
|
||||||
keyboardType:
|
keyboardType:
|
||||||
|
|
|
||||||
|
|
@ -128,7 +128,7 @@ class VendorEditDetailsState extends State<VendorEditDetails> {
|
||||||
FormCard(
|
FormCard(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
DecoratedFormField(
|
DecoratedFormField(
|
||||||
formKey: ValueKey(localization.name),
|
key: ValueKey(localization.name),
|
||||||
autofocus: true,
|
autofocus: true,
|
||||||
controller: _nameController,
|
controller: _nameController,
|
||||||
validator: (String val) => val == null || val.isEmpty
|
validator: (String val) => val == null || val.isEmpty
|
||||||
|
|
|
||||||
|
|
@ -70,8 +70,8 @@ dependency_overrides:
|
||||||
intl: ^0.17.0-nullsafety.2
|
intl: ^0.17.0-nullsafety.2
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
#flutter_driver: # TODO Re-enable
|
flutter_driver:
|
||||||
# sdk: flutter
|
sdk: flutter
|
||||||
test: ^1.6.3
|
test: ^1.6.3
|
||||||
#flutter_test:
|
#flutter_test:
|
||||||
# sdk: flutter
|
# sdk: flutter
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
|
import 'login_it_test.dart' as login;
|
||||||
import 'clients_it_test.dart' as clients;
|
import 'clients_it_test.dart' as clients;
|
||||||
import 'invoices_it_test.dart' as invoices;
|
import 'invoices_it_test.dart' as invoices;
|
||||||
import 'login_it_test.dart' as login;
|
|
||||||
import 'products_it_test.dart' as products;
|
import 'products_it_test.dart' as products;
|
||||||
import 'quotes_it_test.dart' as quotes;
|
import 'quotes_it_test.dart' as quotes;
|
||||||
import 'vendors_it_test.dart' as vendors;
|
import 'vendors_it_test.dart' as vendors;
|
||||||
|
|
@ -8,8 +8,8 @@ import 'vendors_it_test.dart' as vendors;
|
||||||
void main() {
|
void main() {
|
||||||
login.main();
|
login.main();
|
||||||
//products.runTestSuite(batchMode: true);
|
//products.runTestSuite(batchMode: true);
|
||||||
clients.runTestSuite(batchMode: true);
|
//clients.runTestSuite(batchMode: true);
|
||||||
//invoices.runTestSuite(batchMode: true);
|
//invoices.runTestSuite(batchMode: true);
|
||||||
//quotes.runTestSuite(batchMode: true);
|
//quotes.runTestSuite(batchMode: true);
|
||||||
vendors.runTestSuite(batchMode: true);
|
//vendors.runTestSuite(batchMode: true);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,6 @@ void main() {
|
||||||
// 'Resuming isolate: ${isolateRef.numberAsString}:${isolateRef.name}');
|
// 'Resuming isolate: ${isolateRef.numberAsString}:${isolateRef.name}');
|
||||||
// isolateRef.resume();
|
// isolateRef.resume();
|
||||||
//});
|
//});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
tearDownAll(() async {
|
tearDownAll(() async {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue