From 88180295d7803a8d8680537fb90606e20bda1899 Mon Sep 17 00:00:00 2001 From: pdenert Date: Fri, 26 Jul 2024 14:23:59 +0200 Subject: [PATCH] Add native skip on macos --- .../macos/macos_app_test.dart | 25 +++++++++++++++++++ dev/e2e_app/macos/Podfile.lock | 2 +- .../PatrolIntegrationTestMacosRunner.h | 19 ++++++++------ 3 files changed, 38 insertions(+), 8 deletions(-) diff --git a/dev/e2e_app/integration_test/macos/macos_app_test.dart b/dev/e2e_app/integration_test/macos/macos_app_test.dart index 2bc1758c0..a86aa3d77 100644 --- a/dev/e2e_app/integration_test/macos/macos_app_test.dart +++ b/dev/e2e_app/integration_test/macos/macos_app_test.dart @@ -27,4 +27,29 @@ void main() { scrollDirection: AxisDirection.up, ); }); + + patrol('taps around test to skip', skip: true, ($) async { + await createApp($); + await $.waitUntilVisible($(#counterText)); + + expect($(#counterText).text, '0'); + + await $(FloatingActionButton).tap(); + + expect($(#counterText).text, '1'); + + await $(#textField).enterText('Hello, Flutter!'); + expect($('Hello, Flutter!'), findsOneWidget); + + await $('Open scrolling screen').scrollTo().tap(); + await $.waitUntilVisible($(#topText)); + + await $.scrollUntilVisible(finder: $(#bottomText)); + + await $.tap($(#backButton)); + await $.scrollUntilVisible( + finder: $(#counterText), + scrollDirection: AxisDirection.up, + ); + }); } diff --git a/dev/e2e_app/macos/Podfile.lock b/dev/e2e_app/macos/Podfile.lock index 2959bc617..365f7dbc6 100644 --- a/dev/e2e_app/macos/Podfile.lock +++ b/dev/e2e_app/macos/Podfile.lock @@ -47,7 +47,7 @@ SPEC CHECKSUMS: flutter_timezone: 6b906d1740654acb16e50b639835628fea851037 FlutterMacOS: 8f6f14fa908a6fb3fba0cd85dbd81ec4b251fb24 geolocator_apple: 72a78ae3f3e4ec0db62117bd93e34523f5011d58 - patrol: 3e21d514020dbee24b3e3383caac9e8e051292ac + patrol: 0564cee315ff6c86fb802b3647db05cc2d3d0624 PODFILE CHECKSUM: 4dcdd5fa8959bf7a21c4e3da36b083ff9ad52d38 diff --git a/packages/patrol/darwin/Classes/PatrolIntegrationTestMacosRunner.h b/packages/patrol/darwin/Classes/PatrolIntegrationTestMacosRunner.h index 6b69a138b..ae29197a7 100644 --- a/packages/patrol/darwin/Classes/PatrolIntegrationTestMacosRunner.h +++ b/packages/patrol/darwin/Classes/PatrolIntegrationTestMacosRunner.h @@ -43,8 +43,8 @@ \ NSLog(@"listDartTests"); \ \ - __block NSArray *dartTests = NULL; \ - [appServiceClient listDartTestsWithCompletion:^(NSArray *_Nullable tests, NSError *_Nullable err) { \ +__block NSArray *dartTests = NULL; \ + [appServiceClient listDartTestsWithCompletion:^(NSArray *_Nullable tests, NSError *_Nullable err) { \ if (err != NULL) { \ NSLog(@"listDartTests(): failed, err: %@", err); \ } \ @@ -71,15 +71,20 @@ * Step 2. Create invocations to the generated methods and return them \ */ \ \ - for (NSString * dartTest in dartTests) { \ + for (NSDictionary * dartTest in dartTests) { \ /* Step 1 - dynamically create test cases */ \ + NSString * dartTestName = dartTest[@"name"]; \ + BOOL skip = [dartTest[@"skip"] boolValue]; \ \ IMP implementation = imp_implementationWithBlock(^(id _self) { \ [[[XCUIApplication alloc] init] launch]; \ + if (skip) { \ + XCTSkip(@"Skip that test \"%@\"", dartTestName); \ + } \ \ __block ObjCRunDartTestResponse *response = NULL; \ __block NSError *error; \ - [appServiceClient runDartTestWithName:dartTest \ + [appServiceClient runDartTestWithName:dartTestName \ completion:^(ObjCRunDartTestResponse *_Nullable r, NSError *_Nullable err) { \ NSString *status; \ if (err != NULL) { \ @@ -89,7 +94,7 @@ response = r; \ status = response.passed ? @"PASSED" : @"FAILED"; \ } \ - NSLog(@"runDartTest(\"%@\"): call finished, test result: %@", dartTest, status); \ + NSLog(@"runDartTest(\"%@\"): call finished, test result: %@", dartTestName, status); \ }]; \ \ /* Wait until Dart test finishes (either fails or passes) or crashes */ \ @@ -100,7 +105,7 @@ NSString *details = response ? response.details : @"(no details - app likely crashed)"; \ XCTAssertTrue(passed, @"%@", details); \ }); \ - SEL selector = NSSelectorFromString(dartTest); \ + SEL selector = NSSelectorFromString(dartTestName); \ class_addMethod(self, selector, implementation, "v@:"); \ \ /* Step 2 – create invocations to the dynamically created methods */ \ @@ -108,7 +113,7 @@ NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:signature]; \ invocation.selector = selector; \ \ - NSLog(@"RunnerUITests.testInvocations(): selectorName = %@, signature: %@", dartTest, signature); \ + NSLog(@"RunnerUITests.testInvocations(): selectorName = %@, signature: %@", dartTestName, signature); \ \ [invocations addObject:invocation]; \ } \