tree: eddfc907b2afb13959acc9837e0f31a4670ec771 [path history] [tgz]
  1. analysis_options.yaml
  2. browser.dart
  3. browser_lock.yaml
  4. build.dart
  5. chrome.dart
  6. chrome_installer.dart
  7. clean.dart
  8. common.dart
  9. driver_version.yaml
  10. edge.dart
  11. edge_installation.dart
  12. environment.dart
  13. exceptions.dart
  14. felt
  15. felt.dart
  16. felt_windows.bat
  17. firefox.dart
  18. firefox_installer.dart
  19. firefox_installer_test.dart
  20. goldens.dart
  21. goldens_lock.yaml
  22. integration_tests_manager.dart
  23. licenses.dart
  24. README.md
  25. safari.dart
  26. safari_installation.dart
  27. supported_browsers.dart
  28. test_platform.dart
  29. test_runner.dart
  30. utils.dart
lib/web_ui/dev/README.md

What's felt?

felt stands for “Flutter Engine Local Tester”. It's a cli tool that aims to make development in the Flutter web engine more productive and pleasant.

What can felt do?

felt supports multiple commands as follows:

  1. felt check-licenses: Checks that all Dart and JS source code files contain the correct license headers.
  2. felt test: Runs all or some tests depending on the passed arguments.
  3. felt build: Builds the engine locally so it can be used by Flutter apps. It also supports a watch mode for more convenience.

You could also run felt help or felt help <command> to get more information about the available commands and arguments.

How can I use felt?

Once you have your local copy of the engine setup, it's recommended that you add /path/to/engine/src/flutter/lib/web_ui/dev to your PATH. Then you would be able to use the felt tool from anywhere:

felt check-licenses

or:

felt build --watch

If you don't want to add felt to your path, you can still invoke it using a relative path like ./web_ui/dev/felt <command>

Speeding up your builds and tests

You can speed up ninja and dart2js by adding parallelism and taking advantage of more cores.

To speed up ninja pass -j to specify the desired level of parallelism, like so:

felt build [-w] -j 100

If you are a Google employee, you can use an internal instance of Goma to parallelize your builds. Because Goma compiles code on remote servers, this option is effective even on low-powered laptops.

By default, when compiling Dart code to JavaScript, we use 4 dart2js workers. If you need to increase or reduce the number of workers, set the BUILD_MAX_WORKERS_PER_TASK environment variable to the desired number.

Running web engine tests

To run all tests on Chrome. This will run both integration tests and the unit tests:

felt test

To run unit tests only:

felt test --unit-tests-only

To run integration tests only. For now these tests are only available on Chrome Desktop browsers. These tests will fetch the flutter repository for using flutter drive and flutter pub get commands. The repository will be synced to the youngest commit older than the engine commit.

felt test --integration-tests-only

To skip cloning the flutter repository use the following flag. This flag can save internet bandwidth. However use with caution. Note the tests results will not be consistent with CIs when this flag is set. flutter command should be set in the PATH for this flag to be useful. This flag can also be used to test local Flutter changes.

felt test --integration-tests-only --use-system-flutter

To run tests on Firefox (this will work only on a Linux device):

felt test --browser=firefox

For Chrome and Firefox, the tests run on a version locked on the browser_lock.yaml. In order to use another version, add the version argument:

felt test --browser=firefox --firefox-version=70.0.1

To run tests on Safari use the following command. It works on MacOS devices and it uses the Safari installed on the OS. Currently there is no option for using another Safari version.

felt test --browser=safari

To run tests on Windows Edge use the following command. It works on Windows devices and it uses the Edge installed on the OS.

felt_windows.bat test --browser=edge

To run a single test use the following command. Note that it does not work on Windows.

felt test test/golden_tests/engine/canvas_golden_test.dart

To debug a test on Chrome:

felt test --debug test/golden_tests/engine/canvas_golden_test.dart

Configuration files

browser_lock.yaml contains the version of browsers we use to test Flutter for web. Versions are not automatically updated whenever a new release is available. Instead, we update this file manually once in a while.

goldens_lock.yaml refers to a revision in the https://github.com/flutter/goldens repo. Screenshot tests are compared with the golden files at that revision. When making engine changes that affect screenshots, first submit a PR to flutter/goldens updating the screenshots. Then update this file pointing to the new revision.

Developing the felt tool

If you are making changes in the felt tool itself, you need to be aware of Dart snapshots. We create a Dart snapshot of the felt tool to make the startup faster.

To make sure you are running the felt tool with your changes included, you would need to stop using the snapshot. This can be achived through the environment variable FELT_USE_SNAPSHOT:

FELT_USE_SNAPSHOT=false felt <command>

or

FELT_USE_SNAPSHOT=0 felt <command>

Note: if FELT_USE_SNAPSHOT is omitted or has any value other than “false” or “0”, the snapshot mode will be enabled.