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