Make test ID compatible with findByTestId() of Cypress Testing Library (#10617)

'data-test-id' is not discoverable with findByTestId() of Cypress Testing Library.

Signed-off-by: Suguru Hirahara <luixxiul@users.noreply.github.com>
This commit is contained in:
Suguru Hirahara 2023-04-17 06:10:11 +00:00 committed by GitHub
parent daad630827
commit 8a4a584ba0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 15 additions and 15 deletions

View file

@ -23,7 +23,7 @@ describe("Location sharing", () => {
let homeserver: HomeserverInstance; let homeserver: HomeserverInstance;
const selectLocationShareTypeOption = (shareType: string): Chainable<JQuery> => { const selectLocationShareTypeOption = (shareType: string): Chainable<JQuery> => {
return cy.get(`[data-test-id="share-location-option-${shareType}"]`); return cy.get(`[data-testid="share-location-option-${shareType}"]`);
}; };
const submitShareLocation = (): void => { const submitShareLocation = (): void => {

View file

@ -392,7 +392,7 @@ describe("Threads", () => {
it("should send location and reply to the location on ThreadView", () => { it("should send location and reply to the location on ThreadView", () => {
// See: location.spec.ts // See: location.spec.ts
const selectLocationShareTypeOption = (shareType: string): Chainable<JQuery> => { const selectLocationShareTypeOption = (shareType: string): Chainable<JQuery> => {
return cy.get(`[data-test-id="share-location-option-${shareType}"]`); return cy.get(`[data-testid="share-location-option-${shareType}"]`);
}; };
const submitShareLocation = (): void => { const submitShareLocation = (): void => {
cy.get('[data-testid="location-picker-submit-button"]').click(); cy.get('[data-testid="location-picker-submit-button"]').click();

View file

@ -69,7 +69,7 @@ const LiveTimeRemaining: React.FC<{ beacon: Beacon }> = ({ beacon }) => {
const liveTimeRemaining = _t(`%(timeRemaining)s left`, { timeRemaining }); const liveTimeRemaining = _t(`%(timeRemaining)s left`, { timeRemaining });
return ( return (
<span data-test-id="room-live-share-expiry" className="mx_LiveTimeRemaining"> <span data-testid="room-live-share-expiry" className="mx_LiveTimeRemaining">
{liveTimeRemaining} {liveTimeRemaining}
</span> </span>
); );

View file

@ -57,7 +57,7 @@ const OwnBeaconStatus: React.FC<Props & HTMLProps<HTMLDivElement>> = ({ beacon,
> >
{ownDisplayStatus === BeaconDisplayStatus.Active && ( {ownDisplayStatus === BeaconDisplayStatus.Active && (
<AccessibleButton <AccessibleButton
data-test-id="beacon-status-stop-beacon" data-testid="beacon-status-stop-beacon"
kind="link" kind="link"
// eat events here to avoid 1) the map and 2) reply or thread tiles // eat events here to avoid 1) the map and 2) reply or thread tiles
// moving under the beacon status on stop/retry click // moving under the beacon status on stop/retry click
@ -70,7 +70,7 @@ const OwnBeaconStatus: React.FC<Props & HTMLProps<HTMLDivElement>> = ({ beacon,
)} )}
{hasLocationPublishError && ( {hasLocationPublishError && (
<AccessibleButton <AccessibleButton
data-test-id="beacon-status-reset-wire-error" data-testid="beacon-status-reset-wire-error"
kind="link" kind="link"
// eat events here to avoid 1) the map and 2) reply or thread tiles // eat events here to avoid 1) the map and 2) reply or thread tiles
// moving under the beacon status on stop/retry click // moving under the beacon status on stop/retry click
@ -82,7 +82,7 @@ const OwnBeaconStatus: React.FC<Props & HTMLProps<HTMLDivElement>> = ({ beacon,
)} )}
{hasStopSharingError && ( {hasStopSharingError && (
<AccessibleButton <AccessibleButton
data-test-id="beacon-status-stop-beacon-retry" data-testid="beacon-status-stop-beacon-retry"
kind="link" kind="link"
// eat events here to avoid 1) the map and 2) reply or thread tiles // eat events here to avoid 1) the map and 2) reply or thread tiles
// moving under the beacon status on stop/retry click // moving under the beacon status on stop/retry click

View file

@ -398,7 +398,7 @@ const ExportDialog: React.FC<IProps> = ({ room, onFinished }) => {
)} )}
</div> </div>
{isExporting ? ( {isExporting ? (
<div data-test-id="export-progress" className="mx_ExportDialog_progress"> <div data-testid="export-progress" className="mx_ExportDialog_progress">
<Spinner w={24} h={24} /> <Spinner w={24} h={24} />
<p>{exportProgressText}</p> <p>{exportProgressText}</p>
<DialogButtons <DialogButtons

View file

@ -71,7 +71,7 @@ const LiveDurationDropdown: React.FC<Props> = ({ timeout, onChange }) => {
> >
{ {
options.map(({ key, label }) => ( options.map(({ key, label }) => (
<div data-test-id={`live-duration-option-${key}`} key={key}> <div data-testid={`live-duration-option-${key}`} key={key}>
{label} {label}
</div> </div>
)) as NonEmptyArray<ReactElement & { key: string }> )) as NonEmptyArray<ReactElement & { key: string }>

View file

@ -91,7 +91,7 @@ const ShareType: React.FC<Props> = ({ setShareType, enabledShareTypes }) => {
onClick={() => setShareType(type)} onClick={() => setShareType(type)}
label={labels[type]} label={labels[type]}
shareType={type} shareType={type}
data-test-id={`share-location-option-${type}`} data-testid={`share-location-option-${type}`}
/> />
))} ))}
</div> </div>

View file

@ -108,7 +108,7 @@ const EncryptionInfo: React.FC<IProps> = ({
return ( return (
<React.Fragment> <React.Fragment>
<div data-test-id="encryption-info-description" className="mx_UserInfo_container"> <div data-testid="encryption-info-description" className="mx_UserInfo_container">
<h3>{_t("Encryption")}</h3> <h3>{_t("Encryption")}</h3>
{description} {description}
</div> </div>

View file

@ -65,14 +65,14 @@ exports[`<BeaconViewDialog /> renders own beacon status when user is live sharin
</span> </span>
<span <span
class="mx_LiveTimeRemaining" class="mx_LiveTimeRemaining"
data-test-id="room-live-share-expiry" data-testid="room-live-share-expiry"
> >
1h left 1h left
</span> </span>
</div> </div>
<div <div
class="mx_AccessibleButton mx_OwnBeaconStatus_button mx_OwnBeaconStatus_destructiveButton mx_AccessibleButton_hasKind mx_AccessibleButton_kind_link" class="mx_AccessibleButton mx_OwnBeaconStatus_button mx_OwnBeaconStatus_destructiveButton mx_AccessibleButton_hasKind mx_AccessibleButton_kind_link"
data-test-id="beacon-status-stop-beacon" data-testid="beacon-status-stop-beacon"
role="button" role="button"
tabindex="0" tabindex="0"
> >

View file

@ -15,7 +15,7 @@ exports[`<RoomLiveShareWarning /> when user has live beacons and geolocation is
</span> </span>
<span <span
class="mx_LiveTimeRemaining" class="mx_LiveTimeRemaining"
data-test-id="room-live-share-expiry" data-testid="room-live-share-expiry"
> >
1h left 1h left
</span> </span>
@ -46,7 +46,7 @@ exports[`<RoomLiveShareWarning /> when user has live beacons and geolocation is
</span> </span>
<span <span
class="mx_LiveTimeRemaining" class="mx_LiveTimeRemaining"
data-test-id="room-live-share-expiry" data-testid="room-live-share-expiry"
> >
12h left 12h left
</span> </span>

View file

@ -2,7 +2,7 @@
exports[`LocationPicker <LocationPicker /> for Live location share type updates selected duration 1`] = ` exports[`LocationPicker <LocationPicker /> for Live location share type updates selected duration 1`] = `
<div <div
data-test-id="live-duration-option-3600000" data-testid="live-duration-option-3600000"
> >
Share for 1h Share for 1h
</div> </div>