This commit is contained in:
Hillel Coren 2021-05-03 16:47:25 +03:00
parent 06a84d39f9
commit a32f8c8993
4 changed files with 20 additions and 16 deletions

View File

@ -559,6 +559,7 @@ class _DrawerTileState extends State<DrawerTile> {
), ),
title: Text( title: Text(
widget.title, widget.title,
key: ValueKey('menu_${widget.title}'),
style: Theme.of(context).textTheme.bodyText1.copyWith( style: Theme.of(context).textTheme.bodyText1.copyWith(
fontSize: 16, fontSize: 16,
color: textColor, color: textColor,

View File

@ -6,10 +6,10 @@ import 'quotes_it_test.dart' as quotes;
import 'vendors_it_test.dart' as vendors; 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);
} }

View File

@ -18,8 +18,8 @@ void runTestSuite({bool batchMode = false}) {
final poNumber = final poNumber =
faker.randomGenerator.integer(999999, min: 100000).toString(); faker.randomGenerator.integer(999999, min: 100000).toString();
final productKey = makeUnique(faker.food.cuisine()); final productKey = makeUnique(faker.food.cuisine());
final clientKey = faker.randomGenerator.integer(999999, min: 100000) final clientKey =
.toString(); faker.randomGenerator.integer(999999, min: 100000).toString();
final description = faker.lorem.sentences(5).toString(); final description = faker.lorem.sentences(5).toString();
final cost = final cost =
faker.randomGenerator.decimal(min: 50, scale: 10).toStringAsFixed(2); faker.randomGenerator.decimal(min: 50, scale: 10).toStringAsFixed(2);
@ -73,7 +73,7 @@ void runTestSuite({bool batchMode = false}) {
await driver.tap(find.byTooltip(localization.newInvoice)); await driver.tap(find.byTooltip(localization.newInvoice));
print('Create new client: $clientName'); print('Create new client: $clientName');
if(await isMobile(driver)) { if (await isMobile(driver)) {
await driver.tap(find.byValueKey(Keys.clientPickerEmptyKey)); await driver.tap(find.byValueKey(Keys.clientPickerEmptyKey));
} }
await driver.tap(find.byTooltip(localization.createNew)); await driver.tap(find.byTooltip(localization.createNew));
@ -91,7 +91,7 @@ void runTestSuite({bool batchMode = false}) {
await driver.waitFor(find.text(localization.newInvoice)); await driver.waitFor(find.text(localization.newInvoice));
print('Fill the invoice form'); print('Fill the invoice form');
if(await isMobile(driver)) { if (await isMobile(driver)) {
await driver.tap(find.byTooltip(localization.addItem)); await driver.tap(find.byTooltip(localization.addItem));
await driver.tap(find.byTooltip(localization.createNew)); await driver.tap(find.byTooltip(localization.createNew));
@ -106,7 +106,6 @@ void runTestSuite({bool batchMode = false}) {
await Future<dynamic>.delayed(Duration(milliseconds: 500)); await Future<dynamic>.delayed(Duration(milliseconds: 500));
await driver.tap(find.text(localization.done.toUpperCase())); await driver.tap(find.text(localization.done.toUpperCase()));
await driver.tap(find.text(localization.details)); await driver.tap(find.text(localization.details));
} else { } else {
await fillTextFields(driver, <String, String>{ await fillTextFields(driver, <String, String>{
getLineItemKey('name', 0): productKey, getLineItemKey('name', 0): productKey,
@ -160,8 +159,8 @@ void runTestSuite({bool batchMode = false}) {
await selectAction(driver, localization.enterPayment); await selectAction(driver, localization.enterPayment);
await driver.tap(find.text(localization.save)); await driver.tap(find.text(localization.save));
// "Completed" status // "Completed" status
await driver.waitFor( await driver
find.text(localization.paymentStatus4.toUpperCase())); .waitFor(find.text(localization.paymentStatus4.toUpperCase()));
if (await isMobile(driver)) { if (await isMobile(driver)) {
await driver.tap(find.pageBack()); await driver.tap(find.pageBack());

View File

@ -43,25 +43,29 @@ Future<void> login(FlutterDriver driver,
} }
*/ */
if (selfHosted) { if (selfHosted) {
print('Tap ' + localization.selfhosted.toUpperCase());
await driver.tap(find.text(localization.selfhosted.toUpperCase())); await driver.tap(find.text(localization.selfhosted.toUpperCase()));
} }
print('Fill in email/password');
await fillTextFields(driver, <String, dynamic>{ await fillTextFields(driver, <String, dynamic>{
localization.email: loginEmail, localization.email: loginEmail,
localization.password: loginPassword, localization.password: loginPassword,
}); });
if (selfHosted) { if (selfHosted) {
print('Fill in url/secret');
await fillTextFields(driver, <String, dynamic>{ await fillTextFields(driver, <String, dynamic>{
localization.url: loginUrl, localization.url: loginUrl,
'${localization.secret} (${localization.optional})': loginSecret, '${localization.secret} (${localization.optional})': loginSecret,
}); });
} }
print(localization.emailSignIn); print('Tap ' + localization.emailSignIn);
await driver.tap(find.text(localization.emailSignIn)); await driver.tap(find.text(localization.emailSignIn));
if (loginEmail.isNotEmpty) { if (loginEmail.isNotEmpty) {
print('Wait for ' + localization.overview);
await driver.waitFor(find.text(localization.overview), await driver.waitFor(find.text(localization.overview),
timeout: new Duration(seconds: 60)); timeout: new Duration(seconds: 60));
} }
@ -97,7 +101,7 @@ Future<void> viewSection({FlutterDriver driver, String name}) async {
await driver.tap(find.byTooltip(Keys.openAppDrawer)); await driver.tap(find.byTooltip(Keys.openAppDrawer));
} }
await driver.tap(find.text(name)); await driver.tap(find.byValueKey('menu_' + name));
} }
Future<void> fillTextField( Future<void> fillTextField(