From 8a4a584ba0b749b0e01b66d9ee85b2dbe67e72bd Mon Sep 17 00:00:00 2001 From: Suguru Hirahara Date: Mon, 17 Apr 2023 06:10:11 +0000 Subject: [PATCH] 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 --- cypress/e2e/location/location.spec.ts | 2 +- cypress/e2e/threads/threads.spec.ts | 2 +- src/components/views/beacon/LiveTimeRemaining.tsx | 2 +- src/components/views/beacon/OwnBeaconStatus.tsx | 6 +++--- src/components/views/dialogs/ExportDialog.tsx | 2 +- src/components/views/location/LiveDurationDropdown.tsx | 2 +- src/components/views/location/ShareType.tsx | 2 +- src/components/views/right_panel/EncryptionInfo.tsx | 2 +- .../beacon/__snapshots__/BeaconViewDialog-test.tsx.snap | 4 ++-- .../beacon/__snapshots__/RoomLiveShareWarning-test.tsx.snap | 4 ++-- .../location/__snapshots__/LocationPicker-test.tsx.snap | 2 +- 11 files changed, 15 insertions(+), 15 deletions(-) diff --git a/cypress/e2e/location/location.spec.ts b/cypress/e2e/location/location.spec.ts index b716fe543b..65ddd767ba 100644 --- a/cypress/e2e/location/location.spec.ts +++ b/cypress/e2e/location/location.spec.ts @@ -23,7 +23,7 @@ describe("Location sharing", () => { let homeserver: HomeserverInstance; const selectLocationShareTypeOption = (shareType: string): Chainable => { - return cy.get(`[data-test-id="share-location-option-${shareType}"]`); + return cy.get(`[data-testid="share-location-option-${shareType}"]`); }; const submitShareLocation = (): void => { diff --git a/cypress/e2e/threads/threads.spec.ts b/cypress/e2e/threads/threads.spec.ts index 75585c888b..ee1fd78d08 100644 --- a/cypress/e2e/threads/threads.spec.ts +++ b/cypress/e2e/threads/threads.spec.ts @@ -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 => { - 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(); diff --git a/src/components/views/beacon/LiveTimeRemaining.tsx b/src/components/views/beacon/LiveTimeRemaining.tsx index b6682d710b..b1fc767f6f 100644 --- a/src/components/views/beacon/LiveTimeRemaining.tsx +++ b/src/components/views/beacon/LiveTimeRemaining.tsx @@ -69,7 +69,7 @@ const LiveTimeRemaining: React.FC<{ beacon: Beacon }> = ({ beacon }) => { const liveTimeRemaining = _t(`%(timeRemaining)s left`, { timeRemaining }); return ( - + {liveTimeRemaining} ); diff --git a/src/components/views/beacon/OwnBeaconStatus.tsx b/src/components/views/beacon/OwnBeaconStatus.tsx index 92afa950da..344a2fff30 100644 --- a/src/components/views/beacon/OwnBeaconStatus.tsx +++ b/src/components/views/beacon/OwnBeaconStatus.tsx @@ -57,7 +57,7 @@ const OwnBeaconStatus: React.FC> = ({ beacon, > {ownDisplayStatus === BeaconDisplayStatus.Active && ( > = ({ beacon, )} {hasLocationPublishError && ( > = ({ beacon, )} {hasStopSharingError && ( = ({ room, onFinished }) => { )} {isExporting ? ( -
+

{exportProgressText}

= ({ timeout, onChange }) => { > { options.map(({ key, label }) => ( -
+
{label}
)) as NonEmptyArray diff --git a/src/components/views/location/ShareType.tsx b/src/components/views/location/ShareType.tsx index 81d232e6f5..235a385dc1 100644 --- a/src/components/views/location/ShareType.tsx +++ b/src/components/views/location/ShareType.tsx @@ -91,7 +91,7 @@ const ShareType: React.FC = ({ setShareType, enabledShareTypes }) => { onClick={() => setShareType(type)} label={labels[type]} shareType={type} - data-test-id={`share-location-option-${type}`} + data-testid={`share-location-option-${type}`} /> ))}
diff --git a/src/components/views/right_panel/EncryptionInfo.tsx b/src/components/views/right_panel/EncryptionInfo.tsx index d9952ef05b..fb5503c788 100644 --- a/src/components/views/right_panel/EncryptionInfo.tsx +++ b/src/components/views/right_panel/EncryptionInfo.tsx @@ -108,7 +108,7 @@ const EncryptionInfo: React.FC = ({ return ( -
+

{_t("Encryption")}

{description}
diff --git a/test/components/views/beacon/__snapshots__/BeaconViewDialog-test.tsx.snap b/test/components/views/beacon/__snapshots__/BeaconViewDialog-test.tsx.snap index e2f61aaca5..f369aed66a 100644 --- a/test/components/views/beacon/__snapshots__/BeaconViewDialog-test.tsx.snap +++ b/test/components/views/beacon/__snapshots__/BeaconViewDialog-test.tsx.snap @@ -65,14 +65,14 @@ exports[` renders own beacon status when user is live sharin 1h left