diff --git a/.env b/.env index e4013ba18..da5570f6e 100644 --- a/.env +++ b/.env @@ -1,2 +1,2 @@ -REACT_APP_USE_MOCK_API= +REACT_APP_USE_MOCK_API=false REACT_APP_ENABLE_PERMISSIONS=true \ No newline at end of file diff --git a/cypress/integration/edit_patient_activity.spec.js b/cypress/integration/edit_patient_activity.spec.js index 47beddfe0..36c871938 100644 --- a/cypress/integration/edit_patient_activity.spec.js +++ b/cypress/integration/edit_patient_activity.spec.js @@ -43,8 +43,8 @@ describe("EditPatientActivity spec", () => { "images/profilePicture.jpg", { force: true } ); - - cy.get("[class=MuiDialogContent-root]").contains("Confirm").click(); + cy.get(".MuiDialogContent-root .MuiButton-containedPrimary").click(); + cy.wait(2000); cy.wait(1000); cy.get("[class=profilePicture]") diff --git a/cypress/integration/new_patient_activity.spec.js b/cypress/integration/new_patient_activity.spec.js index 91fc300cc..1d9907571 100644 --- a/cypress/integration/new_patient_activity.spec.js +++ b/cypress/integration/new_patient_activity.spec.js @@ -43,8 +43,8 @@ describe("NewPatientActivity spec", () => { "images/profilePicture.jpg", { force: true } ); - - cy.get("[class=MuiDialogContent-root]").contains("Confirm").click(); + cy.get(".MuiDialogContent-root .MuiButton-containedPrimary").click(); + cy.wait(2000); cy.wait(1000); cy.get("[class=profilePicture]") @@ -114,7 +114,7 @@ describe("NewPatientActivity spec", () => { }); it("should reset the form if the user chooses to keep editing after a submit", () => { - cy.get("div.dialog__buttonSet").contains("Keep editing").click(); + cy.get("div.dialog__buttonSet").contains("Add Another Patient").click(); cy.get("[id=firstName]").should("have.value", ""); cy.get("[id=secondName]").should("have.value", ""); cy.get("[id=birthDate]").should("have.value", ""); @@ -129,7 +129,7 @@ describe("NewPatientActivity spec", () => { cy.get(".MuiSelect-select[id=sex]").click(); cy.get(".MuiMenu-list li[data-value=M]").click(); cy.get("[class=patientDataForm]").contains("Submit").click(); - cy.get("div.dialog__buttonSet").contains("Dashboard").click(); + cy.get("div.dialog__buttonSet").contains("Go to home").click(); cy.get("div.dashboard"); }); }); diff --git a/cypress/plugins/index.js b/cypress/plugins/index.js index 87ee913c6..c1df1092b 100644 --- a/cypress/plugins/index.js +++ b/cypress/plugins/index.js @@ -19,10 +19,10 @@ module.exports = (on, config) => { // `on` is used to hook into various events Cypress emits // `config` is the resolved Cypress config - on('before:browser:launch', (browser = {}, launchOptions) => { - if (browser.name === 'chrome') { - launchOptions.args.push('--lang=en'); + on("before:browser:launch", (browser = {}, launchOptions) => { + if (browser.name === "chrome") { + launchOptions.args.push("--lang=en"); return launchOptions; } }); -} +}; diff --git a/src/index.tsx b/src/index.tsx index d37ee229d..4d028976c 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -34,7 +34,7 @@ import hospital from "./state/hospital/reducer"; import layouts from "./state/layouts/reducer"; import dashboard from "./state/dashboard/reducer"; -if (process.env.REACT_APP_USE_MOCK_API) { +if (process.env.REACT_APP_USE_MOCK_API === "true") { console.log("Using mocked api"); makeServer(); } diff --git a/src/libraries/permissionUtils/usePermission.ts b/src/libraries/permissionUtils/usePermission.ts index 245491cdc..b1d03973c 100644 --- a/src/libraries/permissionUtils/usePermission.ts +++ b/src/libraries/permissionUtils/usePermission.ts @@ -7,7 +7,7 @@ import { usePermissions } from "./usePermissions"; */ export const usePermission = (name: TPermission): boolean => { const permissions = usePermissions(); - if (!process.env.REACT_APP_ENABLE_PERMISSIONS) { + if (process.env.REACT_APP_ENABLE_PERMISSIONS === "false") { return true; } return Boolean(permissions.find((permission: string) => permission === name));