Skip to content

Commit

Permalink
feat: updated tabs and button styling
Browse files Browse the repository at this point in the history
  • Loading branch information
nicoalee committed Jul 22, 2024
1 parent 9e34c88 commit 1ab3f8a
Show file tree
Hide file tree
Showing 5 changed files with 437 additions and 24 deletions.
33 changes: 25 additions & 8 deletions compose/neurosynth-frontend/cypress/e2e/pages/ProjectPage.cy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,24 @@ describe(PAGE_NAME, () => {
beforeEach(() => {
cy.clearLocalStorage().clearSessionStorage();
cy.intercept('GET', 'https://api.appzi.io/**', { fixture: 'appzi' }).as('appziFixture');
cy.intercept('POST', `https://www.google-analytics.com/*/**`, {}).as(
'googleAnalyticsFixture'
);
cy.intercept('GET', `**/api/studysets/*`, { fixture: 'studyset' }).as('studysetFixture');
cy.intercept('PUT', `**/api/projects/*`, { fixture: 'projects/projectPut' }).as(
'updateProjectFixture'
);
cy.intercept('GET', `**/api/projects/*`, {
fixture: 'ProjectPage/projectAtExtraction',
}).as('projectFixture');
});

it('should load successfully', () => {
cy.intercept('GET', `**/api/projects/*`, { fixture: 'projects/projectExtractionStep' }).as(
'projectFixture'
);
cy.visit(PATH).wait('@projectFixture');
});

it.only('should set the project from private to public when logged in and you own the project', () => {
it('should set the project from private to public when logged in and you own the project', () => {
cy.login('mocked');
cy.intercept('GET', `**/api/projects/*`, {
fixture: 'projects/projectExtractionStep',
}).as('projectFixture');
cy.visit(PATH).wait('@projectFixture');
cy.contains('button', 'Public').click();
cy.wait('@updateProjectFixture').then((res) => {
Expand All @@ -37,7 +37,7 @@ describe(PAGE_NAME, () => {

it('should set the project from public to private when logged in and you own the project', () => {
cy.login('mocked');
cy.fixture('projects/projectExtractionStep').then((projectFixture) => {
cy.fixture('ProjectPage/projectWithMetaAnalyses').then((projectFixture) => {
projectFixture.public = true;
cy.intercept('GET', `**/api/projects/*`, projectFixture).as('projectFixturePublic');
});
Expand All @@ -48,4 +48,21 @@ describe(PAGE_NAME, () => {
assert.isFalse(res.request.body.public);
});
});

it('should show both tabs for projects that can access meta-analyses', () => {
cy.intercept('GET', `**/api/projects/*`, {
fixture: 'ProjectPage/projectWithMetaAnalyses',
}).as('projectFixture');
cy.login('mocked');
cy.visit(PATH).wait('@projectFixture');
cy.get('button').contains('Project');
cy.get('button').contains('Meta-Analyses');
});

it('should not show the meta-analyses tab if the project has not reached that step', () => {
cy.login('mocked');
cy.visit(PATH).wait('@projectFixture');
cy.get('button').contains('Project');
cy.get('button').should('not.contain', 'Meta-Analyses');
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
{
"created_at": "2023-11-02T15:48:04.630172+00:00",
"description": "this is a bulk import test",
"id": "abc123",
"meta_analyses": ["3xHJJQWFURob"],
"name": "Bulk import test",
"neurostore_study": {
"created_at": "2023-11-02T15:48:04.640598+00:00",
"exception": null,
"neurostore_id": "7BrAuwJ2tjPW",
"status": "PENDING",
"traceback": null,
"updated_at": "2023-11-02T15:48:04.653465+00:00"
},
"neurostore_url": "https://neurostore.org/api/studies/7BrAuwJ2tjPW",
"provenance": {
"curationMetadata": {
"columns": [
{
"id": "370ba40c-91e8-47e7-9b4d-926bc8f31d10",
"name": "not included",
"stubStudies": []
},
{
"id": "1f15d9a7-968e-44a6-8574-caa3794e050e",
"name": "included",
"stubStudies": []
}
],
"exclusionTags": [
{
"id": "neurosynth_exclude_exclusion",
"isAssignable": true,
"isExclusionTag": true,
"label": "Exclude"
},
{
"id": "neurosynth_duplicate_exclusion",
"isAssignable": true,
"isExclusionTag": true,
"label": "Duplicate"
}
],
"identificationSources": [
{
"id": "neurosynth_neurostore_id_source",
"label": "Neurostore"
},
{
"id": "neurosynth_pubmed_id_source",
"label": "PubMed"
},
{
"id": "neurosynth_scopus_id_source",
"label": "Scopus"
},
{
"id": "neurosynth_web_of_science_id_source",
"label": "Web of Science"
},
{
"id": "neurosynth_psycinfo_id_source",
"label": "PsycInfo"
}
],
"infoTags": [
{
"id": "neurosynth_untagged_tag",
"isAssignable": false,
"isExclusionTag": false,
"label": "Untagged studies"
},
{
"id": "neurosynth_uncategorized_tag",
"isAssignable": false,
"isExclusionTag": false,
"label": "Uncategorized Studies"
},
{
"id": "neurosynth_needs_review_tag",
"isAssignable": false,
"isExclusionTag": false,
"label": "Needs Review"
},
{
"id": "6f299c47-766c-48bd-a56b-9c77019ea9de",
"isAssignable": true,
"isExclusionTag": false,
"label": "marijuana"
}
],
"prismaConfig": {
"eligibility": {
"exclusionTags": []
},
"identification": {
"exclusionTags": []
},
"isPrisma": false,
"screening": {
"exclusionTags": []
}
}
},
"extractionMetadata": {
"annotationId": "5LSBDTGqA6RF",
"studyStatusList": [],
"studysetId": "73HRs8HaJbR8"
},
"metaAnalysisMetadata": {
"canEditMetaAnalyses": false
}
},
"public": false,
"updated_at": "2023-11-02T19:42:04.265234+00:00",
"user": "auth0|62e0e6c9dd47048572613b4d",
"username": "Test User"
}
Loading

0 comments on commit 1ab3f8a

Please sign in to comment.