Skip to content

Commit

Permalink
[EASI-2990] Disable forms until all data loaded (#649)
Browse files Browse the repository at this point in the history
* loading state for collaborators

* adding fieldset loading to addCollaborator page

* adding fieldset loading to addCRTDLpage

* adding fieldset loading to addCRTDLpage

* adding fieldset loading to questionandreply

* adding fieldset loading to Basic Task List index

* adding fieldset loading to Basic Overview Task List index

* adding fieldset loading to beneficiaries tasklist index

* adding fieldset loading to beneficiaries people impact tasklist index

* including additional loading states

* adding fieldset disabled loading to the files

* add fieldset disabled loading to select solution index

* add loading disabled to all the things

* add more

* update snaps

* move user event into waitfor function

* Test opsEvalAndLearning spec with disabled form checks

* adding error to the fieldset disabled

* change the way the test is run

* fix collaborator e2e test

* fix discussion e2e test

* Remove commented code

* wip to add loading checks in cypress

* using fieldest disabled based on error or loading instead of removing the entire form

* phased out the query checks

* phased out the query checks

* phased out the query checks in characteristics.spec.js

* change the way the disabled check works

* phasing out the query checks in ParticipantsAndProviders.spec.js

* add additional check in the clickPlanTableByName command

* phased out the query checks in payments.spec.js

* add a few comments for cypress test

* updating snaps

---------

Co-authored-by: Patrick Segura <[email protected]>
  • Loading branch information
garyjzhao and patrickseguraoddball authored Jul 31, 2023
1 parent ae4e0e0 commit aa8875d
Show file tree
Hide file tree
Showing 87 changed files with 20,514 additions and 19,315 deletions.
46 changes: 7 additions & 39 deletions cypress/e2e/characteristics.spec.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,6 @@
import { aliasQuery } from '../support/graphql-test-utils';

describe('The Model Plan General Characteristics Form', () => {
beforeEach(() => {
cy.localLogin({ name: 'MINT', role: 'MINT_USER_NONPROD' });

cy.intercept('POST', '/api/graph/query', req => {
aliasQuery(req, 'GetGeneralCharacteristics');
aliasQuery(req, 'GetKeyCharacteristics');
aliasQuery(req, 'GetInvolvements');
aliasQuery(req, 'GetTargetsAndOptions');
aliasQuery(req, 'GetAuthority');
});
});

it('completes a Model Plan Characteristics', () => {
Expand All @@ -19,19 +9,14 @@ describe('The Model Plan General Characteristics Form', () => {
// Clicks the General Charactstics tasklist item
cy.get('[data-testid="characteristics"]').click();

// Page - /characteristics

cy.location().should(loc => {
expect(loc.pathname).to.match(
/\/models\/.{36}\/task-list\/characteristics/
);
});

// Page - /characteristics

cy.wait('@GetGeneralCharacteristics')
.its('response.statusCode')
.should('eq', 200)
.wait(100);

cy.get('[data-testid="model-plan-name"]').contains('for Empty Plan');

cy.get('#plan-characteristics-is-new-model-no')
Expand Down Expand Up @@ -74,13 +59,8 @@ describe('The Model Plan General Characteristics Form', () => {

// Page - /characteristics/key-charactertics

cy.wait('@GetKeyCharacteristics')
.its('response.statusCode')
.should('eq', 200)
.wait(100);

cy.get('#plan-characteristics-alternative-payment-MIPS')
.check({ force: true })
.should('not.be.disabled')
.check({ force: true })
.should('be.checked');

Expand All @@ -90,6 +70,7 @@ describe('The Model Plan General Characteristics Form', () => {

cy.get('#plan-characteristics-key-characteristics').within(() => {
cy.get("input[type='text']")
.should('not.be.disabled')
.type('payment')
.should('have.value', 'payment');
});
Expand All @@ -108,13 +89,8 @@ describe('The Model Plan General Characteristics Form', () => {

// Page - /characteristics/involvements

cy.wait('@GetInvolvements')
.its('response.statusCode')
.should('eq', 200)
.wait(100);

cy.get('#plan-characteristics-care-coordination-involved')
.check({ force: true })
.should('not.be.disabled')
.check({ force: true })
.should('be.checked');

Expand Down Expand Up @@ -148,12 +124,8 @@ describe('The Model Plan General Characteristics Form', () => {

// Page - /characteristics/targets-and-options

cy.wait('@GetTargetsAndOptions')
.its('response.statusCode')
.should('eq', 200)
.wait(100);

cy.get('#plan-characteristics-geographies-targeted')
.should('not.be.disabled')
.check({ force: true })
.should('be.checked');

Expand Down Expand Up @@ -189,12 +161,8 @@ describe('The Model Plan General Characteristics Form', () => {

// Page - /characteristics/authority

cy.wait('@GetAuthority')
.its('response.statusCode')
.should('eq', 200)
.wait(100);

cy.get('#plan-characteristics-rulemaking-required')
.should('not.be.disabled')
.check({ force: true })
.should('be.checked');

Expand Down
12 changes: 9 additions & 3 deletions cypress/e2e/collaborator.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,11 @@ describe('The Collaborator/Team Member Form', () => {

cy.get('#react-select-model-team-cedar-contact-input')
.click()
.type('Jerry{enter}', { delay: 500 })
.should('have.value', 'Jerry Seinfeld, SF13');
.type('Jerry', { delay: 1000 });

cy.get('#react-select-model-team-cedar-contact-option-0')
.contains('Jerry Seinfeld, SF13')
.click();

cy.contains('button', 'Add team member').should('be.disabled');

Expand Down Expand Up @@ -57,7 +60,10 @@ describe('The Collaborator/Team Member Form', () => {

cy.get('input').should('be.disabled');

cy.get('select').select('Model Team').should('have.value', 'MODEL_TEAM');
cy.get('select')
.should('not.be.disabled')
.select('Model Team')
.should('have.value', 'MODEL_TEAM');

cy.contains('button', 'Update team member').click();

Expand Down
1 change: 1 addition & 0 deletions cypress/e2e/discussions.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ describe('Discussion Center', () => {
cy.contains('button', 'Save answer').should('be.disabled');

cy.get('#discussion-content')
.should('not.be.disabled')
.type('Model characteristics is located within the task list.')
.should(
'have.value',
Expand Down
2 changes: 2 additions & 0 deletions cypress/e2e/filterGroups.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ describe('Filter Group in Read Only Sections', () => {
cy.get('#read-only-side-nav__wrapper').should('not.exist');
cy.get('.filtered-view-section--model-team').should('exist');

// Clear filter after viewing the CCW filtered group view

cy.get('[data-testid="group-filter-banner"]').within(() => {
cy.get('button').contains('Clear filter').click();
});
Expand Down
79 changes: 12 additions & 67 deletions cypress/e2e/modelPlan.spec.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,6 @@
import { aliasQuery } from '../support/graphql-test-utils';
import verifyStatus from '../support/verifyRequestStatus';

describe('The Model Plan Form', () => {
beforeEach(() => {
cy.localLogin({ name: 'MINT', role: 'MINT_USER_NONPROD' });

cy.intercept('POST', '/api/graph/query', req => {
aliasQuery(req, 'GetModelPlan');
aliasQuery(req, 'GetIsCollaborator');
aliasQuery(req, 'GetModelPlanBase');
aliasQuery(req, 'GetModelCollaborators');
aliasQuery(req, 'GetModelPlanInfo');
aliasQuery(req, 'GetBasics');
aliasQuery(req, 'GetMilestones');
aliasQuery(req, 'GetAllModelPlans');
});
});

it('fills out model plan name and creates plan', () => {
Expand All @@ -32,57 +18,38 @@ describe('The Model Plan Form', () => {

cy.contains('button', 'Next').click();

cy.wait([
'@GetIsCollaborator',
'@GetModelPlanBase',
'@GetModelCollaborators'
])
.then(verifyStatus)
.wait(500);

cy.location().should(loc => {
expect(loc.pathname).to.match(/\/models\/.{36}\/collaborators/);
});

cy.get('[data-testid="continue-to-tasklist"]').click();

cy.wait('@GetModelPlan')
.its('response.statusCode')
.should('eq', 200)
.wait(500);
cy.get('[data-testid="page-loading"]').should('not.exist');

cy.contains('h1', 'Model Plan task list');
cy.get('[data-testid="continue-to-tasklist"]').click();

// renames a model plan
cy.location().should(loc => {
expect(loc.pathname).to.match(/\/models\/.{36}\/task-list/);
});

cy.contains('h1', 'Model Plan task list');

cy.contains('h3', 'Model basics');

cy.contains('button', 'Start').click();

cy.wait('@GetModelPlanInfo')
.its('response.statusCode')
.should('eq', 200)
.wait(500);

cy.location().should(loc => {
expect(loc.pathname).to.match(/\/models\/.{36}\/task-list\/basics/);
});

cy.get('[data-testid="fieldset"]').should('not.be.disabled');

cy.get('#plan-basics-model-name')
.clear()
.type('Renamed Model Plan Name')
.should('have.value', 'Renamed Model Plan Name');

cy.contains('button', 'Save and return to task list').click();

cy.wait('@GetModelPlan')
.its('response.statusCode')
.should('eq', 200)
.wait(500);

cy.location().should(loc => {
expect(loc.pathname).to.match(/\/models\/.{36}\/task-list/);
});
Expand All @@ -94,10 +61,7 @@ describe('The Model Plan Form', () => {

cy.get('[data-testid="basics"]').click();

cy.wait('@GetModelPlanInfo')
.its('response.statusCode')
.should('eq', 200)
.wait(500);
cy.get('[data-testid="fieldset"]').should('not.be.disabled');

cy.get('#plan-basics-abbreviation').type('RMP').should('have.value', 'RMP');

Expand All @@ -119,17 +83,14 @@ describe('The Model Plan Form', () => {

cy.contains('button', 'Next').click();

cy.wait('@GetBasics')
.its('response.statusCode')
.should('eq', 200)
.wait(500);

cy.location().should(loc => {
expect(loc.pathname).to.match(
/\/models\/.{36}\/task-list\/basics\/overview/
);
});

cy.get('[data-testid="fieldset"]').should('not.be.disabled');

cy.get('#ModelType-Voluntary').check({ force: true }).should('be.checked');

cy.get('#ModelType-Problem')
Expand All @@ -149,17 +110,14 @@ describe('The Model Plan Form', () => {

cy.contains('button', 'Next').click();

cy.wait('@GetMilestones')
.its('response.statusCode')
.should('eq', 200)
.wait(500);

cy.location().should(loc => {
expect(loc.pathname).to.match(
/\/models\/.{36}\/task-list\/basics\/milestones/
);
});

cy.get('[data-testid="fieldset"]').should('not.be.disabled');

cy.contains('h3', 'Anticipated high level timeline');

cy.get('#Milestone-completeICIP')
Expand Down Expand Up @@ -202,11 +160,6 @@ describe('The Model Plan Form', () => {

cy.contains('button', 'Save and return to task list').click();

cy.wait('@GetModelPlan')
.its('response.statusCode')
.should('eq', 200)
.wait(500);

cy.location().should(loc => {
expect(loc.pathname).to.match(/\/models\/.{36}\/task-list/);
});
Expand Down Expand Up @@ -240,11 +193,6 @@ describe('The Model Plan Form', () => {
.should('be.not.disabled')
.click();

cy.wait('@GetModelPlan')
.its('response.statusCode')
.should('eq', 200)
.wait(500);

cy.location().should(loc => {
expect(loc.pathname).to.match(/\/models\/.{36}\/task-list/);
});
Expand All @@ -254,10 +202,7 @@ describe('The Model Plan Form', () => {
// favorites and unfavorites a model plan
cy.visit('/models');

cy.wait('@GetAllModelPlans')
.its('response.statusCode')
.should('eq', 200)
.wait(500);
cy.get('[data-testid="page-loading"]').should('not.exist');

cy.contains('tr', 'Empty Plan').get('[data-cy="favorited"]');

Expand Down
Loading

0 comments on commit aa8875d

Please sign in to comment.