angular / components

Component infrastructure and Material Design components for Angular
https://material.angular.io
MIT License
24.35k stars 6.74k forks source link

Add data-testid for testing purpose #28731

Closed vupham30 closed 7 months ago

vupham30 commented 7 months ago

Feature Description

Add data-testid to use in Selenium automation test to avoid breaking test case in future refactoring.

Use Case

No response

crisbeto commented 7 months ago

This is already addressed by using our test harnesses.

vupham30 commented 7 months ago

Hi, but I can use testing harness with Selenium ?

crisbeto commented 7 months ago

@mmalerba can confirm, but we do have a wrapper around Selenium Webdriver https://github.com/angular/components/tree/main/src/cdk/testing/selenium-webdriver.

vupham30 commented 7 months ago

could you pls send me any document of it as well ? thanks !

crisbeto commented 7 months ago

Our guide for test harnesses is at https://material.angular.io/guide/using-component-harnesses. You can also see some examples in our tests: https://github.com/angular/components/blob/main/src/cdk/testing/tests/webdriver.e2e.spec.ts#L87-L112

angular-automatic-lock-bot[bot] commented 6 months ago

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.