Skip to content

Commit 52abc93

Browse files
committed
add new method select_all_affiliated_institutions()
1 parent 3442888 commit 52abc93

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

pages/preprints.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from urllib.parse import urljoin
22

33
import pytest
4+
import selenium.webdriver.support.expected_conditions as EC
45
from selenium.webdriver.common.by import By
56
from selenium.webdriver.support.wait import WebDriverWait
67

@@ -101,10 +102,23 @@ class PreprintSubmitPage(BasePreprintPage):
101102
'#ember-basic-dropdown-wormhole > div > ul >li.ember-power-select-option',
102103
)
103104
affiliated_institutions = GroupLocator(By.CSS_SELECTOR, '[data-test-institution]')
105+
affiliated_institutions_input_lst = GroupLocator(
106+
By.CSS_SELECTOR, '[data-test-institution-input]'
107+
)
104108

105109
def get_affiliated_institutions(self) -> list:
106110
return [el.text for el in self.affiliated_institutions]
107111

112+
def select_all_affiliated_institutions(self):
113+
wait = WebDriverWait(self.driver, 5)
114+
wait.until(
115+
EC.element_to_be_clickable(
116+
(By.CSS_SELECTOR, '[data-test-institution-input]')
117+
)
118+
)
119+
for subject in self.affiliated_institutions_input_lst:
120+
subject.click()
121+
108122
def select_from_dropdown_listbox(self, selection):
109123
for option in self.dropdown_options:
110124
if option.text == selection:

tests/test_preprints.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,7 @@ def test_edit_preprint(self, session, driver, preprint_detail_page):
312312
WebDriverWait(driver, 5).until(
313313
EC.visibility_of_element_located((By.CSS_SELECTOR, '[data-test-title]'))
314314
)
315+
edit_page.select_all_affiliated_institutions()
315316
affiliated_institutions_names_metadata_page = (
316317
edit_page.get_affiliated_institutions()
317318
)

0 commit comments

Comments
 (0)