-
Notifications
You must be signed in to change notification settings - Fork 516
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
Fixed Multi-selection functionality. #9345
Changes from 27 commits
72c25c7
5e98869
e8499fd
db2fb4c
2098454
7d99ffe
b9c2913
e721590
c2fe3a9
7cd8d7f
d869d1b
aa51880
102bc74
9a73618
1f667e2
fc1ff52
de35c4d
1ad5032
b900f6f
db0e22e
bad7863
0faeb64
f52117b
564a461
18fcf32
ce00cdf
a2d1d38
e6702d0
6c91c63
0c9da17
623dfa0
762c1ea
6a67690
34d40da
e9129e5
ec73916
33653fb
a971c59
21601fe
6d63a69
a920771
d6fe9b4
197c9a9
4c56047
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,126 @@ | ||
class PatientInvestigation { | ||
private elements = { | ||
addInvestigation: () => cy.get("#investigation"), | ||
investigationTab: () => cy.get("#consultation_tab_nav"), | ||
searchPatientInvestigation: () => cy.get("#search-patient-investigation"), | ||
investigationGroup: () => cy.get("#investigation-group"), | ||
investigationCheckbox: () => cy.get("#investigation-checkbox"), | ||
investigationSelect: () => cy.get("#investigation-select"), | ||
logLabResults: () => cy.get("#log-lab-results"), | ||
investigationFrequency: () => cy.get("#investigation-frequency"), | ||
}; | ||
|
||
clickAddInvestigation() { | ||
cy.verifyAndClickElement("#investigation", "Add Investigation"); | ||
cy.log("Clicking Add Investigation"); | ||
this.elements | ||
.addInvestigation() | ||
.should("be.visible") | ||
.contains("Add Investigation") | ||
.click(); | ||
cy.wait(1000); | ||
} | ||
|
||
clickInvestigationTab() { | ||
cy.verifyAndClickElement("#consultation_tab_nav", "Investigations"); | ||
cy.log("Clicking Investigation Tab"); | ||
this.elements | ||
.investigationTab() | ||
.should("be.visible") | ||
.contains("Investigations") | ||
.click(); | ||
cy.wait(2000); | ||
} | ||
|
||
selectInvestigation(investigation: string) { | ||
cy.get("#search-patient-investigation").type(investigation); | ||
cy.verifyAndClickElement("#investigation-group", investigation); | ||
cy.verifyAndClickElement("#investigation", "Investigation No. 1"); | ||
cy.log(`Selecting Investigation: ${investigation}`); | ||
|
||
this.elements | ||
.searchPatientInvestigation() | ||
.should("be.visible") | ||
.clear() | ||
.type(investigation, { delay: 100 }); | ||
|
||
this.elements | ||
.investigationGroup() | ||
.contains(investigation) | ||
.should("be.visible") | ||
.click(); | ||
|
||
this.elements | ||
.addInvestigation() | ||
.contains("Investigation No. 1") | ||
.should("be.visible") | ||
.click(); | ||
} | ||
|
||
clickInvestigationCheckbox() { | ||
cy.get("#investigation-checkbox").click(); | ||
cy.log("Clicking Investigation Checkbox"); | ||
this.elements | ||
.investigationCheckbox() | ||
.should("be.visible") | ||
.should("be.enabled") | ||
.click(); | ||
} | ||
|
||
selectInvestigationOption(options: string[]) { | ||
cy.clickAndMultiSelectOption("#investigations", options); | ||
cy.log("Selecting Investigation Options:", options); | ||
|
||
this.elements | ||
.investigationSelect() | ||
.should("exist") | ||
.should("be.visible") | ||
.click(); | ||
|
||
options.forEach((option) => { | ||
cy.get("[role='option']") | ||
.contains(option) | ||
.should("be.visible") | ||
.then(($el) => { | ||
if ($el.length > 0) { | ||
cy.wrap($el).click(); | ||
} else { | ||
throw new Error(`Option "${option}" not found in dropdown`); | ||
} | ||
}); | ||
}); | ||
|
||
cy.get("body").click(0, 0); | ||
cy.wait(500); | ||
} | ||
|
||
clickLogLabResults() { | ||
cy.verifyAndClickElement("#log-lab-results", "Log Lab Results"); | ||
cy.log("Clicking Log Lab Results"); | ||
|
||
this.elements.logLabResults().scrollIntoView().should("be.visible"); | ||
|
||
cy.wait(1000); | ||
|
||
this.elements | ||
.logLabResults() | ||
.contains("Log Lab Results") | ||
.should("be.visible") | ||
.should("be.enabled") | ||
.click(); | ||
|
||
cy.wait(2000); | ||
} | ||
|
||
selectInvestigationFrequency(frequency: string) { | ||
cy.get("#investigation-frequency").click(); | ||
cy.log(`Selecting Investigation Frequency: ${frequency}`); | ||
|
||
this.elements.investigationFrequency().should("be.visible").click(); | ||
|
||
cy.contains("button", frequency).should("be.visible").click(); | ||
|
||
cy.wait(500); | ||
} | ||
|
||
verifyElementPresent(selector: string, timeout = 10000) { | ||
return cy.get(selector, { timeout }).should("exist").should("be.visible"); | ||
} | ||
|
||
waitForLoading() { | ||
cy.get("#loading-indicator", { timeout: 10000 }).should("not.exist"); | ||
} | ||
} | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Codebase verification Test coverage is incomplete for multi-selection scenarios The current test implementation only partially covers the required scenarios. Here are the gaps identified:
The page object has the necessary methods ( 🔗 Analysis chainVerify coverage of all multi-selection scenarios. While the test file has been updated to handle multi-selection, please ensure it covers all scenarios mentioned in issue #9144, including:
Let's verify the test coverage: Let me gather more information about the test coverage: 🏁 Scripts executedThe following scripts were executed for the analysis: Script: #!/bin/bash
# Search for related test cases in the codebase
echo "Searching for related test files..."
fd -e cy.ts -e spec.ts "Investigation"
echo "Checking for multi-select testing patterns..."
rg -l "selectInvestigationOption.*\[.*\]" -t ts
echo "Checking for Clear button test coverage..."
rg -l "clear.*button|clear.*selection" -t ts
Length of output: 746 Script: #!/bin/bash
# Check the actual test implementation
echo "Checking PatientInvestigation test implementation..."
cat cypress/e2e/patient_spec/PatientInvestigation.cy.ts
# Look for clear functionality in the page object
echo -e "\nChecking clear functionality in page object..."
rg "clear" cypress/pageobject/Patient/PatientInvestigation.ts
# Check for any multi-select related code in the component
echo -e "\nChecking multi-select implementation in components..."
rg -A 5 "multiSelect|multiple" src/components/Form/AutoCompleteAsync.tsx src/components/Form/FormFields/Autocomplete.tsx
Length of output: 5394 |
||
export default PatientInvestigation; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Improve robustness of multi-selection handling.
The current implementation has several areas for improvement:
Consider this improved implementation:
📝 Committable suggestion