Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
Make test ID compatible with findByTestId() of Cypress Testing Library (
Browse files Browse the repository at this point in the history
#10617)

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

Signed-off-by: Suguru Hirahara <luixxiul@users.noreply.github.com>
  • Loading branch information
luixxiul authored Apr 17, 2023
1 parent daad630 commit 8a4a584
Show file tree
Hide file tree
Showing 11 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion cypress/e2e/location/location.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ describe("Location sharing", () => {
let homeserver: HomeserverInstance;

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 => {
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/threads/threads.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ describe("Threads", () => {
it("should send location and reply to the location on ThreadView", () => {
// See: location.spec.ts
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 => {
cy.get('[data-testid="location-picker-submit-button"]').click();
Expand Down
2 changes: 1 addition & 1 deletion src/components/views/beacon/LiveTimeRemaining.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ const LiveTimeRemaining: React.FC<{ beacon: Beacon }> = ({ beacon }) => {
const liveTimeRemaining = _t(`%(timeRemaining)s left`, { timeRemaining });

return (
<span data-test-id="room-live-share-expiry" className="mx_LiveTimeRemaining">
<span data-testid="room-live-share-expiry" className="mx_LiveTimeRemaining">
{liveTimeRemaining}
</span>
);
Expand Down
6 changes: 3 additions & 3 deletions src/components/views/beacon/OwnBeaconStatus.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ const OwnBeaconStatus: React.FC<Props & HTMLProps<HTMLDivElement>> = ({ beacon,
>
{ownDisplayStatus === BeaconDisplayStatus.Active && (
<AccessibleButton
data-test-id="beacon-status-stop-beacon"
data-testid="beacon-status-stop-beacon"
kind="link"
// eat events here to avoid 1) the map and 2) reply or thread tiles
// moving under the beacon status on stop/retry click
Expand All @@ -70,7 +70,7 @@ const OwnBeaconStatus: React.FC<Props & HTMLProps<HTMLDivElement>> = ({ beacon,
)}
{hasLocationPublishError && (
<AccessibleButton
data-test-id="beacon-status-reset-wire-error"
data-testid="beacon-status-reset-wire-error"
kind="link"
// eat events here to avoid 1) the map and 2) reply or thread tiles
// moving under the beacon status on stop/retry click
Expand All @@ -82,7 +82,7 @@ const OwnBeaconStatus: React.FC<Props & HTMLProps<HTMLDivElement>> = ({ beacon,
)}
{hasStopSharingError && (
<AccessibleButton
data-test-id="beacon-status-stop-beacon-retry"
data-testid="beacon-status-stop-beacon-retry"
kind="link"
// eat events here to avoid 1) the map and 2) reply or thread tiles
// moving under the beacon status on stop/retry click
Expand Down
2 changes: 1 addition & 1 deletion src/components/views/dialogs/ExportDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ const ExportDialog: React.FC<IProps> = ({ room, onFinished }) => {
)}
</div>
{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} />
<p>{exportProgressText}</p>
<DialogButtons
Expand Down
2 changes: 1 addition & 1 deletion src/components/views/location/LiveDurationDropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ const LiveDurationDropdown: React.FC<Props> = ({ timeout, onChange }) => {
>
{
options.map(({ key, label }) => (
<div data-test-id={`live-duration-option-${key}`} key={key}>
<div data-testid={`live-duration-option-${key}`} key={key}>
{label}
</div>
)) as NonEmptyArray<ReactElement & { key: string }>
Expand Down
2 changes: 1 addition & 1 deletion src/components/views/location/ShareType.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ const ShareType: React.FC<Props> = ({ setShareType, enabledShareTypes }) => {
onClick={() => setShareType(type)}
label={labels[type]}
shareType={type}
data-test-id={`share-location-option-${type}`}
data-testid={`share-location-option-${type}`}
/>
))}
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/components/views/right_panel/EncryptionInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ const EncryptionInfo: React.FC<IProps> = ({

return (
<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>
{description}
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,14 @@ exports[`<BeaconViewDialog /> renders own beacon status when user is live sharin
</span>
<span
class="mx_LiveTimeRemaining"
data-test-id="room-live-share-expiry"
data-testid="room-live-share-expiry"
>
1h left
</span>
</div>
<div
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"
tabindex="0"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ exports[`<RoomLiveShareWarning /> when user has live beacons and geolocation is
</span>
<span
class="mx_LiveTimeRemaining"
data-test-id="room-live-share-expiry"
data-testid="room-live-share-expiry"
>
1h left
</span>
Expand Down Expand Up @@ -46,7 +46,7 @@ exports[`<RoomLiveShareWarning /> when user has live beacons and geolocation is
</span>
<span
class="mx_LiveTimeRemaining"
data-test-id="room-live-share-expiry"
data-testid="room-live-share-expiry"
>
12h left
</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

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

0 comments on commit 8a4a584

Please sign in to comment.