Commit 7f440b92 authored by Bryce Johnson's avatar Bryce Johnson

Clean reset filters test.

parent e1f2ff91
......@@ -14,80 +14,81 @@ feature 'Filter Resetter', feature: true do
visit_issues(project)
filter_by_milestone(milestone.title)
expect(page).to have_css(".issue", count: 1)
expect(page).to have_css('.issue', count: 1)
reset_filters
expect(page).to have_css(".issue", count: 2)
expect(page).to have_css('.issue', count: 2)
end
end
context 'resets labels filter', js:true do
context 'resets labels filter', js: true do
it 'shows all issues when reset' do
bug = create(:label, project: project, title: 'bug')
issue1 = create(:issue, title: "Bugfix1", project: project)
issue1 = create(:issue, title: 'Bugfix1', project: project)
issue1.labels << bug
issue2 = create(:issue, title: "Feature", project: project)
create(:issue, title: 'Feature', project: project)
visit_issues(project)
filter_by_label(bug.title)
expect(page).to have_css(".issue", count: 1)
expect(page).to have_css('.issue', count: 1)
reset_filters
expect(page).to have_css(".issue", count: 2)
expect(page).to have_css('.issue', count: 2)
end
end
context 'resets text filter', js:true do
context 'resets text filter', js: true do
it 'shows all issues when reset' do
issue1 = create(:issue, title: "Bugfix1", project: project)
issue2 = create(:issue, title: "Feature", project: project)
create(:issue, title: 'Bugfix1', project: project)
create(:issue, title: 'Feature', project: project)
visit_issues(project)
fill_in 'issue_search', with: 'Bug'
expect(page).to have_css(".issue", count: 1)
expect(page).to have_css('.issue', count: 1)
reset_filters
expect(page).to have_css(".issue", count: 2)
expect(page).to have_css('.issue', count: 2)
end
end
context 'resets label and text dually applied', js:true do
context 'resets label and text dually applied', js: true do
it 'shows all issues when reset' do
bug = create(:label, project: project, title: 'bug')
issue1 = create(:issue, title: "Bugfix1", project: project)
issue1 = create(:issue, title: 'Bugfix1', project: project)
issue1.labels << bug
issue2 = create(:issue, project: project, title: 'Feature1')
create(:issue, project: project, title: 'Feature1')
visit_issues(project)
expect(page).to have_css('.issue', count: 2)
fill_in 'issue_search', with: 'Feat'
expect(page).to have_css(".issue", count: 1)
expect(page).to have_css('.issue', count: 1)
wait_for_ajax
filter_by_label(bug.title)
expect(page).to have_css(".issue", count: 0)
expect(page).to have_css('.issue', count: 0)
reset_filters
expect(page).to have_css(".issue", count: 2)
expect(page).to have_css('.issue', count: 2)
end
end
def filter_by_milestone(title)
find(".js-milestone-select").click
find(".milestone-filter .dropdown-content a", text: title).click
find('.js-milestone-select').click
find('.milestone-filter .dropdown-content a', text: title).click
end
def filter_by_label(title)
find(".js-label-select").click
find(".labels-filter .dropdown-content a", text: title).click
find(".labels-filter .dropdown-title .dropdown-menu-close-icon").click
find('.js-label-select').click
find('.labels-filter .dropdown-content a', text: title).click
find('.labels-filter .dropdown-title .dropdown-menu-close-icon').click
end
def reset_filters()
find(".reset-filters").click
def reset_filters
find('.reset-filters').click
wait_for_ajax
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