Tests
This commit is contained in:
parent
78757dc38e
commit
768984a442
|
|
@ -2,6 +2,7 @@ import 'package:invoiceninja_flutter/constants.dart';
|
|||
import 'package:invoiceninja_flutter/data/models/client_model.dart';
|
||||
import 'package:invoiceninja_flutter/redux/client/client_selectors.dart';
|
||||
import 'package:invoiceninja_flutter/ui/app/forms/custom_field.dart';
|
||||
import 'package:invoiceninja_flutter/ui/app/forms/decorated_form_field.dart';
|
||||
import 'package:invoiceninja_flutter/ui/app/invoice/tax_rate_dropdown.dart';
|
||||
import 'package:invoiceninja_flutter/utils/formatting.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
|
@ -154,14 +155,11 @@ class InvoiceEditDetailsState extends State<InvoiceEditDetails> {
|
|||
viewModel.onAddClientPressed(context, completer);
|
||||
},
|
||||
)
|
||||
: TextFormField(
|
||||
autocorrect: false,
|
||||
: DecoratedFormField(
|
||||
controller: _invoiceNumberController,
|
||||
decoration: InputDecoration(
|
||||
labelText: widget.isQuote
|
||||
label: widget.isQuote
|
||||
? localization.quoteNumber
|
||||
: localization.invoiceNumber,
|
||||
),
|
||||
validator: (String val) => val.trim().isEmpty
|
||||
? AppLocalization.of(context).pleaseEnterAnInvoiceNumber
|
||||
: null,
|
||||
|
|
@ -188,11 +186,9 @@ class InvoiceEditDetailsState extends State<InvoiceEditDetails> {
|
|||
viewModel.onChanged(invoice.rebuild((b) => b..dueDate = date));
|
||||
},
|
||||
),
|
||||
TextFormField(
|
||||
DecoratedFormField(
|
||||
label: localization.partialDeposit,
|
||||
controller: _partialController,
|
||||
decoration: InputDecoration(
|
||||
labelText: localization.partialDeposit,
|
||||
),
|
||||
keyboardType: TextInputType.numberWithOptions(decimal: true),
|
||||
),
|
||||
invoice.partial != null && invoice.partial > 0
|
||||
|
|
@ -205,22 +201,17 @@ class InvoiceEditDetailsState extends State<InvoiceEditDetails> {
|
|||
},
|
||||
)
|
||||
: Container(),
|
||||
TextFormField(
|
||||
autocorrect: false,
|
||||
DecoratedFormField(
|
||||
label: localization.poNumber,
|
||||
controller: _poNumberController,
|
||||
decoration: InputDecoration(
|
||||
labelText: localization.poNumber,
|
||||
),
|
||||
),
|
||||
Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: TextFormField(
|
||||
child: DecoratedFormField(
|
||||
label: localization.discount,
|
||||
controller: _discountController,
|
||||
decoration: InputDecoration(
|
||||
labelText: localization.discount,
|
||||
),
|
||||
keyboardType:
|
||||
TextInputType.numberWithOptions(decimal: true),
|
||||
),
|
||||
|
|
@ -269,23 +260,19 @@ class InvoiceEditDetailsState extends State<InvoiceEditDetails> {
|
|||
options: company.getCustomFieldValues(CustomFieldType.invoice2),
|
||||
),
|
||||
company.getCustomFieldLabel(CustomFieldType.surcharge1).isNotEmpty
|
||||
? TextFormField(
|
||||
? DecoratedFormField(
|
||||
label:
|
||||
company.getCustomFieldLabel(CustomFieldType.surcharge1),
|
||||
controller: _surcharge1Controller,
|
||||
decoration: InputDecoration(
|
||||
labelText: company
|
||||
.getCustomFieldLabel(CustomFieldType.surcharge1),
|
||||
),
|
||||
keyboardType:
|
||||
TextInputType.numberWithOptions(decimal: true),
|
||||
)
|
||||
: Container(),
|
||||
company.getCustomFieldLabel(CustomFieldType.surcharge2).isNotEmpty
|
||||
? TextFormField(
|
||||
? DecoratedFormField(
|
||||
controller: _surcharge2Controller,
|
||||
decoration: InputDecoration(
|
||||
labelText: company
|
||||
.getCustomFieldLabel(CustomFieldType.surcharge2),
|
||||
),
|
||||
label:
|
||||
company.getCustomFieldLabel(CustomFieldType.surcharge2),
|
||||
keyboardType:
|
||||
TextInputType.numberWithOptions(decimal: true),
|
||||
)
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ void main() {
|
|||
print('Tap edit');
|
||||
await driver.tap(find.text(localization.edit));
|
||||
|
||||
await fillAndSaveForm(driver, <String, dynamic>{
|
||||
await fillAndSaveForm(driver, <String, String>{
|
||||
localization.name: updatedName,
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -10,7 +10,11 @@ void main() {
|
|||
FlutterDriver driver;
|
||||
|
||||
final clientName = makeUnique(faker.company.name());
|
||||
final updatedClientName = makeUnique(faker.company.name());
|
||||
final poNumber =
|
||||
faker.randomGenerator.integer(999999, min: 100000).toString();
|
||||
|
||||
final updatedPoNumber =
|
||||
faker.randomGenerator.integer(999999, min: 100000).toString();
|
||||
|
||||
setUpAll(() async {
|
||||
localization = TestLocalization('en');
|
||||
|
|
@ -40,8 +44,7 @@ void main() {
|
|||
await driver.tap(find.text(localization.save));
|
||||
|
||||
print('Check for error');
|
||||
await driver
|
||||
.waitFor(find.text(localization.pleaseSelectAClient));
|
||||
await driver.waitFor(find.text(localization.pleaseSelectAClient));
|
||||
|
||||
if (await isMobile(driver)) {
|
||||
print('Click back');
|
||||
|
|
@ -62,10 +65,18 @@ void main() {
|
|||
await driver.tap(find.byValueKey(localization.client));
|
||||
await driver.tap(find.byTooltip(localization.createNew));
|
||||
|
||||
await driver.tap(find.byValueKey(localization.name));
|
||||
await driver.enterText(clientName);
|
||||
await fillTextField(
|
||||
driver: driver, field: localization.name, value: clientName);
|
||||
|
||||
await driver.tap(find.text(localization.save));
|
||||
|
||||
await fillAndSaveForm(driver, <String, String>{
|
||||
localization.poNumber: poNumber,
|
||||
});
|
||||
|
||||
await fillTextField(
|
||||
driver: driver, field: localization.poNumber, value: poNumber);
|
||||
|
||||
await driver.tap(find.text(localization.save));
|
||||
|
||||
if (await isMobile(driver)) {
|
||||
|
|
@ -88,11 +99,9 @@ void main() {
|
|||
print('Tap edit');
|
||||
await driver.tap(find.text(localization.edit));
|
||||
|
||||
/*
|
||||
await fillAndSaveForm(driver, <String, dynamic>{
|
||||
localization.name: updatedClientName,
|
||||
await fillAndSaveForm(driver, <String, String>{
|
||||
localization.poNumber: updatedPoNumber,
|
||||
});
|
||||
*/
|
||||
});
|
||||
|
||||
// Archive the edited invoice
|
||||
|
|
|
|||
Loading…
Reference in New Issue