Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OH2-248 | Fix e2e tests #530

Merged
merged 1 commit into from
Nov 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
REACT_APP_USE_MOCK_API=
REACT_APP_USE_MOCK_API=false
REACT_APP_ENABLE_PERMISSIONS=true
4 changes: 2 additions & 2 deletions cypress/integration/edit_patient_activity.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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]")
Expand Down
8 changes: 4 additions & 4 deletions cypress/integration/new_patient_activity.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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]")
Expand Down Expand Up @@ -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", "");
Expand All @@ -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");
});
});
8 changes: 4 additions & 4 deletions cypress/plugins/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
});
}
};
2 changes: 1 addition & 1 deletion src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down
2 changes: 1 addition & 1 deletion src/libraries/permissionUtils/usePermission.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
Loading