diff --git a/cypress/utils/setup-utils.js b/cypress/utils/setup-utils.js index e29ae7f4c15..3bca0ccf94b 100644 --- a/cypress/utils/setup-utils.js +++ b/cypress/utils/setup-utils.js @@ -44,13 +44,17 @@ const archivePatients = (resData) => { } }) } + +const ghostIntoOrganization = () => { + cy.task("getSpecName") + .then((res) => getOrganizationByName(`${res}-org`)) + .then((res) => accessOrganization(res.body.data.organization.externalId)) +} export const setupOrgAndFacility = () => { cy.task("getSpecName") .then((res) => getOrganizationByName(`${res}-org`)) .then((res) => createOrUnDeleteOrg(res.body.data.organization)) - .then(() => cy.task("getSpecName")) - .then((res) => getOrganizationByName(`${res}-org`)) - .then((res) => accessOrganization(res.body.data)) + .then(() => ghostIntoOrganization()) .then((res) => addOrUnarchiveFacility(res.body.data.setCurrentUserTenantDataAccess.organization.facilities)) .then((res) => archivePatients(res.body.data)) }; diff --git a/cypress/utils/testing-data-utils.js b/cypress/utils/testing-data-utils.js index 52e65f96d74..7b2575e83d5 100644 --- a/cypress/utils/testing-data-utils.js +++ b/cypress/utils/testing-data-utils.js @@ -92,7 +92,7 @@ export const accessOrganization = (orgExternalId) => { return cy.makePOSTRequest({ operationName: "SetCurrentUserTenantDataAccess", variables: { - organizationExternalId: orgExternalId.organization.externalId, + organizationExternalId: orgExternalId, }, query: `mutation SetCurrentUserTenantDataAccess( $organizationExternalId: String!