diff --git a/cypress/e2e/ResourceContainer.cy.ts b/cypress/e2e/ResourceContainer.cy.ts index ffd29bdea..6d336f39a 100644 --- a/cypress/e2e/ResourceContainer.cy.ts +++ b/cypress/e2e/ResourceContainer.cy.ts @@ -90,6 +90,17 @@ describe('Resource with id that contains URL encoded characters', () => { }); }); + it('resource with any id opens when user clicks on resource row in Search table', function() { + cy.visit(`/search?layout=Neuron%20Morphology`); + + cy.findAllByTestId('search-table-row') + .first() + .click(); + + cy.findByText('Advanced View').click(); + cy.contains(`"@id"`); + }); + it('resource opens when user directly navigates to resource page', function() { const resourcePage = `/${Cypress.env('ORG_LABEL')}/${ this.projectLabel diff --git a/src/subapps/search/containers/SearchContainer.tsx b/src/subapps/search/containers/SearchContainer.tsx index 0e2ed5e54..053b2f7d1 100644 --- a/src/subapps/search/containers/SearchContainer.tsx +++ b/src/subapps/search/containers/SearchContainer.tsx @@ -84,13 +84,15 @@ const SearchContainer: React.FC = () => { background: location, }); }; - const onRowClick = (record: any): { onClick: () => void } => { + const onRowClick = ( + record: any + ): { onClick: () => void; 'data-testid': string } => { return { onClick: () => { const [orgLabel, projectLabel] = record.project.label.split('/'); - const resourceId = encodeURIComponent(record['@id']); - goToResource(orgLabel, projectLabel, resourceId); + goToResource(orgLabel, projectLabel, record['@id']); }, + 'data-testid': 'search-table-row', }; }; const {