Skip to content

Commit

Permalink
Adding a new by_text element selector helper in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
pgiraud committed Jun 20, 2024
1 parent 5a8a700 commit 3621fe2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions tests/fixtures/ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,11 @@ def select(self, selector):
def select_all(self, selector):
return self.webdriver.find_elements(by=By.CSS_SELECTOR, value=selector)

def by_text(self, text, tag_name="*"):
return self.webdriver.find_element(
by=By.XPATH, value=f"//{tag_name}[contains(text(), '{text}')]"
)

def list_download_filenames(self):
self.webdriver.command_executor._commands["SET_CONTEXT"] = (
"POST", "/session/$sessionId/moz/context")
Expand Down
2 changes: 1 addition & 1 deletion tests/test_20_inventory.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def test_edit_instance(registered_agent, browser, ui_url):
browser.select("#inputNotify").click()
comment = browser.select("#inputComment").get_attribute('value')
assert "Registered by tests." == comment
browser.select("#buttonSubmit").click()
browser.by_text("Update", "button").click()


def test_download_inventory(registered_agent, browser):
Expand Down

0 comments on commit 3621fe2

Please sign in to comment.