Skip to content

Consider removing debugEmulateFlutterTesterEnvironment flag #145779

Closed

Description

@eyebrowsoffire

We have a number of backdoor flags in the web engine that the framework uses to set up its test environment. Out of all of them, I dislike debugEmulateFlutterTesterEnvironment the most.

  • This flag does too many completely orthogonal things.
  • Many of the things it does could be achieved through normal publicly visible APIs.
  • Using special modes that don't actually apply to users' apps lowers the fidelity of our tests.
  • The flag is not well documented in how it changes the engine's behavior.
  • The flag creates leaky abstractions between the engine and the framework. If the APIs we expose through normal channels are not sufficient for the framework's unit tests, we should consider augmenting those APIs so that any consumer of the engine could set up their own test environment without the use of a special handshake flag like this.

From what I can tell, this flag does a couple different things:

  • Changes the size of the implicit view. This could be done in the framework's test harness.
  • Sets a special mode that uses only some specific test fonts, instead of what the user passes in. I think it would be better if the test harness in the framework explicitly loads the test fonts and explicitly uses them in each of the tests.
  • Suppresses platform messages in the PlatformDispatcher. I'm not entirely sure why this is necessary, but I have to imagine it can be possible to suppress these at the framework level. If not, and we truly need a flag for suppressing these, I would rather have an explicit flag as part of the ui_web API or something similar, rather than it just being a undocumented side effect of this flag.
  • Turns semantics off. I'm pretty sure this can be also be done with our normal APIs.
  • Sets a special test UrlStrategy. This could also be done from the framework side with normal APIs.

I think we should consider removing this flag and being more explicit about how we set up any given test.

Activity

  1. yjbanov commented on Mar 26, 2024

    @yjbanov
    Contributor

    SGTM. The idea with debugEmulateFlutterTesterEnvironment was to make the web test environment look the same as the native flutter test environment to package:flutter, package:flutter_test, and widget and test code. If we have better ways to achieve this, it should be a matter of updating the test bootstrap code to use the alternative APIs.

  2. added
    engineflutter/engine related. See also e: labels.
    platform-webWeb applications specifically
    P2Important issues not at the top of the work list
    team-webOwned by Web platform team
    triaged-webTriaged by Web platform team
    on Mar 26, 2024
  3. mdebbar commented on May 15, 2025

    @mdebbar
    Contributor

    As part of my work on #168686, I followed a yak shave that lead me here.

    Here's a WIP PR to address this issue: #168767

  4. added
    P1High-priority issues at the top of the work list
    and removed
    P2Important issues not at the top of the work list
    on May 15, 2025
  5. self-assigned this
    on May 15, 2025
  6. github-actions commented on Jul 8, 2025

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  7. locked as resolved and limited conversation to collaborators on Jul 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

P1High-priority issues at the top of the work listc: tech-debtTechnical debt, code quality, testing, etc.engineflutter/engine related. See also e: labels.platform-webWeb applications specificallyteam-webOwned by Web platform teamtriaged-webTriaged by Web platform team

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions