Skip to content
This repository has been archived by the owner on Oct 20, 2022. It is now read-only.

Commit

Permalink
Merge pull request #862 from UserOfficeProject/release-14-04-2022
Browse files Browse the repository at this point in the history
Release 14 04 2022
  • Loading branch information
ACLay authored Apr 19, 2022
2 parents ab79372 + 9a99807 commit 5478429
Show file tree
Hide file tree
Showing 103 changed files with 2,871 additions and 1,378 deletions.
197 changes: 136 additions & 61 deletions cypress/integration/SEP.ts

Large diffs are not rendered by default.

91 changes: 91 additions & 0 deletions cypress/integration/experiments.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
import initialDBData from '../support/initialDBData';

context('Experiments tests', () => {
before(() => {
cy.resetDB(true);
});

beforeEach(() => {
cy.viewport(1920, 1080);
cy.resetDB(true);
cy.updateProposalManagementDecision({
proposalPk: initialDBData.proposal.id,
statusId: 1,
managementTimeAllocation: 5,
managementDecisionSubmitted: true,
});
cy.createEsi({
scheduledEventId: initialDBData.scheduledEvents.upcoming.id,
});
cy.createVisit({
scheduledEventId: initialDBData.scheduledEvents.upcoming.id,
team: [initialDBData.users.user1.id],
teamLeadUserId: initialDBData.users.user1.id,
});
});

describe('Experiments tests', () => {
it('Can filter by call and instrument', () => {
cy.login('officer');
cy.visit('/');
cy.get('[data-cy=officer-menu-items]').contains('Experiments').click();
cy.get('[value=NONE]').click();

cy.get('[data-cy=call-filter]').click();
cy.get('[role=presentation]').contains('call 1').click();
cy.contains('1-4 of 4');

cy.get('[data-cy=instrument-filter]').click();
cy.get('[role=presentation]').contains('Instrument 3').click();
cy.contains('0-0 of 0');

cy.get('[data-cy=instrument-filter]').click();
cy.get('[role=presentation]').contains('Instrument 2').click();
cy.contains('0-0 of 0');

cy.get('[data-cy=instrument-filter]').click();
cy.get('[role=presentation]').contains('Instrument 1').click();
cy.contains('1-4 of 4');
});

it('Can filter by date', () => {
cy.login('officer');
cy.visit('/');
cy.get('[data-cy=officer-menu-items]').contains('Experiments').click();

cy.get('[value=TODAY]').click();
cy.contains('0-0 of 0');

cy.get('[value=NONE]').click();
cy.contains('1-4 of 4');
});

it('Can view ESI', () => {
cy.login('officer');
cy.visit('/');
cy.get('[data-cy=officer-menu-items]').contains('Experiments').click();
cy.get('[value=NONE]').click();

cy.get('[data-cy=officer-scheduled-events-table]')
.contains('View ESI')
.click();
cy.get('[role=dialog]').contains(initialDBData.proposal.title);
});

it('Can view visits', () => {
cy.login('officer');
cy.visit('/');
cy.get('[data-cy=officer-menu-items]').contains('Experiments').click();
cy.get('[value=NONE]').click();

cy.finishedLoading();

cy.get('[data-cy=officer-scheduled-events-table] Table button')
.first()
.click();
cy.get('[data-cy=officer-scheduled-events-table]').contains(
initialDBData.users.user1.lastName
);
});
});
});
4 changes: 4 additions & 0 deletions cypress/integration/institutions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ context('Institution tests', () => {
cy.contains('Institutions').click();
cy.contains('Create').click();
cy.get('#name').type(name);
cy.get('#country-input').click();
cy.contains('Sweden').click();
cy.get('[data-cy="submit"]').click();

cy.notification({ variant: 'success', text: 'successfully' });
Expand Down Expand Up @@ -59,6 +61,8 @@ context('Institution tests', () => {
cy.get('[aria-label="Edit"]').first().click();
cy.get('#name').clear();
cy.get('#name').type(name);
cy.get('#country-input').click();
cy.contains('Great Britain').click();
cy.get('[data-cy="submit"]').click();

cy.notification({ variant: 'success', text: 'successfully' });
Expand Down
141 changes: 122 additions & 19 deletions cypress/integration/instruments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ context('Instrument tests', () => {
cy.contains(instrument1.name);
cy.contains(instrument1.shortCode);
cy.contains(instrument1.description);
cy.contains(scientist1.lastName);
});

it('User Officer should be able to update Instrument', () => {
Expand Down Expand Up @@ -150,7 +149,7 @@ context('Instrument tests', () => {

describe('Advanced instruments tests as user officer role', () => {
let createdInstrumentId: number;
let createdProposalId: number;
let createdProposalPk: number;

beforeEach(() => {
cy.updateUserRoles({
Expand All @@ -170,10 +169,10 @@ context('Instrument tests', () => {
});
cy.createProposal({ callId: initialDBData.call.id }).then((result) => {
if (result.createProposal.proposal) {
createdProposalId = result.createProposal.proposal.primaryKey;
createdProposalPk = result.createProposal.proposal.primaryKey;

cy.updateProposal({
proposalPk: createdProposalId,
proposalPk: createdProposalPk,
title: proposal1.title,
abstract: proposal1.abstract,
});
Expand Down Expand Up @@ -204,7 +203,7 @@ context('Instrument tests', () => {

cy.get('#selectedInstrumentId-input').first().click();

cy.get("[id='menu-selectedInstrumentId'] li")
cy.get('[data-cy="instrument-selection-options"] li')
.contains(instrument1.name)
.click();

Expand All @@ -227,7 +226,14 @@ context('Instrument tests', () => {

cy.contains('Loading...').should('not.exist');

cy.get('[data-cy="clear-selection"]').click();
cy.get('[data-cy="instrument-selection"] input').should(
'have.value',
instrument1.name
);

cy.get('[data-cy="instrument-selection"] input').click();

cy.get('[title="Clear"]').click();

cy.get('[data-cy="remove-instrument-alert"]').should('exist');

Expand Down Expand Up @@ -272,15 +278,15 @@ context('Instrument tests', () => {
});
cy.assignProposalsToInstrument({
proposals: [
{ callId: initialDBData.call.id, primaryKey: createdProposalId },
{ callId: initialDBData.call.id, primaryKey: createdProposalPk },
],
instrumentId: createdInstrumentId,
});

cy.login(scientist2);

cy.addProposalTechnicalReview({
proposalPk: createdProposalId,
proposalPk: createdProposalPk,
reviewerId: scientist2.id,
submitted: true,
status: TechnicalReviewStatus.FEASIBLE,
Expand Down Expand Up @@ -314,20 +320,20 @@ context('Instrument tests', () => {
});
cy.assignProposalsToInstrument({
proposals: [
{ callId: initialDBData.call.id, primaryKey: createdProposalId },
{ callId: initialDBData.call.id, primaryKey: createdProposalPk },
],
instrumentId: createdInstrumentId,
});

cy.updateTechnicalReviewAssignee({
proposalPks: [createdProposalId],
proposalPks: [createdProposalPk],
userId: scientist2.id,
});

cy.login(scientist2);

cy.addProposalTechnicalReview({
proposalPk: createdProposalId,
proposalPk: createdProposalPk,
reviewerId: scientist2.id,
submitted: true,
status: TechnicalReviewStatus.FEASIBLE,
Expand Down Expand Up @@ -437,7 +443,8 @@ context('Instrument tests', () => {

describe('Instruments tests as instrument scientist role', () => {
let createdInstrumentId: number;
let createdProposalId: number;
let createdProposalPk: number;
let createdProposalId: string;

beforeEach(() => {
cy.updateUserRoles({
Expand Down Expand Up @@ -477,23 +484,24 @@ context('Instrument tests', () => {
});
cy.createProposal({ callId: initialDBData.call.id }).then((result) => {
if (result.createProposal.proposal) {
createdProposalId = result.createProposal.proposal.primaryKey;
createdProposalPk = result.createProposal.proposal.primaryKey;
createdProposalId = result.createProposal.proposal.proposalId;

cy.updateProposal({
proposalPk: createdProposalId,
proposalPk: createdProposalPk,
title: proposal1.title,
abstract: proposal1.abstract,
});

cy.assignProposalsToInstrument({
proposals: [
{ callId: initialDBData.call.id, primaryKey: createdProposalId },
{ callId: initialDBData.call.id, primaryKey: createdProposalPk },
],
instrumentId: createdInstrumentId,
});

cy.updateTechnicalReviewAssignee({
proposalPks: [createdProposalId],
proposalPks: [createdProposalPk],
userId: scientist2.id,
});
}
Expand Down Expand Up @@ -563,17 +571,17 @@ context('Instrument tests', () => {
it('Instrument scientist should be able to download multiple proposals as PDF', () => {
cy.createProposal({ callId: initialDBData.call.id }).then((result) => {
if (result.createProposal.proposal) {
createdProposalId = result.createProposal.proposal.primaryKey;
createdProposalPk = result.createProposal.proposal.primaryKey;

cy.updateProposal({
proposalPk: createdProposalId,
proposalPk: createdProposalPk,
title: proposal2.title,
abstract: proposal2.abstract,
});

cy.assignProposalsToInstrument({
proposals: [
{ callId: initialDBData.call.id, primaryKey: createdProposalId },
{ callId: initialDBData.call.id, primaryKey: createdProposalPk },
],
instrumentId: createdInstrumentId,
});
Expand Down Expand Up @@ -728,5 +736,100 @@ context('Instrument tests', () => {
.find('[data-cy="view-proposal-and-technical-review"]')
.should('not.exist');
});

it('Technical review assignee should be able to bulk submit technical reviews and see warning if some required info is missing ', () => {
cy.createProposal({ callId: initialDBData.call.id }).then((result) => {
if (result.createProposal.proposal) {
const createdProposal2Id = result.createProposal.proposal.primaryKey;

cy.updateProposal({
proposalPk: createdProposal2Id,
title: proposal2.title,
abstract: proposal2.abstract,
});

cy.assignProposalsToInstrument({
proposals: [
{ callId: initialDBData.call.id, primaryKey: createdProposal2Id },
],
instrumentId: createdInstrumentId,
});

cy.updateTechnicalReviewAssignee({
proposalPks: [createdProposal2Id],
userId: scientist2.id,
});

cy.addProposalTechnicalReview({
proposalPk: createdProposal2Id,
status: TechnicalReviewStatus.FEASIBLE,
timeAllocation: 1,
reviewerId: scientist2.id,
submitted: false,
});
}
});
selectAllProposalsFilterStatus();

cy.contains(proposal1.title)
.parent()
.find('input[type="checkbox"]')
.click();

cy.contains(proposal2.title)
.parent()
.find('input[type="checkbox"]')
.click();

cy.get('[data-cy="submit-proposal-reviews"]').click();

cy.get('[role="presentation"] [role="alert"] .MuiAlert-message')
.should('exist')
.and('include.text', createdProposalId);

cy.get('[data-cy="confirm-cancel"]').click();

cy.contains(proposal1.title)
.parent()
.find('[data-cy="edit-technical-review"]')
.click();

cy.get('[data-cy="technical-review-status"]').click();
cy.get('[data-cy="technical-review-status-options"]')
.contains('Feasible')
.click();
cy.get('[data-cy="timeAllocation"] input').type('10');

cy.get('[data-cy="save-technical-review"]').click();

cy.notification({
text: 'Technical review updated successfully',
variant: 'success',
});

cy.closeModal();

cy.get('[data-cy="submit-proposal-reviews"]').click();

cy.get('[role="presentation"] [role="alert"] .MuiAlert-message').should(
'not.exist'
);

cy.get('[data-cy="confirm-ok"]').click();

cy.notification({
text: 'Proposals technical review submitted successfully',
variant: 'success',
});

cy.contains(proposal1.title)
.parent()
.find('[data-cy="view-proposal-and-technical-review"]')
.should('exist');
cy.contains(proposal2.title)
.parent()
.find('[data-cy="view-proposal-and-technical-review"]')
.should('exist');
});
});
});
8 changes: 5 additions & 3 deletions cypress/integration/proposal_administration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,15 @@ context('Proposal administration tests', () => {
cy.get('[data-cy=view-proposal]').click();
cy.finishedLoading();
cy.get('[role="dialog"]').contains('Admin').click();
cy.get('#finalStatus-input').should('exist');
cy.get('[data-cy="proposal-final-status"]').should('exist');
cy.get('[role="dialog"]').contains('Logs').click();
cy.get('[role="dialog"]').contains('Admin').click();

cy.get('#finalStatus-input').click();
cy.get('[data-cy="proposal-final-status"]').click();

cy.get('[data-value="ACCEPTED"]').click();
cy.get('[data-cy="proposal-final-status-options"] li')
.contains('Accepted')
.click();

cy.get('[data-cy="managementTimeAllocation"] input')
.clear()
Expand Down
Loading

0 comments on commit 5478429

Please sign in to comment.