e2e guide: improves data-testid code snippet to be clear and understandable (#38791)

This commit is contained in:
Uchechukwu Obasi 2021-09-06 07:03:02 +01:00 committed by GitHub
parent 3b0910e470
commit 774f0a0d01
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -178,8 +178,8 @@ Prefix your selector string with "data-testid":
```typescript
export const Components = {
Login: {
openButton: 'data-testid-open', // this would look for a data-testid
closeButton: 'close-button', // this would look for an aria-label
openButton: 'open-button', // this would look for an aria-label
closeButton: 'data-testid modal-close-button', // this would look for a data-testid
},
};
```
@ -187,5 +187,5 @@ export const Components = {
and in your component, import the selectors and add the data test id:
```
<button data-testid={Selectors.Components.Login.openButton}>
<button data-testid={Selectors.Components.Login.closeButton}>
```