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 Cypress Test Suite for Sample Test Request Workflow #8977

Open
wants to merge 16 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 8 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
42 changes: 42 additions & 0 deletions cypress/e2e/sample_test_spec/SampleTestRequest.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import { SampleTestPage } from "pageobject/Sample/SampleTestCreate";

describe("Sample Test", () => {
const sampleTestPage = new SampleTestPage();
const sampleTestType = "BA/ETA",
icmrCategory = "Cat 0",
icmrLabel = "Test Icmr Label";

before(() => {
cy.loginByApi("devdistrictadmin", "Coronasafe@123");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
cy.loginByApi("devdistrictadmin", "Coronasafe@123");
loginPage.loginAsDisctrictAdmin();

cy.saveLocalStorage();
});

beforeEach(() => {
cy.restoreLocalStorage();
cy.clearLocalStorage(/filters--.+/);
});
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Move credentials to environment variables or test configuration.

Hardcoded credentials in test files pose a security risk and make credential rotation difficult.

 before(() => {
-  cy.loginByApi("devdistrictadmin", "Coronasafe@123");
+  cy.loginByApi(Cypress.env('ADMIN_USERNAME'), Cypress.env('ADMIN_PASSWORD'));
   cy.saveLocalStorage();
 });
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
before(() => {
cy.loginByApi("devdistrictadmin", "Coronasafe@123");
cy.saveLocalStorage();
});
beforeEach(() => {
cy.restoreLocalStorage();
cy.clearLocalStorage(/filters--.+/);
});
before(() => {
cy.loginByApi(Cypress.env('ADMIN_USERNAME'), Cypress.env('ADMIN_PASSWORD'));
cy.saveLocalStorage();
});
beforeEach(() => {
cy.restoreLocalStorage();
cy.clearLocalStorage(/filters--.+/);
});


it("should request a new sample test", () => {
sampleTestPage.visitPatientPage();
sampleTestPage.visitPatientDashboardPage();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
sampleTestPage.visitPatientDashboardPage();
patientPage.visitPatient(patientName);
  • reuse existing component, and use them in your test by importing the function
  • always try to click on specific patient card, rather than random card
  • keep all the input const in the test file itself

sampleTestPage.visitSampleRequestPage();
Copy link
Member

@nihal467 nihal467 Nov 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • before this line, reuse the function to click patient details function
  • after that only add this line, where you are clicking the request sample request page button
  • make sure once the sample request page is loaded, add a cy.intercept and verify the API response to ensure the page is fully loaded before your next line of test is executed

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Add API intercept to ensure the sample request page has fully loaded.

To ensure that the sample request page is fully loaded before interacting with it, consider adding a cy.intercept for the sample request API and waiting for its response.

Apply this diff to implement the intercept:

// Ensure sample request API is loaded
+ sampleTestPage.interceptSampleRequestAPI();
  sampleTestPage.visitSampleRequestPage();
+ sampleTestPage.waitForSampleRequestResponse();

If these methods are not available, you can use:

// Ensure sample request API is loaded
+ cy.intercept('GET', '/api/v1/sample/*').as('getSampleRequest');
  sampleTestPage.visitSampleRequestPage();
+ cy.wait('@getSampleRequest');

Committable suggestion skipped: line range outside the PR's diff.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

like the ai review suggested, there is API verification is missing


Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • As mentioned in the last review to remove unused line, why are you still keeping the space

// Fill form fields
sampleTestPage.selectSampleType(sampleTestType);
sampleTestPage.selectIcmrCategory(icmrCategory);
sampleTestPage.typeIcmrLabel(icmrLabel);

Copy link
Member

@nihal467 nihal467 Nov 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
  • remove unwanted spaces
  • input values to all the fields in the form not only the mandatory columns

// Submit the form
sampleTestPage.submitForm();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
sampleTestPage.submitForm();
cy.submitButton("Confirm your request to send sample for testing")
  • always use the reusable commands present in commands.ts file


// Check for sample request notification and history
sampleTestPage.clickOnNotification();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
sampleTestPage.clickOnNotification();
cy.verifyNotification("Sample test created successfully");

sampleTestPage.checkRequestHistory();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
sampleTestPage.checkRequestHistory();
sampleTestPage.checkRequestHistory();
  • this should verify the content on the card present in the patient details page, where status , sample type and result is displayed.
  • we have reusable component for verifying content presence, refer to commands.ts file

});
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Enhance test reliability with API intercepts and assertions.

The test needs improvements in several areas:

  1. Add API intercepts to verify page loads
  2. Add assertions between steps
  3. Use specific patient selection instead of random selection
 it("should request a new sample test", () => {
+  cy.intercept('GET', '/api/v1/patient/*').as('getPatient');
   sampleTestPage.visitPatientPage();
-  sampleTestPage.visitPatientDashboardPage();
+  cy.wait('@getPatient');
+  
+  const patientName = "John Doe"; // Move to test data
+  sampleTestPage.visitPatient(patientName);
+  cy.contains(patientName).should('be.visible');
 
+  cy.intercept('GET', '/api/v1/sample_test/*').as('getSampleTest');
   sampleTestPage.visitSampleRequestPage();
+  cy.wait('@getSampleTest');
 
   // Fill form fields
   sampleTestPage.selectSampleType(sampleTestType);
+  cy.get('[data-testid="sample-type"]').should('have.value', sampleTestType);
   sampleTestPage.selectIcmrCategory(icmrCategory);
+  cy.get('[data-testid="icmr-category"]').should('have.value', icmrCategory);
   sampleTestPage.typeIcmrLabel(icmrLabel);
+  cy.get('[data-testid="icmr-label"]').should('have.value', icmrLabel);
 
   // Submit the form
-  sampleTestPage.submitForm();
+  cy.submitButton("Confirm your request to send sample for testing");
 
   // Check for sample request notification and history
-  sampleTestPage.clickOnNotification();
+  cy.verifyNotification("Sample test created successfully");
   sampleTestPage.checkRequestHistory();
 });

Committable suggestion skipped: line range outside the PR's diff.


it("should verify sample request on sample page", () => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
it("should verify sample request on sample page", () => {
it("should verify sample request on sample page", () => {
  • this should be part of the first test , not a different test

sampleTestPage.visitSamplePage();
sampleTestPage.searchPatientSample(sampleTestPage.patientName);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
sampleTestPage.searchPatientSample(sampleTestPage.patientName);
sampleTestPage.searchPatientSample(sampleTestPage.patientName);
  • check for the patient card presence, and verify the patient name in the card
  • then click on the sample details button, and verify all the inputted details are properly present in the sample details page
  • add a cy.intercept to ensure that the API status to ensure the page is fully loaded

sampleTestPage.patientSampleMustExist();
});
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Improve test independence and add explicit assertions.

The test case appears to depend on the previous test's state and lacks proper assertions.

 it("should verify sample request on sample page", () => {
+  cy.intercept('GET', '/api/v1/sample/*').as('getSamples');
   sampleTestPage.visitSamplePage();
+  cy.wait('@getSamples');
 
+  const expectedPatient = "John Doe"; // Move to test data
-  sampleTestPage.searchPatientSample(sampleTestPage.patientName);
+  sampleTestPage.searchPatientSample(expectedPatient);
+  cy.get('[data-testid="search-results"]').should('be.visible');
 
-  sampleTestPage.patientSampleMustExist();
+  cy.get('[data-testid="patient-sample"]')
+    .should('contain', expectedPatient)
+    .and('contain', sampleTestType);
 });

Consider making this test independent by setting up its own test data, rather than relying on the previous test case.

Committable suggestion skipped: line range outside the PR's diff.

});
79 changes: 79 additions & 0 deletions cypress/pageobject/Sample/SampleTestCreate.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
export class SampleTestPage {
sampleTestReportHistory = 0;
patientName = ""; // to search for patient in sample page

visitPatientPage() {
cy.awaitUrl("/patients");
}

visitPatientDashboardPage() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
visitPatientDashboardPage() {
visitPatientDashboardPage() {
  • always try to use proper id's and not class name
  • remove all unwanted function as a lot of changes requested

cy.get(".patient-stable-ring").first().scrollIntoView();
cy.get(".patient-stable-ring").should("be.visible").first().click();
cy.get("#patient-name")
.invoke("text")
.then((patientName) => {
this.patientName = patientName.trim();
});
cy.get("#patient-details").should("be.visible").click();
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Improve selector reliability and error handling in patient dashboard navigation.

The current implementation has potential reliability issues:

  1. The .patient-stable-ring selector is brittle and could break with UI changes
  2. No error handling for cases where patient details are not found
 visitPatientDashboardPage() {
-    cy.get(".patient-stable-ring").first().scrollIntoView();
-    cy.get(".patient-stable-ring").should("be.visible").first().click();
+    cy.get('[data-testid="patient-card"]')
+      .first()
+      .should("exist")
+      .scrollIntoView()
+      .should("be.visible")
+      .click();
     cy.get("#patient-name")
       .invoke("text")
       .then((patientName) => {
         this.patientName = patientName.trim();
+        // Verify patient name was actually extracted
+        expect(this.patientName).to.not.be.empty;
       });
     cy.get("#patient-details").should("be.visible").click();
 }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
visitPatientDashboardPage() {
cy.get(".patient-stable-ring").first().scrollIntoView();
cy.get(".patient-stable-ring").should("be.visible").first().click();
cy.get("#patient-name")
.invoke("text")
.then((patientName) => {
this.patientName = patientName.trim();
});
cy.get("#patient-details").should("be.visible").click();
}
visitPatientDashboardPage() {
cy.get('[data-testid="patient-card"]')
.first()
.should("exist")
.scrollIntoView()
.should("be.visible")
.click();
cy.get("#patient-name")
.invoke("text")
.then((patientName) => {
this.patientName = patientName.trim();
// Verify patient name was actually extracted
expect(this.patientName).to.not.be.empty;
});
cy.get("#patient-details").should("be.visible").click();
}


visitSampleRequestPage() {
cy.get("body").then(($body) => {
if ($body.find("#sample-test-history").length > 0) {
cy.get("#sample-test-history")
.its("length")
.then((count) => {
this.sampleTestReportHistory = count;
});
} else {
// Set to 0 if the element does not exist
this.sampleTestReportHistory = 0;
}
});
cy.get("#sample-request-btn").scrollIntoView();
cy.get("#sample-request-btn").should("be.visible").click();
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Simplify sample history count logic and add error handling.

The current implementation of sample history counting is overly complex and could be simplified.

 visitSampleRequestPage() {
-    cy.get("body").then(($body) => {
-      if ($body.find("#sample-test-history").length > 0) {
-        cy.get("#sample-test-history")
-          .its("length")
-          .then((count) => {
-            this.sampleTestReportHistory = count;
-          });
-      } else {
-        // Set to 0 if the element does not exist
-        this.sampleTestReportHistory = 0;
-      }
-    });
+    // Get sample history count, defaulting to 0 if not found
+    cy.get("#sample-test-history")
+      .then($elements => {
+        this.sampleTestReportHistory = $elements.length;
+      })
+      .catch(() => {
+        this.sampleTestReportHistory = 0;
+      });
+
+    // Verify sample request button exists before clicking
     cy.get("#sample-request-btn").scrollIntoView();
-    cy.get("#sample-request-btn").should("be.visible").click();
+    cy.get("#sample-request-btn")
+      .should("be.visible")
+      .should("be.enabled")
+      .click();
 }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
visitSampleRequestPage() {
cy.get("body").then(($body) => {
if ($body.find("#sample-test-history").length > 0) {
cy.get("#sample-test-history")
.its("length")
.then((count) => {
this.sampleTestReportHistory = count;
});
} else {
// Set to 0 if the element does not exist
this.sampleTestReportHistory = 0;
}
});
cy.get("#sample-request-btn").scrollIntoView();
cy.get("#sample-request-btn").should("be.visible").click();
}
visitSampleRequestPage() {
// Get sample history count, defaulting to 0 if not found
cy.get("#sample-test-history")
.then($elements => {
this.sampleTestReportHistory = $elements.length;
})
.catch(() => {
this.sampleTestReportHistory = 0;
});
// Verify sample request button exists before clicking
cy.get("#sample-request-btn").scrollIntoView();
cy.get("#sample-request-btn")
.should("be.visible")
.should("be.enabled")
.click();
}


selectSampleType(option: string) {
cy.get("#sample-type").should("be.visible").click();
cy.get("[role='option']").contains(option).click();
}

selectIcmrCategory(option: string) {
cy.get("#icmr-category").should("be.visible").click();
cy.get("[role='option']").contains(option).click();
}

typeIcmrLabel(label: string) {
cy.get("#icmr-label").should("be.visible").type(label);
}

submitForm() {
cy.get("#sample-test-submit-btn").scrollIntoView();
cy.get("#sample-test-submit-btn").should("be.visible").click();
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Add input validation and error handling to form interactions.

The form interaction methods need improved validation and error handling:

  1. Input parameters should be validated
  2. Form submission should verify form validity
  3. Error handling for failed interactions is missing
-  selectSampleType(option: string) {
+  selectSampleType(option: string): void {
+    if (!option) {
+      throw new Error('Sample type option is required');
+    }
     cy.get("#sample-type").should("be.visible").click();
-    cy.get("[role='option']").contains(option).click();
+    cy.get("[role='option']")
+      .contains(option)
+      .should("exist")
+      .should("be.visible")
+      .click();
   }

   submitForm() {
+    // Verify form validity before submission
+    cy.get('form')
+      .invoke('get', 0)
+      .then($form => {
+        expect($form.checkValidity()).to.be.true;
+      });
     cy.get("#sample-test-submit-btn").scrollIntoView();
     cy.get("#sample-test-submit-btn")
       .should("be.visible")
+      .should("be.enabled")
       .click();
   }

Committable suggestion skipped: line range outside the PR's diff.


clickOnNotification() {
cy.get(".pnotify-container").should("be.visible").click();
}

checkRequestHistory() {
cy.get("#sample-test-history").scrollIntoView();
cy.get("#sample-test-history").should(
"have.length",
this.sampleTestReportHistory + 1,
);
}

visitSamplePage() {
cy.awaitUrl("/sample");
}

searchPatientSample() {
cy.get("#search_patient_name").should("be.visible").type(this.patientName);
}

patientSampleMustExist() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
patientSampleMustExist() {
patientSampleMustExist() {
  • never add random card presence check, if you want to check a card of a patient, always check for the card with patient name present in it

cy.get("#sample-card").should("be.visible");
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Enhance verification methods with better error handling and timeouts.

The verification methods need improvements in reliability and error handling:

  1. Notification handling should be more robust
  2. Sample history verification should handle edge cases
  3. Timeouts should be configured for async operations
   clickOnNotification() {
-    cy.get(".pnotify-container").should("be.visible").click();
+    cy.get(".pnotify-container", { timeout: 10000 })
+      .should("be.visible")
+      .should("not.be.disabled")
+      .click();
   }

   checkRequestHistory() {
     cy.get("#sample-test-history").scrollIntoView();
-    cy.get("#sample-test-history").should(
-      "have.length",
-      this.sampleTestReportHistory + 1,
-    );
+    cy.get("#sample-test-history", { timeout: 10000 })
+      .should("exist")
+      .then($elements => {
+        const currentCount = $elements.length;
+        expect(currentCount).to.equal(
+          this.sampleTestReportHistory + 1,
+          `Expected sample history count to increase by 1 from ${this.sampleTestReportHistory} to ${this.sampleTestReportHistory + 1}, but found ${currentCount}`
+        );
+      });
   }

   patientSampleMustExist() {
-    cy.get("#sample-card").should("be.visible");
+    cy.get("#sample-card", { timeout: 10000 })
+      .should("exist")
+      .should("be.visible")
+      .then($card => {
+        expect($card).to.contain(this.patientName);
+      });
   }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
clickOnNotification() {
cy.get(".pnotify-container").should("be.visible").click();
}
checkRequestHistory() {
cy.get("#sample-test-history").scrollIntoView();
cy.get("#sample-test-history").should(
"have.length",
this.sampleTestReportHistory + 1,
);
}
visitSamplePage() {
cy.awaitUrl("/sample");
}
searchPatientSample() {
cy.get("#search_patient_name").should("be.visible").type(this.patientName);
}
patientSampleMustExist() {
cy.get("#sample-card").should("be.visible");
}
clickOnNotification() {
cy.get(".pnotify-container", { timeout: 10000 })
.should("be.visible")
.should("not.be.disabled")
.click();
}
checkRequestHistory() {
cy.get("#sample-test-history").scrollIntoView();
cy.get("#sample-test-history", { timeout: 10000 })
.should("exist")
.then($elements => {
const currentCount = $elements.length;
expect(currentCount).to.equal(
this.sampleTestReportHistory + 1,
`Expected sample history count to increase by 1 from ${this.sampleTestReportHistory} to ${this.sampleTestReportHistory + 1}, but found ${currentCount}`
);
});
}
visitSamplePage() {
cy.awaitUrl("/sample");
}
searchPatientSample() {
cy.get("#search_patient_name").should("be.visible").type(this.patientName);
}
patientSampleMustExist() {
cy.get("#sample-card", { timeout: 10000 })
.should("exist")
.should("be.visible")
.then($card => {
expect($card).to.contain(this.patientName);
});
}

}
1 change: 1 addition & 0 deletions src/components/Patient/PatientHome.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1370,6 +1370,7 @@ export const PatientHome = (props: any) => {
)
}
authorizeFor={NonReadOnlyUsers}
id="sample-request-btn"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codebase verification

Both instances of "Request Sample Test" should have test identifiers for consistency

The codebase has two instances of "Request Sample Test":

  • One in a ButtonV2 component that correctly has the id="sample-request-btn" attribute
  • Another in a <p> tag that lacks a test identifier

For consistent test automation, consider adding a test identifier to the <p> tag instance as well.

🔗 Analysis chain

LGTM! Test identifier added for Cypress automation.

The addition of the id attribute for the sample test request button aligns well with the PR objectives and follows good testing practices.

Let's verify if similar buttons in the desktop view also need test identifiers:

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for other sample test related buttons in the file
rg --type tsx "Request Sample Test" -B 2 -A 2

Length of output: 75


Script:

#!/bin/bash
# Search for other sample test related buttons in the file, using ripgrep without file type filter
rg "Request Sample Test" -B 2 -A 2

Length of output: 856


Script:

#!/bin/bash
# Let's check if these other instances have test identifiers
rg -B 5 -A 5 "Request Sample Test" src/components/Patient/PatientHome.tsx

Length of output: 909

>
<span className="flex w-full items-center justify-start gap-2">
<CareIcon icon="l-medkit" className="text-xl" />
Expand Down
2 changes: 1 addition & 1 deletion src/components/Patient/PatientInfoCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ export default function PatientInfoCard(props: {
className="mb-2 flex flex-col justify-center text-xl font-semibold capitalize lg:hidden"
id="patient-name-consultation"
>
{patient.name}
<span id="patient-name">{patient.name}</span>
<div className="ml-3 mr-2 mt-[6px] text-sm font-semibold text-secondary-600">
{formatPatientAge(patient, true)} • {patient.gender}
</div>
Expand Down
14 changes: 12 additions & 2 deletions src/components/Patient/SampleTest.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ export const SampleTest = ({ facilityId, patientId }: any) => {
options={SAMPLE_TYPE_CHOICES}
optionLabel={(option) => option.text}
optionValue={(option) => option.id}
id="sample-type"
/>

{state.form.sample_type === "OTHER TYPE" && (
Expand All @@ -226,6 +227,7 @@ export const SampleTest = ({ facilityId, patientId }: any) => {
options={ICMR_CATEGORY}
optionLabel={(option) => option}
optionValue={(option) => option}
id="icmr-category"
/>
<div className="mb-6 flex flex-col gap-1">
<p className="font-medium">
Expand All @@ -251,7 +253,11 @@ export const SampleTest = ({ facilityId, patientId }: any) => {
</span>
</div>

<TextFormField {...field("icmr_label", "ICMR Label")} required />
<TextFormField
{...field("icmr_label", "ICMR Label")}
required
id="icmr-label"
/>
<div className="mb-6 w-full flex-none">
<FieldLabel>Testing Facility</FieldLabel>
<FacilitySelect
Expand Down Expand Up @@ -313,7 +319,11 @@ export const SampleTest = ({ facilityId, patientId }: any) => {
/>
<div className="mt-4 flex flex-col justify-end gap-2 lg:flex-row">
<Cancel onClick={() => goBack()} />
<Submit onClick={handleSubmit} label={buttonText} />
<Submit
onClick={handleSubmit}
label={buttonText}
id="sample-test-submit-btn"
/>
</div>
</form>
</Page>
Expand Down
1 change: 1 addition & 0 deletions src/components/Patient/SampleTestCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ export const SampleTestCard = (props: SampleDetailsProps) => {

return (
<div
id="sample-test-history"
className={`${
itemData.result === "POSITIVE"
? "border-red-500 bg-red-100 hover:border-red-700"
Expand Down
2 changes: 2 additions & 0 deletions src/components/Patient/SampleViewAdmin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ export default function SampleViewAdmin() {
? "border-primary-700 bg-primary-100"
: "bg-white"
}`}
id="sample-card"
>
<div className="flex h-full flex-col justify-between px-6 py-4">
<div>
Expand Down Expand Up @@ -345,6 +346,7 @@ export default function SampleViewAdmin() {
<div className="flex w-full flex-col gap-3">
<SearchInput
name="patient_name"
id="search_patient_name"
value={qParams.patient_name}
onChange={(e) => updateQuery({ [e.name]: e.value })}
placeholder="Search patient"
Expand Down
Loading