Skip to content
This repository has been archived by the owner on Aug 20, 2018. It is now read-only.

Commit

Permalink
Attempt to fix frequently failing test_editing_of_existing_suite_that…
Browse files Browse the repository at this point in the history
…_includes_cases by removing drag and drop
  • Loading branch information
bobsilverberg committed May 27, 2013
1 parent 38f903c commit 9fc4a96
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 15 deletions.
15 changes: 5 additions & 10 deletions pages/edit_suite_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,11 @@ class MozTrapEditSuitePage(MozTrapBasePage):
_included_case_item_locator = (By.CSS_SELECTOR, '.multiselected .selectitem')
_included_cases_box_locator = (By.CSS_SELECTOR, '.multiselected .select')
_include_selected_cases_button_locator = (By.CSS_SELECTOR, '#suite-edit-form .action-include')
_remove_selected_cases_button_locator = (By.CSS_SELECTOR, '#suite-edit-form .action-exclude')
_loading_available_cases_locator = (By.CSS_SELECTOR, '.multiunselected .select .overlay')
_loading_included_cases_locator = (By.CSS_SELECTOR, '.multiselected .select .overlay')
_save_suite_button_locator = (By.CSS_SELECTOR, '#suite-edit-form .form-actions > button')
_included_cases_select_all_checkbox_locator = (By.ID, 'bulk_select_selected')

@property
def is_product_field_readonly(self):
Expand Down Expand Up @@ -70,18 +72,11 @@ def include_cases_to_suite(self, case_name_list, save=True):
if save:
self.save_suite()

def reorder_included_cases(self, case_name_list):
""" reorder cases via drag and drop """
def remove_all_included_cases(self):
self.wait_for_element_not_present(*self._loading_included_cases_locator)

for i in xrange(1, len(case_name_list)):
case_names = [case.name for case in self.included_cases]
j = i - 1
while j >= 0 and case_name_list.index(case_names[i]) < case_name_list.index(case_names[j]):
ActionChains(self.selenium).drag_and_drop(
self.included_cases[j]._selenium_root,
self.included_cases[j + 1]._selenium_root).perform()
j -= 1
self.find_element(*self._included_cases_select_all_checkbox_locator).click()
self.find_element(*self._remove_selected_cases_button_locator).click()

class TestCaseItem(PageRegion):

Expand Down
8 changes: 3 additions & 5 deletions tests/test_manage_suites_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ def test_editing_of_existing_suite_that_has_no_included_cases(self, mozwebqa_log
[item.name for item in edit_suite_pg.included_cases], case_list,
u'items are listed in wrong order')

@pytest.mark.native
@pytest.mark.moztrap(2742)
def test_editing_of_existing_suite_that_includes_cases(self, mozwebqa_logged_in, product):
# create suite and cases (both included and not included into suite)
Expand Down Expand Up @@ -107,10 +106,9 @@ def test_editing_of_existing_suite_that_includes_cases(self, mozwebqa_logged_in,
all_cases = expected_available_cases + expected_included_cases
random.shuffle(all_cases)

# include new cases to suite and reorder them in accordance with all_cases list
edit_suite_pg.include_cases_to_suite(actual_available_cases, save=False)
edit_suite_pg.reorder_included_cases(all_cases)
edit_suite_pg.save_suite()
# include cases to suite in the expected order
edit_suite_pg.remove_all_included_cases()
edit_suite_pg.include_cases_to_suite(all_cases)

# re-edit the same suite
manage_suites_pg.filter_form.filter_by(lookup='name', value=suite['name'])
Expand Down

0 comments on commit 9fc4a96

Please sign in to comment.