-
-
Notifications
You must be signed in to change notification settings - Fork 828
Update spaces.spec.ts
- use Cypress Testing Library
#10620
Conversation
<AccessibleButton | ||
className={classNames("mx_SpaceCreateMenuType", className)} | ||
onClick={onClick} | ||
aria-label={_t("Create a %(publicOrPrivate)s space", { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is the aria label different from the button text contents? This button already has a good accessible name. Our testing utils should be flexible enough to select buttons in multiple ways as needed.
This comment was marked as outdated.
This comment was marked as outdated.
Sorry, something went wrong.
@@ -62,6 +63,7 @@ const SpacePublicShare: React.FC<IProps> = ({ space, onFinished }) => { | |||
if (onFinished) onFinished(); | |||
showRoomInviteDialog(space.roomId); | |||
}} | |||
aria-label={_t("Invite people")} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why can't you use the text in the button itself to select this for tests?
This comment was marked as outdated.
This comment was marked as outdated.
Sorry, something went wrong.
Signed-off-by: Suguru Hirahara <luixxiul@users.noreply.github.com>
spaces.spec.ts
- use Cypress Testing Library and set unique aria-label
spaces.spec.ts
- use Cypress Testing Library
cy.get(".mx_SpacePanel:not(.collapsed)").should("exist"); | ||
cy.findByRole("tree", { name: "Spaces" }).within(() => { | ||
// This finds the expand button with the class name "mx_SpaceButton_toggleCollapse". Note there is another | ||
// button with the same name with different class name "mx_SpacePanel_toggleCollapse". |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment is a bit confusing, is the second class meant to be different?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is intended to note that there are two buttons whose name is Expand
and it is not possible to select the proper one without specifying with findByRole("tree", { name: "Spaces" }).within
.
For element-hq/element-web#25033
This PR update
spaces.spec.ts
by using Cypress Testing Library.type: task
Signed-off-by: Suguru Hirahara luixxiul@users.noreply.github.com
Checklist
This change is marked as an internal change (Task), so will not be included in the changelog.