From 7e8f8061871108a9ab2bb87bb3cb0d849c7d3aa3 Mon Sep 17 00:00:00 2001 From: manishjha-04 Date: Sun, 31 Mar 2024 14:15:25 +0530 Subject: [PATCH 1/9] added local host as testurl and minor fixes --- frontend/cypress.config.js | 2 +- frontend/cypress/common/TestProperties.js | 2 +- frontend/cypress/e2e/patientEntry.cy.js | 2 +- frontend/cypress/fixtures/Order.json | 8 +++++++- frontend/cypress/fixtures/Patient.json | 4 +++- frontend/cypress/pages/OrderEntityPage.js | 2 +- 6 files changed, 14 insertions(+), 6 deletions(-) diff --git a/frontend/cypress.config.js b/frontend/cypress.config.js index ed7ff15565..e2724e2783 100755 --- a/frontend/cypress.config.js +++ b/frontend/cypress.config.js @@ -7,7 +7,7 @@ module.exports = defineConfig({ setupNodeEvents(on, config) { // implement node event listeners here }, - baseUrl: "https://openelis28.openelis-global.org", + baseUrl: "https://localhost", testIsolation: false, }, }); diff --git a/frontend/cypress/common/TestProperties.js b/frontend/cypress/common/TestProperties.js index bb8313d1b2..3b8c527ce8 100755 --- a/frontend/cypress/common/TestProperties.js +++ b/frontend/cypress/common/TestProperties.js @@ -1,7 +1,7 @@ class TestProperties { DEFAULT_USERNAME = "admin"; DEFAULT_PASSWORD = "adminADMIN!"; - TEST_SERVER_URL = "https://openelis28.openelis-global.org/"; +TEST_SERVER_URL = "https://localhost/"; constructor() {} diff --git a/frontend/cypress/e2e/patientEntry.cy.js b/frontend/cypress/e2e/patientEntry.cy.js index cc9a84aacc..9450d2353c 100755 --- a/frontend/cypress/e2e/patientEntry.cy.js +++ b/frontend/cypress/e2e/patientEntry.cy.js @@ -17,7 +17,7 @@ describe("Patient Search", function () { it("Add|Modify Patient page should appear with search field", function () { patientPage .getPatientEntryPageTitle() - .should("contain.text", "Add/Modify Patient"); + .should("contain.text", "Add Or Modify Patient"); }); it("User should be able to navigate to create Patient tab", function () { diff --git a/frontend/cypress/fixtures/Order.json b/frontend/cypress/fixtures/Order.json index eabb3fe0a7..8a12eb2ec6 100644 --- a/frontend/cypress/fixtures/Order.json +++ b/frontend/cypress/fixtures/Order.json @@ -8,5 +8,11 @@ "requester": { "firstName": "Optimus", "lastName": "Prime" - } + }, + "labNo": "", + "priority": "", + "requestDate": "", + "receivedDate": "", + "siteName":"", + "testName":"" } diff --git a/frontend/cypress/fixtures/Patient.json b/frontend/cypress/fixtures/Patient.json index 75268c1b27..57005c440b 100644 --- a/frontend/cypress/fixtures/Patient.json +++ b/frontend/cypress/fixtures/Patient.json @@ -4,5 +4,7 @@ "lastName": "Smith", "subjectNumber": "001202782410", "nationalId": "UG-23SLHD7DBD", - "DOB": "12/05/2001" + "DOB": "12/05/2001", + "gender":"Male" + } diff --git a/frontend/cypress/pages/OrderEntityPage.js b/frontend/cypress/pages/OrderEntityPage.js index 704a2eeaaf..f4b8e08cfe 100644 --- a/frontend/cypress/pages/OrderEntityPage.js +++ b/frontend/cypress/pages/OrderEntityPage.js @@ -26,7 +26,7 @@ class OrderEntityPage { ).check({ force: true }); } generateLabOrderNumber() { - cy.getElement(":nth-child(3) > .cds--link").click(); + cy.getElement(":nth-child(2) > .cds--link").click(); } enterSiteName(siteName) { From 6bdb18d574715794b5b8d20207e855bff4497d08 Mon Sep 17 00:00:00 2001 From: manishjha-04 Date: Sun, 31 Mar 2024 15:55:19 +0530 Subject: [PATCH 2/9] coverage for search by accesion number --- frontend/cypress/e2e/modifyOrder.cy.js | 61 +++++++++++++++++++++++ frontend/cypress/e2e/orderEntity.cy.js | 20 +++++++- frontend/cypress/pages/HomePage.js | 7 +++ frontend/cypress/pages/ModifyOrderPage.js | 28 +++++++++++ 4 files changed, 115 insertions(+), 1 deletion(-) create mode 100644 frontend/cypress/e2e/modifyOrder.cy.js create mode 100644 frontend/cypress/pages/ModifyOrderPage.js diff --git a/frontend/cypress/e2e/modifyOrder.cy.js b/frontend/cypress/e2e/modifyOrder.cy.js new file mode 100644 index 0000000000..ef5ca06c0d --- /dev/null +++ b/frontend/cypress/e2e/modifyOrder.cy.js @@ -0,0 +1,61 @@ +import LoginPage from "../pages/LoginPage"; + +let homePage = null; +let loginPage = null; +let modifyOrderPage = null; +let patientPage = null; + +before("login", () => { + loginPage = new LoginPage(); + loginPage.visit(); +}); + +describe("Modify Order search by accession Number", function () { + before(function () { + // Checking if Order Entity tests have passed since if an order is added then only we can search with Lab number + const orderEntityTestsPassed = localStorage.getItem( + "orderEntityTestsPassed", + ); + if (orderEntityTestsPassed !== "true") { + // Skipping tests + this.skip(); + } + }); + + it("User Visits Home Page and goes to Modify Order Page ", function () { + homePage = loginPage.goToHomePage(); + modifyOrderPage = homePage.goToModifyOrderPage(); + }); + + it("User searches with accession number", () => { + cy.fixture("Order").then((order) => { + modifyOrderPage.enterAccessionNo(order.labNo); + }); + modifyOrderPage.clickSubmitButton(); + }); + + it("should check for program selection button ", function () { + modifyOrderPage.checkProgramButton(); + }); + + it("should be able to assign test ", function () { + modifyOrderPage.assignValues(); + }); + + it("User should click next to go add order page and submit the order", function () { + modifyOrderPage.clickNextButton(); + cy.wait(1000); + modifyOrderPage.clickSubmitButton(); + }); + + it("should be able to print barcode", function () { + cy.intercept("POST", "/LabelMakerServlet?labNo=").as("printBarcode"); + cy.get("#submitButton").click(); + cy.wait("@printBarcode").then((interception) => { + expect(interception.response.statusCode).to.eq(200); + }); + }); +}); + + + diff --git a/frontend/cypress/e2e/orderEntity.cy.js b/frontend/cypress/e2e/orderEntity.cy.js index c56900ccb0..b398077a31 100644 --- a/frontend/cypress/e2e/orderEntity.cy.js +++ b/frontend/cypress/e2e/orderEntity.cy.js @@ -53,11 +53,22 @@ describe("Order Entity", function () { orderEntityPage.clickNextButton(); }); - it("Should click generate Lab Order Number", function () { + it("Should click generate Lab Order Number and store it in a fixture", function () { + cy.intercept("POST", "/generateLabOrderNumber").as("generatedOrderNumber"); orderEntityPage.generateLabOrderNumber(); + cy.wait("@generatedOrderNumber").then((interception) => { + const generatedOrderNumber = interception.response.body.orderNumber; + cy.fixture("Order").then((order) => { + order.labNo = generatedOrderNumber; + cy.writeFile("cypress/fixtures/Order.json", order); + }); + }); cy.wait(1000); }); + + + it("should Enter or select site name", function () { cy.scrollTo("top"); cy.wait(1000); @@ -78,3 +89,10 @@ describe("Order Entity", function () { orderEntityPage.clickSubmitOrderButton(); }); }); + +// needed this for modifyorder +after(function () { + if (this.currentTest.state === 'passed') { + localStorage.setItem('orderEntityTestsPassed', 'true'); + } +}); \ No newline at end of file diff --git a/frontend/cypress/pages/HomePage.js b/frontend/cypress/pages/HomePage.js index d28768b53e..519964709a 100755 --- a/frontend/cypress/pages/HomePage.js +++ b/frontend/cypress/pages/HomePage.js @@ -38,6 +38,13 @@ class HomePage { ).click(); return new PatientEntryPage(); } + + goToModifyOrderPage() { + this.openNavigationMenu(); + cy.getElement('li:nth-of-type(1) > .cds--side-nav__submenu > .cds--side-nav__icon.cds--side-nav__icon--small.cds--side-nav__submenu-chevron').click(); + cy.getElement('li:nth-of-type(1) > .cds--side-nav__menu > li:nth-of-type(2) > .cds--side-nav__link').click(); + return new ModifyOrderPage(); +} } export default HomePage; diff --git a/frontend/cypress/pages/ModifyOrderPage.js b/frontend/cypress/pages/ModifyOrderPage.js new file mode 100644 index 0000000000..10aebf0c53 --- /dev/null +++ b/frontend/cypress/pages/ModifyOrderPage.js @@ -0,0 +1,28 @@ +class ModifyOrderPage { + + constructor() { + } + + visit() { + cy.visit('/FindOrder'); + } + + enterAccessionNo(accessionNo) { + cy.enterText('.cds--text-input.cds--text-input--md.cds--text__input', accessionNo); + } + + clickSubmitButton() { + return cy.getElement('.pageContent > div:nth-of-type(2) > .cds--form .cds--btn.cds--btn--primary').click(); + } + + checkProgramButton(){ + cy.get("#myButton").should("be.disabled"); + } + + assignValues(){ + cy.get("#myButton").click(); + + } +} + +export default ModifyOrderPage; \ No newline at end of file From 1d0c561af031048b00a34a000df9e6a10f41cfd2 Mon Sep 17 00:00:00 2001 From: manishjha-04 Date: Sun, 31 Mar 2024 17:47:27 +0530 Subject: [PATCH 3/9] added test for modifyorder --- frontend/cypress/e2e/modifyOrder.cy.js | 102 +++++++++++++++++++--- frontend/cypress/e2e/orderEntity.cy.js | 14 ++- frontend/cypress/fixtures/Order.json | 7 +- frontend/cypress/pages/HomePage.js | 5 +- frontend/cypress/pages/ModifyOrderPage.js | 24 ++++- 5 files changed, 123 insertions(+), 29 deletions(-) diff --git a/frontend/cypress/e2e/modifyOrder.cy.js b/frontend/cypress/e2e/modifyOrder.cy.js index ef5ca06c0d..420492cb9a 100644 --- a/frontend/cypress/e2e/modifyOrder.cy.js +++ b/frontend/cypress/e2e/modifyOrder.cy.js @@ -1,9 +1,10 @@ import LoginPage from "../pages/LoginPage"; +import PatientEntryPage from "../pages/PatientEntryPage"; let homePage = null; let loginPage = null; let modifyOrderPage = null; -let patientPage = null; +let patientPage = new PatientEntryPage(); before("login", () => { loginPage = new LoginPage(); @@ -12,12 +13,10 @@ before("login", () => { describe("Modify Order search by accession Number", function () { before(function () { - // Checking if Order Entity tests have passed since if an order is added then only we can search with Lab number const orderEntityTestsPassed = localStorage.getItem( "orderEntityTestsPassed", ); if (orderEntityTestsPassed !== "true") { - // Skipping tests this.skip(); } }); @@ -34,28 +33,111 @@ describe("Modify Order search by accession Number", function () { modifyOrderPage.clickSubmitButton(); }); - it("should check for program selection button ", function () { + it("should check for program selection button and go to next page ", function () { modifyOrderPage.checkProgramButton(); + modifyOrderPage.clickNextButton(); }); - it("should be able to assign test ", function () { + it("should be able to record", function () { modifyOrderPage.assignValues(); }); it("User should click next to go add order page and submit the order", function () { modifyOrderPage.clickNextButton(); cy.wait(1000); - modifyOrderPage.clickSubmitButton(); + modifyOrderPage.clickNextButton(); }); it("should be able to print barcode", function () { - cy.intercept("POST", "/LabelMakerServlet?labNo=").as("printBarcode"); - cy.get("#submitButton").click(); - cy.wait("@printBarcode").then((interception) => { - expect(interception.response.statusCode).to.eq(200); + cy.window().then((win) => { + cy.spy(win, "open").as("windowOpen"); }); + modifyOrderPage.clickPrintBarcodeButton(); + cy.get("@windowOpen").should( + "be.calledWithMatch", + "/api/OpenELIS-Global/LabelMakerServlet?labNo=", + ); }); }); +describe("Modify Order search by patient ", function () { + it("User Visits Home Page and goes to Modify Order Page ", function () { + homePage = loginPage.goToHomePage(); + modifyOrderPage = homePage.goToModifyOrderPage(); + }); + + 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); + modifyOrderPage.clickSearchPatientButton(); + patientPage.validatePatientSearchTable( + patient.firstName, + patient.inValidName, + ); + }); + 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); + modifyOrderPage.clickSearchPatientButton(); + cy.fixture("Patient").then((patient) => { + patientPage.validatePatientByGender("M"); + }); + cy.wait(200).reload(); + }); + + it("should search patient By PatientId", function () { + cy.wait(1000); + cy.fixture("Patient").then((patient) => { + patientPage.searchPatientByPatientId(patient.nationalId); + modifyOrderPage.clickSearchPatientButton(); + patientPage.validatePatientSearchTable( + patient.firstName, + patient.inValidName, + ); + }); + }); + it("Should be able to search by respective patient ", function () { + cy.wait(1000); + modifyOrderPage.clickRespectivePatient(); + }); + it("should check for program selection button and go to next page ", function () { + modifyOrderPage.checkProgramButton(); + modifyOrderPage.clickNextButton(); + }); + + it("should be able to record", function () { + modifyOrderPage.assignValues(); + }); + + it("User should click next to go add order page and submit the order", function () { + modifyOrderPage.clickNextButton(); + cy.wait(1000); + modifyOrderPage.clickNextButton(); + }); + + it("should be able to print barcode", function () { + cy.window().then((win) => { + cy.spy(win, "open").as("windowOpen"); + }); + modifyOrderPage.clickPrintBarcodeButton(); + cy.get("@windowOpen").should( + "be.calledWithMatch", + "/api/OpenELIS-Global/LabelMakerServlet?labNo=", + ); + }); +}); diff --git a/frontend/cypress/e2e/orderEntity.cy.js b/frontend/cypress/e2e/orderEntity.cy.js index b398077a31..71bd876984 100644 --- a/frontend/cypress/e2e/orderEntity.cy.js +++ b/frontend/cypress/e2e/orderEntity.cy.js @@ -54,10 +54,9 @@ describe("Order Entity", function () { }); it("Should click generate Lab Order Number and store it in a fixture", function () { - cy.intercept("POST", "/generateLabOrderNumber").as("generatedOrderNumber"); orderEntityPage.generateLabOrderNumber(); - cy.wait("@generatedOrderNumber").then((interception) => { - const generatedOrderNumber = interception.response.body.orderNumber; + cy.get("#labNo").then(($input) => { + const generatedOrderNumber = $input.val(); cy.fixture("Order").then((order) => { order.labNo = generatedOrderNumber; cy.writeFile("cypress/fixtures/Order.json", order); @@ -66,9 +65,6 @@ describe("Order Entity", function () { cy.wait(1000); }); - - - it("should Enter or select site name", function () { cy.scrollTo("top"); cy.wait(1000); @@ -92,7 +88,7 @@ describe("Order Entity", function () { // needed this for modifyorder after(function () { - if (this.currentTest.state === 'passed') { - localStorage.setItem('orderEntityTestsPassed', 'true'); + if (this.currentTest.state === "passed") { + localStorage.setItem("orderEntityTestsPassed", "true"); } -}); \ No newline at end of file +}); diff --git a/frontend/cypress/fixtures/Order.json b/frontend/cypress/fixtures/Order.json index 8a12eb2ec6..679538b6ee 100644 --- a/frontend/cypress/fixtures/Order.json +++ b/frontend/cypress/fixtures/Order.json @@ -4,7 +4,7 @@ "sampleType": "Serum" } ], - "siteName": "example site", + "siteName": "279 - CAMES MAN", "requester": { "firstName": "Optimus", "lastName": "Prime" @@ -13,6 +13,5 @@ "priority": "", "requestDate": "", "receivedDate": "", - "siteName":"", - "testName":"" -} + "testName": "" +} \ No newline at end of file diff --git a/frontend/cypress/pages/HomePage.js b/frontend/cypress/pages/HomePage.js index 519964709a..df26530414 100755 --- a/frontend/cypress/pages/HomePage.js +++ b/frontend/cypress/pages/HomePage.js @@ -1,6 +1,7 @@ import LoginPage from "./LoginPage"; import PatientEntryPage from "./PatientEntryPage"; import OrderEntityPage from "./OrderEntityPage"; +import ModifyOrderPage from "./ModifyOrderPage"; class HomePage { constructor() {} @@ -41,8 +42,8 @@ class HomePage { goToModifyOrderPage() { this.openNavigationMenu(); - cy.getElement('li:nth-of-type(1) > .cds--side-nav__submenu > .cds--side-nav__icon.cds--side-nav__icon--small.cds--side-nav__submenu-chevron').click(); - cy.getElement('li:nth-of-type(1) > .cds--side-nav__menu > li:nth-of-type(2) > .cds--side-nav__link').click(); + cy.getElement(':nth-child(1) > .cds--side-nav__item > .cds--side-nav__submenu').click(); + cy.get(':nth-child(1) > .cds--side-nav__item > .cds--side-nav__menu > :nth-child(7) > .cds--side-nav__link > .cds--side-nav__link-text > [style="display: flex; width: 100%;"] > .custom-sidenav-button').click(); return new ModifyOrderPage(); } } diff --git a/frontend/cypress/pages/ModifyOrderPage.js b/frontend/cypress/pages/ModifyOrderPage.js index 10aebf0c53..9192652aba 100644 --- a/frontend/cypress/pages/ModifyOrderPage.js +++ b/frontend/cypress/pages/ModifyOrderPage.js @@ -12,16 +12,32 @@ class ModifyOrderPage { } clickSubmitButton() { - return cy.getElement('.pageContent > div:nth-of-type(2) > .cds--form .cds--btn.cds--btn--primary').click(); + return cy.getElement('div[class=\'cds--lg:col-span-2 cds--css-grid-column\'] button[type=\'submit\']').should('be.visible').click(); + + } + + clickNextButton(){ + return cy.get('.forwardButton').should('be.visible').click(); } + checkProgramButton(){ - cy.get("#myButton").should("be.disabled"); + return cy.get('#additionalQuestionsSelect').should("be.disabled"); } - assignValues(){ - cy.get("#myButton").click(); + assignValues() { + cy.get(':nth-child(1) > :nth-child(4) > .cds--form-item > .cds--checkbox-label').click(); + } + + clickPrintBarcodeButton(){ + return cy.get('.orderEntrySuccessMsg > :nth-child(3) > .cds--btn').click(); + } + clickSearchPatientButton(){ + return cy.get('.searchActionButtons > .cds--btn--primary').click(); + } + clickRespectivePatient(){ + return cy.get(':nth-child(1) > :nth-child(1) > .cds--radio-button-wrapper > .cds--radio-button__label > .cds--radio-button__appearance').click(); } } From 8318b855967e434db08b8021f502736e82e38a79 Mon Sep 17 00:00:00 2001 From: manishjha-04 Date: Sun, 31 Mar 2024 17:50:37 +0530 Subject: [PATCH 4/9] updating .gitignore --- frontend/.gitignore | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/frontend/.gitignore b/frontend/.gitignore index 24cdedf82f..d859ddf275 100644 --- a/frontend/.gitignore +++ b/frontend/.gitignore @@ -20,4 +20,7 @@ npm-debug.log* yarn-debug.log* -yarn-error.log* \ No newline at end of file +yarn-error.log* + +/cypress/videos/ +cypress/screenshots/ \ No newline at end of file From 599d66dac2d59324c2f3dac1b703706e36bccc65 Mon Sep 17 00:00:00 2001 From: manishjha-04 Date: Sun, 31 Mar 2024 18:11:51 +0530 Subject: [PATCH 5/9] fixing minor bug --- frontend/cypress/e2e/modifyOrder.cy.js | 12 ++++++------ frontend/cypress/e2e/orderEntity.cy.js | 5 ++++- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/frontend/cypress/e2e/modifyOrder.cy.js b/frontend/cypress/e2e/modifyOrder.cy.js index 420492cb9a..6725e6d7bf 100644 --- a/frontend/cypress/e2e/modifyOrder.cy.js +++ b/frontend/cypress/e2e/modifyOrder.cy.js @@ -13,12 +13,12 @@ before("login", () => { describe("Modify Order search by accession Number", function () { before(function () { - const orderEntityTestsPassed = localStorage.getItem( - "orderEntityTestsPassed", - ); - if (orderEntityTestsPassed !== "true") { - this.skip(); - } + cy.fixture("Order").then((order) => { + const orderEntityTestsPassed = order.orderEntityTestsPassed; + if (orderEntityTestsPassed !== true) { + this.skip(); + } + }); }); it("User Visits Home Page and goes to Modify Order Page ", function () { diff --git a/frontend/cypress/e2e/orderEntity.cy.js b/frontend/cypress/e2e/orderEntity.cy.js index 71bd876984..99c8460afa 100644 --- a/frontend/cypress/e2e/orderEntity.cy.js +++ b/frontend/cypress/e2e/orderEntity.cy.js @@ -89,6 +89,9 @@ describe("Order Entity", function () { // needed this for modifyorder after(function () { if (this.currentTest.state === "passed") { - localStorage.setItem("orderEntityTestsPassed", "true"); + cy.fixture("Order").then((order) => { + order.orderEntityTestsPassed = true; + cy.writeFile("cypress/fixtures/Order.json", order); + }); } }); From 8596652cb6520350c424f38201695a2bfd76306f Mon Sep 17 00:00:00 2001 From: manishjha-04 Date: Sun, 31 Mar 2024 19:09:10 +0530 Subject: [PATCH 6/9] check by labno instead of boolean --- frontend/cypress/e2e/modifyOrder.cy.js | 4 ++-- frontend/cypress/e2e/orderEntity.cy.js | 10 +--------- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/frontend/cypress/e2e/modifyOrder.cy.js b/frontend/cypress/e2e/modifyOrder.cy.js index 6725e6d7bf..bc913b03a0 100644 --- a/frontend/cypress/e2e/modifyOrder.cy.js +++ b/frontend/cypress/e2e/modifyOrder.cy.js @@ -14,8 +14,8 @@ before("login", () => { describe("Modify Order search by accession Number", function () { before(function () { cy.fixture("Order").then((order) => { - const orderEntityTestsPassed = order.orderEntityTestsPassed; - if (orderEntityTestsPassed !== true) { + const labNo = order.labNo; + if (labNo == null) { this.skip(); } }); diff --git a/frontend/cypress/e2e/orderEntity.cy.js b/frontend/cypress/e2e/orderEntity.cy.js index 99c8460afa..9e2552fed3 100644 --- a/frontend/cypress/e2e/orderEntity.cy.js +++ b/frontend/cypress/e2e/orderEntity.cy.js @@ -86,12 +86,4 @@ describe("Order Entity", function () { }); }); -// needed this for modifyorder -after(function () { - if (this.currentTest.state === "passed") { - cy.fixture("Order").then((order) => { - order.orderEntityTestsPassed = true; - cy.writeFile("cypress/fixtures/Order.json", order); - }); - } -}); + From 1237a4dee472ab61e502ad6e1a8d3bd29a6d3d44 Mon Sep 17 00:00:00 2001 From: manishjha-04 Date: Sun, 31 Mar 2024 19:47:54 +0530 Subject: [PATCH 7/9] removing unneccesary things --- frontend/cypress/fixtures/Order.json | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/frontend/cypress/fixtures/Order.json b/frontend/cypress/fixtures/Order.json index 679538b6ee..3299c715a8 100644 --- a/frontend/cypress/fixtures/Order.json +++ b/frontend/cypress/fixtures/Order.json @@ -9,9 +9,5 @@ "firstName": "Optimus", "lastName": "Prime" }, - "labNo": "", - "priority": "", - "requestDate": "", - "receivedDate": "", - "testName": "" + "labNo": "" } \ No newline at end of file From 00187aef662df3fa0f788e2bbb8b3ed3b64f254e Mon Sep 17 00:00:00 2001 From: manishjha-04 Date: Tue, 2 Apr 2024 17:29:40 +0530 Subject: [PATCH 8/9] specified spec order --- frontend/cypress.config.js | 7 +++++++ frontend/cypress/e2e/modifyOrder.cy.js | 10 ++-------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/frontend/cypress.config.js b/frontend/cypress.config.js index e2724e2783..9d06aa1fe5 100755 --- a/frontend/cypress.config.js +++ b/frontend/cypress.config.js @@ -6,6 +6,13 @@ module.exports = defineConfig({ e2e: { setupNodeEvents(on, config) { // implement node event listeners here + config.specPattern=[ + 'cypress/e2e/login.cy.js', + 'cypress/e2e/patientEntry.cy.js', + 'cypress/e2e/orderEntity.cy.js', + 'cypress/e2e/modifyOrder.cy.js', + ] + return config; }, baseUrl: "https://localhost", testIsolation: false, diff --git a/frontend/cypress/e2e/modifyOrder.cy.js b/frontend/cypress/e2e/modifyOrder.cy.js index bc913b03a0..b870fbc5a3 100644 --- a/frontend/cypress/e2e/modifyOrder.cy.js +++ b/frontend/cypress/e2e/modifyOrder.cy.js @@ -12,14 +12,6 @@ before("login", () => { }); describe("Modify Order search by accession Number", function () { - before(function () { - cy.fixture("Order").then((order) => { - const labNo = order.labNo; - if (labNo == null) { - this.skip(); - } - }); - }); it("User Visits Home Page and goes to Modify Order Page ", function () { homePage = loginPage.goToHomePage(); @@ -116,11 +108,13 @@ describe("Modify Order search by patient ", function () { modifyOrderPage.clickRespectivePatient(); }); it("should check for program selection button and go to next page ", function () { + cy.wait(1000); modifyOrderPage.checkProgramButton(); modifyOrderPage.clickNextButton(); }); it("should be able to record", function () { + cy.wait(1000); modifyOrderPage.assignValues(); }); From a4c85d182542fcfd3e43d3dec37eb6b624e76df3 Mon Sep 17 00:00:00 2001 From: manishjha-04 Date: Tue, 2 Apr 2024 23:43:03 +0530 Subject: [PATCH 9/9] fix login test --- frontend/cypress/e2e/login.cy.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/frontend/cypress/e2e/login.cy.js b/frontend/cypress/e2e/login.cy.js index a4b6455968..645fbeeb17 100755 --- a/frontend/cypress/e2e/login.cy.js +++ b/frontend/cypress/e2e/login.cy.js @@ -16,10 +16,13 @@ describe("Failing or Succeeding to Login", function () { cy.fixture("Users").then((users) => { users.forEach((user) => { login.enterUsername(user.username); - login.getUsernameElement().should("contain.value", user.username); + login.getUsernameElement().as("usernameField"); + cy.get("@usernameField").type(user.username); + cy.get("@usernameField").should("contain.value", user.username); - login.enterPassword(user.password); - login.getPasswordElement().should("contain.value", user.password); + login.getPasswordElement().as("passwordField"); + cy.get("@passwordField").type(user.password); + cy.get("@passwordField").should("contain.value", user.password); login.signIn(); if (user.correctPass === true) {