-
Notifications
You must be signed in to change notification settings - Fork 24
Fix select_top_level_subject() method #273
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
Changes from all commits
a4eafaa
032ae14
3c272f3
d0d8731
db27ebd
fcf98e9
e94bbec
f637a4c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,8 +2,10 @@ | |
|
|
||
| import pytest | ||
| from selenium.webdriver.common.by import By | ||
| from selenium.webdriver.support.wait import WebDriverWait | ||
|
|
||
| import settings | ||
| from base.expected_conditions import text_to_be_present_in_elements | ||
| from base.locators import ( | ||
| ComponentLocator, | ||
| GroupLocator, | ||
|
|
@@ -113,19 +115,22 @@ def select_from_dropdown_listbox(self, selection): | |
| ) | ||
|
|
||
| def select_top_level_subject(self, selection): | ||
| subject_selector = 'div[data-analytics-scope="Browse"] > ul > li' | ||
| wait = WebDriverWait(self.driver, 5) | ||
| wait.until( | ||
| text_to_be_present_in_elements( | ||
| (By.CSS_SELECTOR, subject_selector), selection | ||
| ) | ||
| ) | ||
| for subject in self.top_level_subjects: | ||
| if subject.text == selection: | ||
| # Find the checkbox element and click it to select the subject | ||
| checkbox = subject.find_element_by_css_selector( | ||
| 'input.ember-checkbox.ember-view' | ||
| ) | ||
| checkbox.click() | ||
| subject.click() | ||
|
Member
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. Q: does this work? I always remember checkboxes being difficult to trigger a click on. If this works, awesome!
Collaborator
Author
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. It works. |
||
| break | ||
|
|
||
| first_selected_subject = Locator(By.CSS_SELECTOR, 'li[data-test-selected-subject]') | ||
| basics_tags_section = Locator(By.CSS_SELECTOR, '[data-test-no-tags]') | ||
| basics_tags_input = Locator( | ||
| By.CSS_SELECTOR, 'input[aria-label="Add a tag to enhance discoverability"]' | ||
| By.CSS_SELECTOR, 'input[placeholder="Add a tag to enhance discoverability"]' | ||
| ) | ||
| # Author Assertions Page | ||
| conflict_of_interest_yes = Locator( | ||
|
|
||
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.
nit: could this be constructed from
top_level_subjects, which has the same selector, but is aGroupLocator? I wonder if there's a.firstmethod or something like that.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.
I haven't found the method like this one in GroupLocator()