Fix epic management flaky test

The fix consists of two parts:

- The first one is about waiting for the save button not to be
present after saving changes
- And the second one is about changing the expectation, asserting
in the epics index page that the deleted epic is not there, instead
of asserting on the message that the epic was deleted.
parent f588407e
......@@ -18,6 +18,9 @@ module QA
def save_changes
click_element :save_button
wait(max: 5, interval: 1, reload: false) do
has_no_element?(:save_button)
end
end
def delete_epic
......
......@@ -38,6 +38,14 @@ module QA
has_element?(:epic_title_text, text: title)
end
end
def has_no_epic?(title)
# First, check that the new epic button is present,
# meaning that the test is in the right page before
# checking that the epic is not there.
find_element(:new_epic_button)
has_no_element?(:epic_title_text, text: title)
end
end
end
end
......
......@@ -15,21 +15,21 @@ module QA
expect(page).to have_content(epic_title)
epic_edited_title = 'Epic edited via GUI'
EE::Page::Group::Epic::Show.perform(&:click_edit_button)
EE::Page::Group::Epic::Edit.perform do |edit|
edited_title = 'Epic edited via GUI'
edit.set_title(edited_title)
edit.set_title(epic_edited_title)
edit.save_changes
expect(edit).to have_content(edited_title)
expect(edit).to have_content(epic_edited_title)
end
epic.visit!
EE::Page::Group::Epic::Show.perform(&:click_edit_button)
EE::Page::Group::Epic::Edit.perform do |edit|
edit.delete_epic
EE::Page::Group::Epic::Edit.perform(&:delete_epic)
expect(edit).to have_content('The epic was successfully deleted')
EE::Page::Group::Epic::Index.perform do |index|
expect(index).to have_no_epic(epic_edited_title)
end
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment