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

Add Prettier for Frontend Code Consistency #836

Merged
merged 1 commit into from
Mar 20, 2024
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
8 changes: 8 additions & 0 deletions frontend/.prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"singleQuote": false,
"useTabs": false,
"tabWidth": 2,
"semi": true,
"jsxSingleQuote": false,
"printWidth": 80
}
2 changes: 1 addition & 1 deletion frontend/cypress.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const { defineConfig } = require('cypress')
const { defineConfig } = require("cypress");

module.exports = defineConfig({
viewportWidth: 1200,
Expand Down
22 changes: 10 additions & 12 deletions frontend/cypress/common/TestProperties.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
class TestProperties {
DEFAULT_USERNAME = "admin";
DEFAULT_PASSWORD = "adminADMIN!";
TEST_SERVER_URL = "https://openelis28.openelis-global.org/";

DEFAULT_USERNAME = "admin";
DEFAULT_PASSWORD = "adminADMIN!";
TEST_SERVER_URL = "https://openelis28.openelis-global.org/";
constructor() {}

constructor() {
}
getUsername() {
return this.DEFAULT_USERNAME;
}

getUsername() {
return this.DEFAULT_USERNAME
}

getPassword() {
return this.DEFAULT_PASSWORD
}
getPassword() {
return this.DEFAULT_PASSWORD;
}
}

export default TestProperties;
63 changes: 32 additions & 31 deletions frontend/cypress/e2e/login.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,36 +2,37 @@ import LoginPage from "../pages/LoginPage";

const login = new LoginPage();

describe('Failing or Succeeding to Login', function () {

before("User visits login page", () => {
login.visit();
// login.acceptSelfAssignedCert();
});

after('Close Browser', () => {
cy.clearLocalStorage();
})

it('Should validate user authentication', function () {
cy.fixture('Users').then((users) => {
users.forEach((user) => {
login.enterUsername(user.username);
login.getUsernameElement().should('contain.value', user.username)

login.enterPassword(user.password);
login.getPasswordElement().should('contain.value', user.password);
login.signIn();

if (user.correctPass === true) {
cy.get('header#mainHeader > button[title=\'Open menu\']').should('exist')
.and('span:nth-of-type(3) > .cds--btn.cds--btn--icon-only.cds--btn--primary.cds--header__action > svg > path:nth-of-type(1)', 'exist');
} else {
cy.get('div[role=\'status\']').should('be.visible');
}
});
});
describe("Failing or Succeeding to Login", function () {
before("User visits login page", () => {
login.visit();
// login.acceptSelfAssignedCert();
});

after("Close Browser", () => {
cy.clearLocalStorage();
});

it("Should validate user authentication", function () {
cy.fixture("Users").then((users) => {
users.forEach((user) => {
login.enterUsername(user.username);
login.getUsernameElement().should("contain.value", user.username);

login.enterPassword(user.password);
login.getPasswordElement().should("contain.value", user.password);
login.signIn();

if (user.correctPass === true) {
cy.get("header#mainHeader > button[title='Open menu']")
.should("exist")
.and(
"span:nth-of-type(3) > .cds--btn.cds--btn--icon-only.cds--btn--primary.cds--header__action > svg > path:nth-of-type(1)",
"exist",
);
} else {
cy.get("div[role='status']").should("be.visible");
}
});
});


});
});
114 changes: 61 additions & 53 deletions frontend/cypress/e2e/orderEntity.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,68 +5,76 @@ let loginPage = null;
let orderEntityPage = null;
let patientEntryPage = null;

before('login', () => {
loginPage = new LoginPage();
loginPage.visit();
before("login", () => {
loginPage = new LoginPage();
loginPage.visit();
});

describe('Order Entity', function () {
it('User Visits Home Page and goes to Order entity Page ', function () {
homePage = loginPage.goToHomePage();
orderEntityPage = homePage.goToOrderPage();
});

it('Should search patient in the search box', function () {
patientEntryPage = orderEntityPage.getPatientPage();
cy.wait(1000);
cy.fixture('Patient').then((patient) => {
patientEntryPage.searchPatientByFirstAndLastName(patient.firstName, patient.lastName);
patientEntryPage.clickSearchPatientButton();
patientEntryPage.validatePatientSearchTable(patient.firstName, patient.inValidName);
patientEntryPage.selectPatientFromSearchResults();
cy.wait(200);
patientEntryPage.getFirstName().should('have.value', patient.firstName)
patientEntryPage.getLastName().should('have.value', patient.lastName)
});
});
describe("Order Entity", function () {
it("User Visits Home Page and goes to Order entity Page ", function () {
homePage = loginPage.goToHomePage();
orderEntityPage = homePage.goToOrderPage();
});

it('User should click next to go to program selection', function () {
orderEntityPage.clickNextButton();
cy.wait(1000);
orderEntityPage.clickNextButton();
it("Should search patient in the search box", function () {
patientEntryPage = orderEntityPage.getPatientPage();
cy.wait(1000);
cy.fixture("Patient").then((patient) => {
patientEntryPage.searchPatientByFirstAndLastName(
patient.firstName,
patient.lastName,
);
patientEntryPage.clickSearchPatientButton();
patientEntryPage.validatePatientSearchTable(
patient.firstName,
patient.inValidName,
);
patientEntryPage.selectPatientFromSearchResults();
cy.wait(200);
patientEntryPage.getFirstName().should("have.value", patient.firstName);
patientEntryPage.getLastName().should("have.value", patient.lastName);
});
});

it('User should select sample type option', function () {
cy.fixture('Order').then((order) => {
order.samples.forEach((sample) => {
orderEntityPage.selectSampleTypeOption(sample.sampleType);
orderEntityPage.checkPanelCheckBoxField();
})
});
cy.wait(1000);
orderEntityPage.clickNextButton();
it("User should click next to go to program selection", function () {
orderEntityPage.clickNextButton();
cy.wait(1000);
orderEntityPage.clickNextButton();
});

it("User should select sample type option", function () {
cy.fixture("Order").then((order) => {
order.samples.forEach((sample) => {
orderEntityPage.selectSampleTypeOption(sample.sampleType);
orderEntityPage.checkPanelCheckBoxField();
});
});
cy.wait(1000);
orderEntityPage.clickNextButton();
});

it('Should click generate Lab Order Number', function () {
orderEntityPage.generateLabOrderNumber();
cy.wait(1000);
});
it("Should click generate Lab Order Number", function () {
orderEntityPage.generateLabOrderNumber();
cy.wait(1000);
});

it('should Enter or select site name', function () {
cy.scrollTo('top');
cy.wait(1000);
cy.fixture('Order').then((order) => {
orderEntityPage.enterSiteName(order.siteName);
});
it("should Enter or select site name", function () {
cy.scrollTo("top");
cy.wait(1000);
cy.fixture("Order").then((order) => {
orderEntityPage.enterSiteName(order.siteName);
});
});

it('should enter requester first and last name\'s', function () {
cy.fixture('Order').then((order) => {
orderEntityPage.enterRequesterLastAndFirstName(order.requester.firstName, order.requester.lastName)
});
});
it('should click submit order button', function () {
orderEntityPage.clickSubmitOrderButton();
it("should enter requester first and last name's", function () {
cy.fixture("Order").then((order) => {
orderEntityPage.enterRequesterLastAndFirstName(
order.requester.firstName,
order.requester.lastName,
);
});
});
});
it("should click submit order button", function () {
orderEntityPage.clickSubmitOrderButton();
});
});
145 changes: 78 additions & 67 deletions frontend/cypress/e2e/patientEntry.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,76 +4,87 @@ let homePage = null;
let loginPage = null;
let patientPage = null;

before('login', () => {
loginPage = new LoginPage();
loginPage.visit();
before("login", () => {
loginPage = new LoginPage();
loginPage.visit();
});
describe('Patient Search', function () {

it('User Visits Home Page and goes to Add Add|Modify Patient Page', () => {
homePage = loginPage.goToHomePage();
patientPage = homePage.goToPatientEntry();
});

it('Add|Modify Patient page should appear with search field', function () {
patientPage.getPatientEntryPageTitle().should('contain.text', 'Add/Modify Patient');
});

it('User should be able to navigate to create Patient tab', function () {
patientPage.clickNewPatientTab();
patientPage.getSubmitButton().should('be.visible');
describe("Patient Search", function () {
it("User Visits Home Page and goes to Add Add|Modify Patient Page", () => {
homePage = loginPage.goToHomePage();
patientPage = homePage.goToPatientEntry();
});

it("Add|Modify Patient page should appear with search field", function () {
patientPage
.getPatientEntryPageTitle()
.should("contain.text", "Add/Modify Patient");
});

it("User should be able to navigate to create Patient tab", function () {
patientPage.clickNewPatientTab();
patientPage.getSubmitButton().should("be.visible");
});

it("User should enter patient Information", function () {
cy.fixture("Patient").then((patient) => {
patientPage.enterPatientInfo(
patient.firstName,
patient.lastName,
patient.subjectNumber,
patient.nationalId,
patient.DOB,
);
});

it('User should enter patient Information', function () {
cy.fixture('Patient').then((patient) => {
patientPage.enterPatientInfo(patient.firstName, patient.lastName, patient.subjectNumber, patient.nationalId, patient.DOB)
});
});
it('User should click save new patient information button', function () {
patientPage.clickSavePatientButton();
cy.wait(1000);
cy.get('div[role=\'status\']').should('be.visible');
cy.wait(200).reload();
});

it('Should be able to search patients By gender', function () {
cy.wait(1000);
patientPage.getMaleGenderRadioButton().should('be.visible');
patientPage.getMaleGenderRadioButton().click();
cy.wait(200)
patientPage.clickSearchPatientButton();
cy.fixture('Patient').then((patient) => {
patientPage.validatePatientByGender("M");
});
cy.wait(200).reload();
});
it("User should click save new patient information button", function () {
patientPage.clickSavePatientButton();
cy.wait(1000);
cy.get("div[role='status']").should("be.visible");
cy.wait(200).reload();
});

it("Should be able to search patients By gender", function () {
cy.wait(1000);
patientPage.getMaleGenderRadioButton().should("be.visible");
patientPage.getMaleGenderRadioButton().click();
cy.wait(200);
patientPage.clickSearchPatientButton();
cy.fixture("Patient").then((patient) => {
patientPage.validatePatientByGender("M");
});

it('Should search Patient By First and LastName', function () {
cy.wait(1000);
cy.fixture('Patient').then((patient) => {
patientPage.searchPatientByFirstAndLastName(patient.firstName, patient.lastName)
patientPage.getFirstName().should('have.value', patient.firstName)
patientPage.getLastName().should('have.value', patient.lastName)

patientPage.getLastName().should('not.have.value', patient.inValidName)

patientPage.clickSearchPatientButton();
patientPage.validatePatientSearchTable(patient.firstName, patient.inValidName);
});
cy.wait(200).reload();
cy.wait(200).reload();
});

it("Should search Patient By First and LastName", function () {
cy.wait(1000);
cy.fixture("Patient").then((patient) => {
patientPage.searchPatientByFirstAndLastName(
patient.firstName,
patient.lastName,
);
patientPage.getFirstName().should("have.value", patient.firstName);
patientPage.getLastName().should("have.value", patient.lastName);

patientPage.getLastName().should("not.have.value", patient.inValidName);

patientPage.clickSearchPatientButton();
patientPage.validatePatientSearchTable(
patient.firstName,
patient.inValidName,
);
});


it('should search patient By PatientId', function () {
cy.wait(1000);
cy.fixture('Patient').then((patient) => {
patientPage.searchPatientByPatientId(patient.nationalId);
patientPage.clickSearchPatientButton();
patientPage.validatePatientSearchTable(patient.firstName, patient.inValidName);
});
cy.wait(200).reload();
});

it("should search patient By PatientId", function () {
cy.wait(1000);
cy.fixture("Patient").then((patient) => {
patientPage.searchPatientByPatientId(patient.nationalId);
patientPage.clickSearchPatientButton();
patientPage.validatePatientSearchTable(
patient.firstName,
patient.inValidName,
);
});


});
});


Loading
Loading