Skip to content

Commit 6811693

Browse files
JuaniVegaAuDuarte
authored andcommitted
feat: add filterAndSelectFirstMultiSelect method
Add filterAndSelectFirstMultiSelect method to allow receiving a list of parameters and making multiple selections in the MultiSelectComboBox.
1 parent 4025535 commit 6811693

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

src/main/java/in/virit/mopo/ComboBoxPw.java

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package in.virit.mopo;
22

33
import com.microsoft.playwright.Locator;
4-
4+
import java.util.List;
55
import static com.microsoft.playwright.assertions.PlaywrightAssertions.assertThat;
66

77
/**
@@ -38,6 +38,23 @@ public void filterAndSelectFirst(String filter) {
3838
assertThat(root).not().hasAttribute("opened", "");
3939
}
4040

41+
/**
42+
* Filters the MultiSelectComboBox by searching for each term provided in the filter
43+
* list and selects the first suggestion for each term.
44+
*
45+
* @param filterList a list of strings representing the terms to be searched
46+
* for and selected in the ComboBox
47+
*/
48+
public void filterAndSelectFirstMultiSelect(List<String> filterList) {
49+
root.locator("input").press("Escape");
50+
for(String filter: filterList) {
51+
filter(filter);
52+
root.locator("input").press("Enter");
53+
root.locator("input").press("Escape");
54+
}
55+
root.locator("input").press("Escape");
56+
}
57+
4158
/**
4259
* Fills given filter to the combobox.
4360
*

0 commit comments

Comments
 (0)