Skip to content

Flutter Web, there is no explanation for testing, README.md #7779

Closed

Description

@icatalud

Missing testing information in the README.md.

I can see that they use the flutter_web_test package in the flutter_web package, however when I try to use the same package in my tests, it fails from the start when using the command 'flutter test' because it complains about the missing the flutter_test (not web) dependency.

How can the tests in the flutter_web package be run?

Activity

  1. jonahwilliams commented on Jul 12, 2019

    @jonahwilliams
    Contributor

    I believe the tests in the flutter web repo can be run with flutter pub run test -p chrome

  2. icatalud commented on Jul 12, 2019

    @icatalud
    Author

    And if I'm using the flutter_web_test package on my own project, what would be the steps to take?

    All these strange paths to use stuff should be clear in the documentation of the project. It would be great if they can add a Readme of some sort to explain how to do things.

    Imagine you are someone that wants to try or modify stuff on the library, how you would be able to deduce that?
    All steps should be crystal clear on the documentation to be "welcoming" to newcomers.

  3. sandros06 commented on Jul 26, 2019

    @sandros06

    I believe the tests in the flutter web repo can be run with flutter pub run test -p chrome

    This command work only for import 'package:test/test.dart'; but not with this package import 'package:flutter_web_test/flutter_web_test.dart'; this generate this error :

    >flutter pub run test -p chrome
    00:00 +0: compiling test\core\base_core_test.dart
    ../../../../../../../flutter/.pub-cache/git/flutter_web-1b9477bd041f3667445c1cb0a202972fe234ba86/packages/flutter_web_test/lib/src/window.dart:288:3:
    Error: Type 'TimingsCallback' not found.
      TimingsCallback onReportTimings;
      ^^^^^^^^^^^^^^^
    ../../../../../../../flutter/.pub-cache/git/flutter_web-1b9477bd041f3667445c1cb0a202972fe234ba86/packages/flutter_web_test/lib/src/window.dart:288:3:
    Error: 'TimingsCallback' isn't a type.
      TimingsCallback onReportTimings;
      ^^^^^^^^^^^^^^^
    Error: Compilation failed.
    
    00:00 +0 -1: compiling test\core\base_core_test.dart [E]
      Failed to load "test\core\base_core_test.dart": dart2js failed.
    00:00 +0 -1: Some tests failed.
    
  4. yjbanov commented on Sep 13, 2019

    @yjbanov
    Contributor

    Flutter for web app are tested the same way as explained in flutter.dev/testing. What's missing today is FlutterDriver support.

    However, in addition to the regular mock environment, you can run tests in actual Chrome like this:

    flutter pub run test -p chrome
    

    Perhaps we should update https://flutter.dev/docs/cookbook/testing/unit/introduction to mention that?

    /cc @sfshaza2

  5. PavelPZ commented on Nov 21, 2019

    @PavelPZ

    Was anybody successfull with testing flutter web project from command line?

    None of these possibilities work for me (on newest flutter dev channel, 1.12.6):

    • flutter pub run test -p chrome
    • flutter test --platform chrome
    • flutter pub run build_runner test -- -p "chrome"

    See flutter/flutter#44583.

  6. PavelPZ commented on Nov 21, 2019

    @PavelPZ

    Looks like flutter pub run test -p chrome is dead, see official @jonahwilliams statement.

  7. jonahwilliams commented on Nov 22, 2019

    @jonahwilliams
    Contributor

    flutter pub run test -p chrome

    This was only ever for the forked flutter_web repo

  8. PavelPZ commented on Nov 22, 2019

    @PavelPZ

    Okay, but the flutter_web repo fork is also dead (the flutter for the web is now part of the flutter SDK repo, I hope).

  9. added
    t.framework
    on Jul 3, 2020
  10. transferred this issue fromflutter/flutteron Nov 11, 2022
  11. added
    from.flutter-sdk
    and removed on Nov 11, 2022
  12. added
    test.general
    target.web
    and removed on May 30, 2023
  13. atsansone commented on Jun 3, 2023

    @atsansone
    Contributor

    Flutter web testing is explained on the integration testing page. Closing this issue.

  14. added
    cl.fixed
    on Jun 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    cl.fixedfrom.flutter-sdkt.dev-toolst.frameworktarget.webtest.general

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions