Change component types and template links to buttons
This commit is contained in:
@@ -67,20 +67,20 @@ def _click_advanced():
|
||||
world.wait_for_visible(tab2_css)
|
||||
|
||||
|
||||
def _find_matching_link(category, component_type):
|
||||
def _find_matching_button(category, component_type):
|
||||
"""
|
||||
Find the link with the specified text. There should be one and only one.
|
||||
Find the button with the specified text. There should be one and only one.
|
||||
"""
|
||||
|
||||
# The tab shows links for the given category
|
||||
links = world.css_find('div.new-component-{} a'.format(category))
|
||||
# The tab shows buttons for the given category
|
||||
buttons = world.css_find('div.new-component-{} button'.format(category))
|
||||
|
||||
# Find the link whose text matches what you're looking for
|
||||
matched_links = [link for link in links if link.text == component_type]
|
||||
# Find the button whose text matches what you're looking for
|
||||
matched_buttons = [btn for btn in buttons if btn.text == component_type]
|
||||
|
||||
# There should be one and only one
|
||||
assert_equal(len(matched_links), 1)
|
||||
return matched_links[0]
|
||||
assert_equal(len(matched_buttons), 1)
|
||||
return matched_buttons[0]
|
||||
|
||||
|
||||
def click_component_from_menu(category, component_type, is_advanced):
|
||||
@@ -100,7 +100,7 @@ def click_component_from_menu(category, component_type, is_advanced):
|
||||
|
||||
# Retry this in case the list is empty because you tried too fast.
|
||||
link = world.retry_on_exception(
|
||||
lambda: _find_matching_link(category, component_type),
|
||||
lambda: _find_matching_button(category, component_type),
|
||||
ignored_exceptions=AssertionError
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user