diff --git a/services/app-web/src/pages/StateSubmission/Contacts/Contacts.tsx b/services/app-web/src/pages/StateSubmission/Contacts/Contacts.tsx index abd8dd5436..897616e98c 100644 --- a/services/app-web/src/pages/StateSubmission/Contacts/Contacts.tsx +++ b/services/app-web/src/pages/StateSubmission/Contacts/Contacts.tsx @@ -301,7 +301,7 @@ const Contacts = ({ showPageErrorMessage={showPageErrorMessage ?? false} /> - + - + { diff --git a/services/app-web/src/pages/StateSubmission/Documents/Documents.tsx b/services/app-web/src/pages/StateSubmission/Documents/Documents.tsx index e0ece3602b..950221e29e 100644 --- a/services/app-web/src/pages/StateSubmission/Documents/Documents.tsx +++ b/services/app-web/src/pages/StateSubmission/Documents/Documents.tsx @@ -260,7 +260,7 @@ export const Documents = (): React.ReactElement => { showPageErrorMessage={showPageErrorMessage ?? false} /> - + - + { diff --git a/services/app-web/src/pages/StateSubmission/ReviewSubmit/ReviewSubmit.tsx b/services/app-web/src/pages/StateSubmission/ReviewSubmit/ReviewSubmit.tsx index 432f753a38..1d653ee32a 100644 --- a/services/app-web/src/pages/StateSubmission/ReviewSubmit/ReviewSubmit.tsx +++ b/services/app-web/src/pages/StateSubmission/ReviewSubmit/ReviewSubmit.tsx @@ -75,7 +75,7 @@ export const ReviewSubmit = (): React.ReactElement => { /> - + { featureFlags.LINK_RATES.defaultValue ) return ( -
+
- + { }) }) - it('can unlock and resubmit with linked rates', () => { - cy.interceptFeatureFlags({"link-rates": true}) + it.skip('can unlock and resubmit with linked rates', () => { + cy.interceptFeatureFlags({"link-rates": true, '438-attestation': true}) cy.logInAsStateUser() - // fill out an entire submission + // fill out contract details cy.startNewContractAndRatesSubmission() cy.fillOutBaseContractDetails() cy.navigateFormByButtonClick('CONTINUE') + // fill out three rate details - two with child rates AND one with a linked rate cy.findByRole('heading', { level: 2, name: /Rate details/, @@ -244,18 +245,24 @@ describe('CMS user', () => { name: 'Add another rate certification', }).click() cy.findAllByTestId('rate-certification-form').each((form) => - cy.wrap(form).within(() => cy.fillOutNewRateCertification()) + cy.wrap(form).within(() => { + cy.fillOutNewRateCertification(); + }) ) - cy.navigateFormByButtonClick('CONTINUE') + cy.navigateContractRatesFormByButtonClick('CONTINUE') + // fill out the rest of the form cy.findByRole('heading', { level: 2, name: /Contacts/, }).should('exist') cy.fillOutStateContact() - cy.fillOutAdditionalActuaryContact() + // There is a currently bug with actuary contacts with linked rates that makes us delete actuary contacts that aren't even filled out on this page + cy.findAllByRole('button', { name: 'Remove contact' }).last() + .should('exist') + .click() + cy.fillOutAdditionalActuaryContact(); cy.navigateFormByButtonClick('CONTINUE') - cy.findByRole('heading', { level: 2, name: /Supporting documents/, @@ -281,7 +288,7 @@ describe('CMS user', () => { // Login as CMS User cy.logOut() cy.logInAsCMSUser({ initialURL: submissionURL }) - + cy.wait('@fetchContractQuery', { timeout: 20_000 }) // click on the unlock button, type in reason and confirm cy.unlockSubmission() @@ -319,6 +326,7 @@ describe('CMS user', () => { .and('include', 'review-and-submit') cy.navigateFormByDirectLink(reviewURL) + cy.wait('@fetchContractQuery', { timeout: 20_000 }) //Unlock banner for state user to be present with correct data. cy.findByRole('heading', { @@ -362,6 +370,7 @@ describe('CMS user', () => { // Login as CMS User cy.logOut() cy.logInAsCMSUser({ initialURL: submissionURL }) + cy.wait('@fetchContractQuery', { timeout: 20_000 }) // CMS user sees resubmitted submission and active unlock button cy.findByTestId('submission-summary', {timeout: 4_000}).should('exist') @@ -406,6 +415,7 @@ describe('CMS user', () => { cy.logOut() cy.logInAsStateUser() cy.navigateFormByDirectLink(reviewURL) + cy.wait('@fetchContractQuery', { timeout: 20_000 }) cy.findByTestId('unlockedBanner').should('exist') cy.submitStateSubmissionForm({ success: true, diff --git a/services/cypress/support/commands.ts b/services/cypress/support/commands.ts index a6ee4e3422..f82e1f6c44 100644 --- a/services/cypress/support/commands.ts +++ b/services/cypress/support/commands.ts @@ -51,13 +51,13 @@ Cypress.Commands.add('interceptGraphQL', () => { aliasQuery(req, 'fetchHealthPlanPackageWithQuestions') aliasQuery(req, 'indexHealthPlanPackages') aliasQuery(req, 'indexRates') + aliasQuery(req, 'fetchContract') aliasMutation(req, 'createHealthPlanPackage') aliasMutation(req, 'updateHealthPlanFormData') aliasMutation(req, 'submitHealthPlanPackage') aliasMutation(req, 'updateCMSUser') aliasMutation(req, 'createQuestion') aliasMutation(req, 'createQuestionResponse') - aliasMutation(req, 'fetchContract') aliasMutation(req, 'updateDraftContractRates') aliasMutation(req, 'submitContract') }).as('GraphQL') diff --git a/services/cypress/support/index.ts b/services/cypress/support/index.ts index 6eafc7ef05..b5f7b92a46 100644 --- a/services/cypress/support/index.ts +++ b/services/cypress/support/index.ts @@ -75,6 +75,10 @@ declare global { buttonName: FormButtonKey, waitForLoad?: boolean ): void + navigateContractRatesFormByButtonClick( + buttonName: FormButtonKey, + waitForLoad?: boolean + ): void navigateFormByDirectLink(url: string, waitForLoad?: boolean): void // dashboard commands diff --git a/services/cypress/support/navigateCommands.ts b/services/cypress/support/navigateCommands.ts index 9f5e5b5dcb..71832a0e2c 100644 --- a/services/cypress/support/navigateCommands.ts +++ b/services/cypress/support/navigateCommands.ts @@ -44,6 +44,40 @@ Cypress.Commands.add( } } ) +// navigate helper for v2 forms +Cypress.Commands.add( + 'navigateContractRatesFormByButtonClick', + (buttonKey: FormButtonKey, waitForLoad = true) => { + cy.findByRole('button', { + name: buttonsWithLabels[buttonKey], + }).should('not.have.attr', 'aria-disabled') + cy.findByRole('button', { + name: buttonsWithLabels[buttonKey], + }).safeClick() + + if (buttonKey === 'SAVE_DRAFT') { + if(waitForLoad) { + cy.wait('@updateDraftContractRatesMutation', { timeout: 50_000}) + } + cy.findByTestId('state-dashboard-page').should('exist') + cy.findByRole('heading',{name:'Submissions'}).should('exist') + } else if (buttonKey === 'CONTINUE_FROM_START_NEW') { + if (waitForLoad) { + // cy.wait('@createContractMutation', { timeout: 50_000 }) + cy.wait('@fetchContractQuery') + } + cy.findByTestId('state-submission-form-page').should('exist') + } else if (buttonKey === 'CONTINUE') { + if (waitForLoad) { + cy.findAllByTestId('errorMessage').should('have.length', 0) + cy.wait('@updateDraftContractRatesMutation', { timeout: 50_000}) + } + cy.findByTestId('state-submission-form-page').should('exist') + } else { + cy.findByTestId('state-submission-form-page').should('exist') + } + } +) Cypress.Commands.add( 'navigateFormByDirectLink', diff --git a/services/cypress/support/stateSubmissionFormCommands.ts b/services/cypress/support/stateSubmissionFormCommands.ts index c38e3ee267..a2c84f2843 100644 --- a/services/cypress/support/stateSubmissionFormCommands.ts +++ b/services/cypress/support/stateSubmissionFormCommands.ts @@ -318,13 +318,30 @@ Cypress.Commands.add('fillOutAmendmentToBaseContractDetails', () => { Cypress.Commands.add('fillOutNewRateCertification', () => { // Must be on '/submissions/:id/edit/rate-details' // Must be a contract and rates submission - cy.findByRole('radiogroup', { - name: /Was this rate certification uploaded to any other submissions?/, - }) - .should('exist') - .within(() => { - cy.findByText(/No/).click() + cy.getFeatureFlagStore(['link-rates']).then((store) => { + + if (store['link-rates']) { + //If this flag value is true, then it will test this code hidden behind the feature flag + cy.findByRole('radiogroup', { + name: /Was this rate certification included with another submission?/, }) + .should('exist') + .within(() => { + cy.findByText('No, this rate certification was not included with any other submissions').click() + }) + + } else { + // otherwise use legacy packages with shared rates UI + cy.findByRole('radiogroup', { + name: /Was this rate certification uploaded to any other submissions?/, + }) + .should('exist') + .within(() => { + cy.findByText(/No/).click() + }) + + } + cy.findByText('New rate certification').click() cy.findByText( @@ -362,19 +379,21 @@ Cypress.Commands.add('fillOutNewRateCertification', () => { cy.waitForDocumentsToLoad() cy.findAllByTestId('errorMessage').should('have.length', 0) }) +}) Cypress.Commands.add('fillOutLinkedRate', () => { // Must be on '/submissions/:id/edit/rate-details' // Must be a contract and rates submission - cy.findByRole('radiogroup', { - name: /Was this rate certification uploaded to any other submissions?/, - }) - .should('exist') - .within(() => { - cy.findByText('Yes, this rate certification is part of another submissio').click() - }) cy.getFeatureFlagStore(['link-rates']).then((store) => { //If this flag value is true, then it will test this code hidden behind the feature flag + cy.findByRole('radiogroup', { + name: /Was this rate certification included with another submission?/, + }) + .should('exist') + .within(() => { + cy.findByText('Yes, this rate certification is part of another submission').click() + }) + if (store['link-rates']) { cy.findByRole('combobox', { name: 'Which rate certification was it?' }).click({ force: true, @@ -387,7 +406,6 @@ Cypress.Commands.add('fillOutLinkedRate', () => { cy.waitForDocumentsToLoad() cy.findAllByTestId('errorMessage').should('have.length', 0) }) - cy.findAllByTestId('errorMessage').should('have.length', 0) }) Cypress.Commands.add('fillOutAmendmentToPriorRateCertification', (id = 0) => { @@ -511,7 +529,8 @@ Cypress.Commands.add( name: 'Submit', }).safeClick() - cy.findAllByTestId('modalWindow') + cy.getFeatureFlagStore(['link-rates']).then((store) => { + cy.findAllByTestId('modalWindow') .eq(1) .should('exist') .within(() => { @@ -519,16 +538,35 @@ Cypress.Commands.add( cy.get('#unlockSubmitModalInput').type( summary || 'Resubmission summary' ) - cy.findByTestId('resubmit-modal-submit').click() + if (store['link-rates']) { + cy.findByTestId('resubmit_contract-modal-submit').click() + }else { + cy.findByTestId('resubmit-modal-submit').click() + } } else { - cy.findByTestId('submit-modal-submit').click() + + if (store['link-rates']) { + cy.findByTestId('submit_contract-modal-submit').click() + }else { + cy.findByTestId('submit-modal-submit').click() + } + } }) - cy.wait('@submitHealthPlanPackageMutation', { timeout: 50_000 }) + + if (store['link-rates']) { + cy.wait('@submitContractMutation', { timeout: 50_000 }) + } else { + cy.wait('@submitHealthPlanPackageMutation', { timeout: 50_000 }) + } + + if (success) { cy.findByTestId('state-dashboard-page').should('exist') cy.findByRole('heading',{name:'Submissions'}).should('exist') } + }) + } )