From fc2281657b97389748d5b7e1c56be29d0cd3b445 Mon Sep 17 00:00:00 2001 From: Nicholas Lee Date: Mon, 23 Sep 2024 17:14:05 -0400 Subject: [PATCH] fix: tests --- .../Extraction/ExtractionTable.cy.tsx | 38 +++++++++---------- .../Extraction/components/ExtractionTable.tsx | 13 ++++++- .../components/ExtractionTableAuthor.tsx | 2 - 3 files changed, 30 insertions(+), 23 deletions(-) diff --git a/compose/neurosynth-frontend/cypress/e2e/workflows/Extraction/ExtractionTable.cy.tsx b/compose/neurosynth-frontend/cypress/e2e/workflows/Extraction/ExtractionTable.cy.tsx index 30d6a675..24b8054f 100644 --- a/compose/neurosynth-frontend/cypress/e2e/workflows/Extraction/ExtractionTable.cy.tsx +++ b/compose/neurosynth-frontend/cypress/e2e/workflows/Extraction/ExtractionTable.cy.tsx @@ -95,26 +95,26 @@ describe('ExtractionTable', () => { cy.get('tbody > tr').should('have.length', 1); }); - it('should filter the table by doi', () => { - cy.wait('@studysetFixture').then((studysetFixture) => { - const studyset = studysetFixture?.response?.body as StudysetReturn; - const studysetStudies = studyset.studies as StudyReturn[]; - cy.get('input').eq(4).click(); - cy.get(`input`) - .eq(4) - .type(studysetStudies[0].doi || ''); - }); + // it('should filter the table by doi', () => { + // cy.wait('@studysetFixture').then((studysetFixture) => { + // const studyset = studysetFixture?.response?.body as StudysetReturn; + // const studysetStudies = studyset.studies as StudyReturn[]; + // cy.get('input').eq(4).click(); + // cy.get(`input`) + // .eq(4) + // .type(studysetStudies[0].doi || ''); + // }); - cy.get('tbody > tr').should('have.length', 1); - }); + // cy.get('tbody > tr').should('have.length', 1); + // }); it('should filter the table by pmid', () => { cy.wait('@studysetFixture').then((studysetFixture) => { const studyset = studysetFixture?.response?.body as StudysetReturn; const studysetStudies = studyset.studies as StudyReturn[]; - cy.get('input').eq(5).click(); + cy.get('input').eq(4).click(); cy.get(`input`) - .eq(5) + .eq(4) .type(studysetStudies[0].pmid || ''); }); @@ -181,7 +181,7 @@ describe('ExtractionTable', () => { it('should change the study status', () => { // ARRANGE - cy.get('tbody > tr').eq(0).get('td').eq(6).as('getFirstRowStudyStatusCol'); + cy.get('tbody > tr').eq(0).get('td').eq(5).as('getFirstRowStudyStatusCol'); cy.get('@getFirstRowStudyStatusCol').within(() => { cy.get('button').eq(0).should('have.class', 'MuiButton-contained'); }); @@ -412,7 +412,7 @@ describe('ExtractionTable', () => { // }); it('should sort by pmid desc', () => { - cy.get('[data-testid="ArrowDownwardIcon"]').eq(5).click(); + cy.get('[data-testid="ArrowDownwardIcon"]').eq(4).click(); cy.wait('@studysetFixture').then((studysetFixture) => { const studyset = studysetFixture.response?.body as StudysetReturn; @@ -452,7 +452,7 @@ describe('ExtractionTable', () => { cy.get('tbody > tr').each((tr, index) => { cy.wrap(tr).within(() => { cy.get('td') - .eq(5) + .eq(4) .should('have.text', sortedStudies[index].pmid ?? ''); }); }); @@ -460,7 +460,7 @@ describe('ExtractionTable', () => { }); it('should sort by status desc', () => { - cy.get('[data-testid="ArrowDownwardIcon"]').eq(6).click(); + cy.get('[data-testid="ArrowDownwardIcon"]').eq(5).click(); cy.wait('@projectFixture').then((projectFixture) => { const project = projectFixture?.response?.body as INeurosynthProjectReturn; @@ -516,8 +516,8 @@ describe('ExtractionTable', () => { }); it('should sort by status asc', () => { - cy.get('[data-testid="ArrowDownwardIcon"]').eq(6).click(); - cy.get('[data-testid="ArrowDownwardIcon"]').eq(6).click(); + cy.get('[data-testid="ArrowDownwardIcon"]').eq(5).click(); + cy.get('[data-testid="ArrowDownwardIcon"]').eq(5).click(); cy.get('[data-testid="ArrowUpwardIcon"]').should('exist'); cy.wait('@projectFixture').then((projectFixture) => { diff --git a/compose/neurosynth-frontend/src/pages/Extraction/components/ExtractionTable.tsx b/compose/neurosynth-frontend/src/pages/Extraction/components/ExtractionTable.tsx index 72c1229f..1024be82 100644 --- a/compose/neurosynth-frontend/src/pages/Extraction/components/ExtractionTable.tsx +++ b/compose/neurosynth-frontend/src/pages/Extraction/components/ExtractionTable.tsx @@ -271,14 +271,23 @@ const ExtractionTable: React.FC = () => { /> - +
{table.getHeaderGroups().map((headerGroup) => ( {headerGroup.headers.map((header) => ( {flexRender( diff --git a/compose/neurosynth-frontend/src/pages/Extraction/components/ExtractionTableAuthor.tsx b/compose/neurosynth-frontend/src/pages/Extraction/components/ExtractionTableAuthor.tsx index 717ab712..0636a61c 100644 --- a/compose/neurosynth-frontend/src/pages/Extraction/components/ExtractionTableAuthor.tsx +++ b/compose/neurosynth-frontend/src/pages/Extraction/components/ExtractionTableAuthor.tsx @@ -40,7 +40,6 @@ export const ExtractionTableAuthorHeader: React.FC< ) : isSorted === 'asc' ? ( table.resetSorting()}> - sx={{ width: '' }} @@ -48,7 +47,6 @@ export const ExtractionTableAuthorHeader: React.FC< ) : ( table.setSorting([{ id: 'authors', desc: false }])} >