Skip to content

Commit 0b8f5a0

Browse files
committed
refactor: move "Select Country" keyword into selenium.utils.robot file.
No functional changes.
1 parent 1e00114 commit 0b8f5a0

File tree

2 files changed

+16
-15
lines changed

2 files changed

+16
-15
lines changed

src/test/robotframework/selenium.utils.robot

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,18 @@ Emailfield Value Should Be
2323
[Arguments] ${locator} ${expected}
2424
${value}= Get Value ${locator}
2525
Should Be Equal ${expected} ${value}
26+
27+
Select Country
28+
[Documentation] Select the given value in a select list that is using selectize.js
29+
[Arguments] ${value}
30+
# We can't use "Select From List By Label" because
31+
# 1) it doesn't work with invisible elements (and selectize.js makes field invisible)
32+
# 2) selectize.js dynamically creates list of countries only when we're clicking on the field
33+
Click Element id=country-selectized
34+
${countryOption}= Catenate SEPARATOR=/
35+
... //*[contains(@class, "selectize-control")]
36+
... *[contains(@class, "selectize-dropdown")]
37+
... *[contains(@class, "selectize-dropdown-content")]
38+
... *[contains(@class, "option") and text()="${value}"]
39+
Wait Until Page Contains Element xpath=${countryOption}
40+
Click Element xpath=${countryOption}

src/test/robotframework/series/creation/logic-admin.robot

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
Documentation Verify series creation scenarios from admin
33
Library SeleniumLibrary
44
Resource ../../auth.steps.robot
5+
Resource ../../selenium.utils.robot
56
Suite Setup Before Test Suite
67
Suite Teardown After Test Suite
78
Test Setup Before Test
@@ -82,18 +83,3 @@ Before Test
8283
After Test Suite
8384
Log Out
8485
Close Browser
85-
86-
Select Country
87-
[Documentation] Select the given value in a select list that is using selectize.js
88-
[Arguments] ${value}
89-
# We can't use "Select From List By Label" because
90-
# 1) it doesn't work with invisible elements (and selectize.js makes field invisible)
91-
# 2) selectize.js dynamically creates list of countries only when we're clicking on the field
92-
Click Element id=country-selectized
93-
${countryOption}= Catenate SEPARATOR=/
94-
... //*[contains(@class, "selectize-control")]
95-
... *[contains(@class, "selectize-dropdown")]
96-
... *[contains(@class, "selectize-dropdown-content")]
97-
... *[contains(@class, "option") and text()="${value}"]
98-
Wait Until Page Contains Element xpath=${countryOption}
99-
Click Element xpath=${countryOption}

0 commit comments

Comments
 (0)