FilledStacks / testsweets

A utility package for TestSweets that allows you to generate and upload your automation keys for the TestSweets tool
26 stars 6 forks source link

Error: Too many positional arguments: 1 allowed, but 2 found. #82

Open migalv opened 6 months ago

migalv commented 6 months ago

I just finished setting up TestSweet by following the guide

But it's not letting me run the app in capture mode.

I keep getting this error:

Error (Xcode): ../../../../.pub-cache/hosted/pub.dev/testsweets-1.16.1/lib/src/ui/widget_capture/widget_capture_viewmodel.dart:287:10: Error: Too many positional arguments: 1 allowed, but 2 found.

My pubspec:

name: app_stretch

# Prevent accidental publishing to pub.dev.
publish_to: "none"

version: 1.39.0+1210

environment:
  flutter: 3.13.9
  sdk: 3.1.5

dependencies:
  app_links: 3.4.5
  cached_network_image: 3.2.3
  carousel_slider: 4.2.1
  collection: 1.17.2
  core:
    path: ../core
  country_picker: 2.0.21
  data:
    path: ../data
  dio: 5.3.3
  domain:
    path: ../domain
  either_dart: 0.4.0
  features:
    path: ../features
  firebase_analytics: 10.4.2
  firebase_core: 2.13.1
  firebase_crashlytics: 3.3.2
  firebase_messaging: 14.6.2
  flex_color_scheme: 7.1.2
  flutter:
    sdk: flutter
  flutter_branch_sdk: 7.0.1
  flutter_dotenv: 5.1.0
  flutter_local_notifications: 16.3.2
  flutter_localizations:
    sdk: flutter
  flutter_pdfview: 1.3.1
  flutter_platform_alert: 0.5.1
  flutter_riverpod: 2.3.6
  flutter_stripe: 9.5.0+1
  flutter_svg: 2.0.7
  flutter_xlider: 3.5.0
  freezed_annotation: 2.4.1
  get_storage: 2.1.1
  go_router: 8.0.1
  google_fonts: 6.1.0
  image_cropper: 5.0.0
  image_picker: 1.0.2
  intl: 0.18.1
  isar: 3.1.0+1
  isar_flutter_libs: 3.1.0+1
  json_annotation: 4.8.1
  language_code: 0.3.0
  latlong2: 0.9.0
  localizations:
    path: ../localizations
  lottie: 2.4.0
  path: 1.8.3
  path_provider: 2.1.0
  permission_handler: 10.4.3
  pinput: 2.3.0
  pull_to_refresh_notification: 3.1.0
  rxdart: 0.27.7
  shared_preferences: ^2.2.2
  stack_trace: 1.11.0
  testsweets: 1.16.1
  timeago: 3.5.0
  uikit:
    path: ../uikit
  url_launcher: 6.1.14
  video_player: 2.7.1
  webview_flutter: 4.2.2

dev_dependencies:
  build_runner: 2.4.6
  custom_lint: 0.4.0
  flutter_gen: 5.3.2
  flutter_gen_runner: 5.3.2
  flutter_launcher_icons: 0.13.1
  flutter_native_splash: 2.3.1
  flutter_test:
    sdk: flutter
  freezed: 2.4.5
  isar_generator: 3.1.0+1
  json_serializable: 6.7.1

dependency_overrides:
  http: 1.1.0
  logger: 2.0.1

flutter_gen:
  line_length: 120
  integrations:
    flutter_svg: true

flutter:
  uses-material-design: true

  assets:
    - environment/
    - google_fonts/
    - assets/pngs/
    - assets/images/

flutter_launcher_icons:
  adaptive_icon_foreground: "assets/pngs/app_icon.png"
  adaptive_icon_background: "#E7DEFF"
  ios: true
  remove_alpha_ios: true
  image_path: "assets/pngs/app_icon.png"

flutter_native_splash:
  color: "#fffbff"
  image: "assets/pngs/launch_image.png"
  android_12:
    color: "#fffbff"
    image: "assets/pngs/launch_image.png"

My MaterialApp widget:

return StreamBuilder<AppThemeMode>(
      stream: themeRepository.observeThemeMode(),
      builder: (context, snapshot) {
        final themeMode = snapshot.data;
        final appTheme = themeMode?.toAppTheme(context) ?? AppTheme.of(context);

        return MaterialApp.router(
          restorationScopeId: 'app',
          localizationsDelegates: const [
            AppLocalizations.delegate,
            CountryLocalizations.delegate,
            GlobalMaterialLocalizations.delegate,
            GlobalWidgetsLocalizations.delegate,
            GlobalCupertinoLocalizations.delegate,
          ],
          supportedLocales: AppLocalizations.supportedLocales,
          onGenerateTitle: (context) => AppLocalizations.of(context).commonAppTitle,
          theme: appTheme.theme,
          routerConfig: router,
          builder: (context, child) => TestSweetsOverlayView(
            projectId: '{projectId}',
            child: _AppObserver(
              child: Builder(
                builder: (context) => MediaQuery(
                  data: MediaQuery.of(context).copyWith(
                    textScaleFactor: min(MediaQuery.of(context).textScaleFactor, 1.1),
                  ),
                  child: ThemeProvider(
                    appTheme: appTheme,
                    child: _legacyIntilized
                        ? Scaffold(
                            resizeToAvoidBottomInset: false,
                            key: _scaffoldKey,
                            body: child,
                          )
                        : const SizedBox(),
                  ),
                ),
              ),
            ),
          ),
        );
      },
    );

My main.dart:

final enableTestSweets = arguments.any((arg) => arg == 'enable_testsweets');
// Setup the TestSweets internal dependencies
await setupTestSweets(enabled: enableTestSweets);

I obviously ran flutter pub get

The flutter version for this project is: v3.13.3

No idea what to do to fix this...

FilledStacks commented 6 months ago

This looks like an issue with overriding the dependency of the logger package and forcing it to choose the latest.

I'll have to upgrade testsweets package which will cause a breaking change.

I'm on paternity leave now so I won't making changes to it any time soon.

migalv commented 6 months ago

Hey Dane,

Thanks for answering. Do you have any workarounds for this in the meanwhile? I just introduced your product to my team and they are waiting on me to set it up and do a showcase, but I'm a bit blocked by this and I'm scared they might loose interest.

Any estimations on how long could this take?

Best, Miguel.

FilledStacks commented 5 months ago

Hey @migalv as I mentioned on LinkedIn, if you're in a hurry I would look at something like Maestro. Even though it doesn't allow for no-code test automation, it's still a good option if you have technical testers with some development experience.

migalv commented 5 months ago

Hey @FilledStacks. I'm not in a hurry, but I really like TestSweets and we do need a no-code test automation for our QA team to automate their processes, they're not very technical so I believe TestSweets is a great option for us.