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