Skip to content

Commit f8591a5

Browse files
authored
Feat 709 add progress bar to edit study page with the ability to switch between different lists (#832)
* feat: add inital wireframes proposal * feat: fixes * fix: merge conflicts * feat: update edit study page * feat: finished edit study page * feat: added feedback * fix: feedback updats * feat: update with feedback * chore: add initial test files * fix: finished tests * fix: tests * fix: lowercase to uppercase * replace mark with set
1 parent 47dbf03 commit f8591a5

File tree

64 files changed

+2664
-645
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+2664
-645
lines changed

compose/neurosynth-frontend/cypress/e2e/pages/BaseStudyPage.cy.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ describe(PAGE_NAME, () => {
2222
cy.intercept('GET', `**/api/base-studies/**`, {
2323
fixture: 'study',
2424
}).as('studyFixture');
25-
cy.visit(PATH).wait('@semanticScholarFixture').wait('@studyFixture');
2625
// .get('tr')
2726
// .eq(2)
2827
// .click()

compose/neurosynth-frontend/cypress/e2e/pages/EditStudyPage.cy.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ describe(PAGE_NAME, () => {
3636
.wait('@studyFixture')
3737
.wait('@projectFixture')
3838
.wait('@annotationFixture')
39-
.wait('@semanticScholarFixture')
4039
.wait('@studysetFixture');
4140
});
4241

@@ -48,15 +47,14 @@ describe(PAGE_NAME, () => {
4847
.wait('@studyFixture')
4948
.wait('@projectFixture')
5049
.wait('@annotationFixture')
51-
.wait('@semanticScholarFixture')
5250
.wait('@studysetFixture');
5351

5452
// ACT
5553
cy.get('div').contains('(name, authors, description, doi, pmid, etc)').click();
5654
cy.contains('label', 'doi').next().clear();
5755
cy.contains('label', 'pmid').next().clear();
5856
cy.contains('label', 'pmcid').next().clear();
59-
cy.contains('button', 'save').click();
57+
cy.get('[data-testid="SaveIcon"]').click();
6058

6159
// ASSERT
6260
cy.get('@editStudy').its('request.body').should('not.have.a.property', 'doi');

compose/neurosynth-frontend/cypress/e2e/pages/PublicStudiesPage.cy.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export {};
77
const PATH = '/base-studies';
88
const PAGE_NAME = 'StudiesPage';
99

10-
describe.skip(PAGE_NAME, () => {
10+
describe(PAGE_NAME, () => {
1111
beforeEach(() => {
1212
cy.clearLocalStorage();
1313
cy.intercept('GET', 'https://api.appzi.io/**', { fixture: 'appzi' }).as('appziFixture');
@@ -16,7 +16,7 @@ describe.skip(PAGE_NAME, () => {
1616
it('should load successfully', () => {
1717
cy.intercept('GET', `**/api/projects*`).as('realProjectsRequest');
1818
cy.intercept('GET', `**/api/base-studies/**`).as('realStudiesRequest');
19-
cy.visit(PATH).wait('@realStudiesRequest');
19+
cy.visit(PATH);
2020
});
2121

2222
// describe('Search', () => {

compose/neurosynth-frontend/cypress/e2e/workflows/Extraction/ExtractionTable.cy.tsx

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import { INeurosynthProjectReturn } from 'hooks/projects/useGetProjects';
44
import { StudyReturn, StudysetReturn } from 'neurostore-typescript-sdk';
55
import { IExtractionTableStudy } from 'pages/Extraction/components/ExtractionTable';
6+
import { getAuthorShortName } from 'pages/Extraction/components/ExtractionTable.helpers';
67

78
describe('ExtractionTable', () => {
89
beforeEach(() => {
@@ -303,7 +304,12 @@ describe('ExtractionTable', () => {
303304

304305
cy.get('tbody > tr').each((tr, index) => {
305306
cy.wrap(tr).within(() => {
306-
cy.get('td').eq(2).should('have.text', sortedStudies[index].authors);
307+
cy.get('td')
308+
.eq(2)
309+
.should(
310+
'have.text',
311+
getAuthorShortName(sortedStudies?.[index]?.authors || '')
312+
);
307313
});
308314
});
309315
});
@@ -324,7 +330,12 @@ describe('ExtractionTable', () => {
324330

325331
cy.get('tbody > tr').each((tr, index) => {
326332
cy.wrap(tr).within(() => {
327-
cy.get('td').eq(2).should('have.text', sortedStudies[index].authors);
333+
cy.get('td')
334+
.eq(2)
335+
.should(
336+
'have.text',
337+
getAuthorShortName(sortedStudies?.[index]?.authors || '')
338+
);
328339
});
329340
});
330341
});

compose/neurosynth-frontend/cypress/e2e/workflows/MetaAnalyses/CreateSpecificationDialog.cy.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ describe('CreateSpecificationDialog', () => {
4040
cy.contains('FDRCorrector').should('exist');
4141
});
4242

43-
it.only('should step through the wizard', () => {
43+
it('should step through the wizard', () => {
4444
cy.intercept('POST', '**/api/specifications', {
4545
id: 'mockedSpecificationId',
4646
}).as('createSpecificationFixture');

compose/neurosynth-frontend/cypress/e2e/workflows/SleuthImport/DoSleuthImport.cy.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,7 @@ describe('DoSleuthImport', () => {
433433
});
434434

435435
describe('edge cases', () => {
436-
it.only('should apply the pubmed details to the study if a matching pubmed study is found', () => {
436+
it('should apply the pubmed details to the study if a matching pubmed study is found', () => {
437437
// this stuff exists just to make sure cypress doesnt send any real requests. They are not under test
438438
// synth API responses
439439
cy.intercept('POST', `${neurostoreAPIBaseURL}/analyses/**`, {

compose/neurosynth-frontend/src/App.spec.tsx

Lines changed: 0 additions & 17 deletions
This file was deleted.

compose/neurosynth-frontend/src/App.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,16 @@ import useGoogleAnalytics from 'hooks/useGoogleAnalytics';
55
import { SnackbarKey, SnackbarProvider } from 'notistack';
66
import { useEffect, useRef } from 'react';
77
import { QueryCache, QueryClient, QueryClientProvider } from 'react-query';
8-
import Navbar from './components/Navbar/Navbar';
8+
import Navbar from 'components/Navbar/Navbar';
99
import useGetToken from './hooks/useGetToken';
10-
import BaseNavigation from './pages/BaseNavigation/BaseNavigation';
10+
import BaseNavigation from 'pages/BaseNavigation/BaseNavigation';
1111
import { useLocation } from 'react-router-dom';
1212

1313
const queryClient = new QueryClient({
1414
defaultOptions: {
1515
queries: {
1616
retry: 0,
17+
refetchOnWindowFocus: false,
1718
// staleTime: 5000, // https://tkdodo.eu/blog/practical-react-query#the-defaults-explained
1819
},
1920
},

compose/neurosynth-frontend/src/__mocks__/@auth0/auth0-react.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ const useAuth0 = jest.fn().mockReturnValue({
55
loginWithPopup: jest.fn(),
66
logout: jest.fn(),
77
isAuthenticated: false,
8+
isLoading: false,
89
user: {
910
sub: 'some-github-user',
1011
},
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
const useSnackbar = jest.fn().mockReturnValue({
2+
enqueueSnackbar: jest.fn(),
3+
});
4+
5+
export { useSnackbar };

0 commit comments

Comments
 (0)