Skip to content

[flutter-web] Add support for classes or testID attribute that can be used to identify html tags #97455

@adrian-moisa

Description

@adrian-moisa

I'm desperately trying to get Cypress to run on top of the html renderer. Out of all possible testing tools I am strongly favouring Cypress for many reasons. All I need is some sort of an id/class/attribute that can help me find the desired divs. I was looking for ids but I found this answer. Please don't force us to misuse Semantics for the sake of testing in Cypress. And no I don't desire to use the official testing tooling. I've had many experience in the past to reach the conclusion that Cypress is the way forward.

We cannot support adding stable IDs to HTML nodes generated by the engine because the DOM structure is not stable. There's no 1-to-1 correspondence between widgets and DOM nodes. However, you can use platform views where you can create your own DOM nodes and assign arbitrary attributes, including id.

Originally posted by @yjbanov in #95624 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Issues that are less important to the Flutter projectc: new featureNothing broken; request for a new capabilityc: proposalA detailed proposal for a change to Flutterplatform-webWeb applications specificallyr: fixedIssue is closed as already fixed in a newer versionteam-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