Skip to content

Commit

Permalink
chore: appzi changes and merged in master
Browse files Browse the repository at this point in the history
  • Loading branch information
nicoalee committed Oct 22, 2024
2 parents 0c27a34 + f8591a5 commit 161d5fd
Show file tree
Hide file tree
Showing 71 changed files with 2,873 additions and 779 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ describe(PAGE_NAME, () => {
cy.intercept('GET', `**/api/base-studies/**`, {
fixture: 'study',
}).as('studyFixture');
cy.visit(PATH).wait('@semanticScholarFixture').wait('@studyFixture');
// .get('tr')
// .eq(2)
// .click()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ describe(PAGE_NAME, () => {
.wait('@studyFixture')
.wait('@projectFixture')
.wait('@annotationFixture')
.wait('@semanticScholarFixture')
.wait('@studysetFixture');
});

Expand All @@ -48,15 +47,14 @@ describe(PAGE_NAME, () => {
.wait('@studyFixture')
.wait('@projectFixture')
.wait('@annotationFixture')
.wait('@semanticScholarFixture')
.wait('@studysetFixture');

// ACT
cy.get('div').contains('(name, authors, description, doi, pmid, etc)').click();
cy.contains('label', 'doi').next().clear();
cy.contains('label', 'pmid').next().clear();
cy.contains('label', 'pmcid').next().clear();
cy.contains('button', 'save').click();
cy.get('[data-testid="SaveIcon"]').click();

// ASSERT
cy.get('@editStudy').its('request.body').should('not.have.a.property', 'doi');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export {};
const PATH = '/base-studies';
const PAGE_NAME = 'StudiesPage';

describe.skip(PAGE_NAME, () => {
describe(PAGE_NAME, () => {
beforeEach(() => {
cy.clearLocalStorage();
cy.intercept('GET', 'https://api.appzi.io/**', { fixture: 'appzi' }).as('appziFixture');
Expand All @@ -16,7 +16,7 @@ describe.skip(PAGE_NAME, () => {
it('should load successfully', () => {
cy.intercept('GET', `**/api/projects*`).as('realProjectsRequest');
cy.intercept('GET', `**/api/base-studies/**`).as('realStudiesRequest');
cy.visit(PATH).wait('@realStudiesRequest');
cy.visit(PATH);
});

// describe('Search', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import { INeurosynthProjectReturn } from 'hooks/projects/useGetProjects';
import { StudyReturn, StudysetReturn } from 'neurostore-typescript-sdk';
import { IExtractionTableStudy } from 'pages/Extraction/components/ExtractionTable';
import { getAuthorShortName } from 'pages/Extraction/components/ExtractionTable.helpers';

describe('ExtractionTable', () => {
beforeEach(() => {
Expand Down Expand Up @@ -303,7 +304,12 @@ describe('ExtractionTable', () => {

cy.get('tbody > tr').each((tr, index) => {
cy.wrap(tr).within(() => {
cy.get('td').eq(2).should('have.text', sortedStudies[index].authors);
cy.get('td')
.eq(2)
.should(
'have.text',
getAuthorShortName(sortedStudies?.[index]?.authors || '')
);
});
});
});
Expand All @@ -324,7 +330,12 @@ describe('ExtractionTable', () => {

cy.get('tbody > tr').each((tr, index) => {
cy.wrap(tr).within(() => {
cy.get('td').eq(2).should('have.text', sortedStudies[index].authors);
cy.get('td')
.eq(2)
.should(
'have.text',
getAuthorShortName(sortedStudies?.[index]?.authors || '')
);
});
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ describe('CreateSpecificationDialog', () => {
fixture: 'projects/projectCanCreateSpecification',
}).as('projectFixture');
cy.intercept('GET', `**/api/studysets/*`, { fixture: 'studyset' }).as('studysetFixture');
cy.intercept('GET', '**/api/annotations/*', { fixture: 'annotation' }).as(
'annotationFixture'
);
});

it('should show the dialog', () => {
Expand All @@ -23,5 +26,51 @@ describe('CreateSpecificationDialog', () => {
cy.contains('button', 'Meta-Analyses').click();
cy.contains('button', 'Meta-Analysis Specification').click();
cy.get('.MuiDialog-container').should('be.visible');
cy.contains('button', 'Back').should('be.disabled');
});

it('should set the default specification values', () => {
cy.login('mocked', { sub: 'github|26612023' })
.visit('/projects/abc123')
.wait('@projectFixture');
cy.contains('button', 'Meta-Analyses').click();
cy.contains('button', 'Meta-Analysis Specification').click();
cy.get('.MuiDialog-container').should('be.visible');
cy.contains('MKDADensity').should('exist');
cy.contains('FDRCorrector').should('exist');
});

it('should step through the wizard', () => {
cy.intercept('POST', '**/api/specifications', {
id: 'mockedSpecificationId',
}).as('createSpecificationFixture');
cy.intercept('POST', '**/api/studysets', {
id: 'mockedStudySetId',
});
cy.intercept('POST', '**/api/annotations', {
id: 'mockedAnnotationId',
});
cy.intercept('POST', '**/api/meta-analyses', {
id: 'mockedMetaAnalysisId',
specification: {},
});
cy.intercept('GET', '**/api/specifications/*', {
fixture: 'specification',
});

cy.intercept('GET', '**/api/meta-analyses/mockedMetaAnalysisId*', {
fixture: 'metaAnalysis',
}).as('metaAnalysesFixture');

cy.login('mocked', { sub: 'github|26612023' })
.visit('/projects/abc123')
.wait('@projectFixture');
cy.contains('button', 'Meta-Analyses').click();
cy.contains('button', 'Meta-Analysis Specification').click();
cy.contains('Next').click();
cy.contains('included').should('exist');
cy.contains('button', 'Next').click();
cy.contains('button', 'Next').click();
cy.contains('button', 'Create Meta-Analysis Specification').click();
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ describe('DoSleuthImport', () => {
});

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

0 comments on commit 161d5fd

Please sign in to comment.