Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DCJ-212] Refactor ResearcherInfo.js to JSX #2560

Merged
merged 5 commits into from
May 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 17 additions & 17 deletions cypress/component/DataAccessRequest/researcher_info.spec.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable no-undef */
import {React} from 'react';
import {mount} from 'cypress/react';
import ResearcherInfo from '../../../src/pages/dar_application/ResearcherInfo.js';
import ResearcherInfo from '../../../src/pages/dar_application/ResearcherInfo';
import { User } from '../../../src/libs/ajax/User';

import {BrowserRouter} from 'react-router-dom';
Expand Down Expand Up @@ -52,7 +52,7 @@ const researcherWithLibraryCards = {
};

const addNewCollaborator = (collaboratorType) => {
cy.get(`[dataCy=${collaboratorType}]`)
cy.get(`[data-cy=${collaboratorType}]`)
.find('.collaborator-list-component')
.find('.row')
.find('.button').click();
Expand Down Expand Up @@ -82,61 +82,61 @@ beforeEach(() => {
describe('Researcher Info', () => {
it('renders the researcher info component', () => {
mount(<WrappedResearcherInfo {...props}/>);
cy.get('[dataCy=researcher-info]').should('be.visible');
cy.get('[data-cy=researcher-info]').should('be.visible');
});

it('renders the missing library cards alert correctly', () => {
const mergedProps = {...props, ...{formData: {...props.formData }}};
mount(<WrappedResearcherInfo {...mergedProps}/>);
cy.get('[dataCy=researcher-info-profile-unsubmitted]').should('not.exist');
cy.get('[dataCy=researcher-info-profile-submitted]').should('be.visible');
cy.get('[data-cy=researcher-info-profile-unsubmitted]').should('not.exist');
cy.get('[data-cy=researcher-info-profile-submitted]').should('be.visible');
});

it('renders the profile submitted alert', () => {
const mergedProps = {...props, ...{completed: true, researcher: researcherWithLibraryCards}};
mount(<WrappedResearcherInfo {...mergedProps}/>);
cy.get('[dataCy=researcher-info-profile-submitted]').should('be.visible');
cy.get('[dataCy=researcher-info-profile-unsubmitted]').should('not.exist');
cy.get('[data-cy=researcher-info-profile-submitted]').should('be.visible');
cy.get('[data-cy=researcher-info-profile-unsubmitted]').should('not.exist');
});

it('renders the profile unsubmitted alert', () => {
const mergedProps = {...props, ...{completed: false, researcher: researcherWithLibraryCards}};
mount(<WrappedResearcherInfo {...mergedProps}/>);
cy.get('[dataCy=researcher-info-profile-unsubmitted]').should('be.visible');
cy.get('[dataCy=researcher-info-profile-submitted]').should('be.visible');
cy.get('[data-cy=researcher-info-profile-unsubmitted]').should('be.visible');
cy.get('[data-cy=researcher-info-profile-submitted]').should('be.visible');
});

it('renders the internal lab staff button and form', () => {
mount(<WrappedResearcherInfo {...props}/>);
cy.get('[dataCy=internal-lab-staff]')
cy.get('[data-cy=internal-lab-staff]')
.find('.collaborator-list-component')
.find('.row')
.find('.button').click();
cy.get('[dataCy=internal-lab-staff]')
cy.get('[data-cy=internal-lab-staff]')
.find('.collaborator-list-component')
.find('.row')
.find('.form-group').should('exist');
});

it('renders the internal collaborator button and form', () => {
mount(<WrappedResearcherInfo {...props}/>);
cy.get('[dataCy=internal-collaborators]')
cy.get('[data-cy=internal-collaborators]')
.find('.collaborator-list-component')
.find('.row')
.find('.button').click();
cy.get('[dataCy=internal-collaborators]')
cy.get('[data-cy=internal-collaborators]')
.find('.collaborator-list-component')
.find('.row')
.find('.form-group').should('exist');
});

it('renders the external collaborator button and form', () => {
mount(<WrappedResearcherInfo {...props}/>);
cy.get('[dataCy=external-collaborators]')
cy.get('[data-cy=external-collaborators]')
.find('.collaborator-list-component')
.find('.row')
.find('.button').click();
cy.get('[dataCy=external-collaborators]')
cy.get('[data-cy=external-collaborators]')
.find('.collaborator-list-component')
.find('.row')
.find('.form-group').should('exist');
Expand Down Expand Up @@ -184,7 +184,7 @@ describe('Researcher Info', () => {
// edit and switch to form view
cy.get('#0_editCollaborator').click();
cy.get('#0_summary').should('not.exist');
cy.get('[dataCy=internal-lab-staff]')
cy.get('[data-cy=internal-lab-staff]')
.find('.collaborator-list-component')
.find('.row')
.find('.form-group').should('exist');
Expand All @@ -199,7 +199,7 @@ describe('Researcher Info', () => {
cy.get('#0_deleteMember').click();
cy.get('.delete-modal-primary-button').click();
cy.get('#0_summary').should('not.exist');
cy.get('[dataCy=internal-lab-staff]')
cy.get('[data-cy=internal-lab-staff]')
.find('.collaborator-list-component')
.find('.row')
.find('.form-group').should('not.exist');
Expand Down
Loading
Loading