Commit f99a1edf authored by Douglas Barbosa Alexandre's avatar Douglas Barbosa Alexandre Committed by Fatih Acet

Fix feature spec for issue sidebar on issue boards

parent 8a2ecebe
...@@ -4,14 +4,17 @@ describe 'Issue Boards', feature: true, js: true do ...@@ -4,14 +4,17 @@ describe 'Issue Boards', feature: true, js: true do
include WaitForAjax include WaitForAjax
include WaitForVueResource include WaitForVueResource
let(:project) { create(:empty_project, :public) } let(:user) { create(:user) }
let(:board) { create(:board, project: project) } let(:project) { create(:empty_project, :public) }
let(:user) { create(:user) } let!(:milestone) { create(:milestone, project: project) }
let!(:label) { create(:label, project: project) } let!(:development) { create(:label, project: project, name: 'Development') }
let!(:label2) { create(:label, project: project) } let!(:bug) { create(:label, project: project, name: 'Bug') }
let!(:milestone) { create(:milestone, project: project) } let!(:regression) { create(:label, project: project, name: 'Regression') }
let!(:issue2) { create(:labeled_issue, project: project, assignee: user, milestone: milestone, labels: [label]) } let!(:stretch) { create(:label, project: project, name: 'Stretch') }
let!(:issue) { create(:issue, project: project) } let!(:issue1) { create(:labeled_issue, project: project, assignee: user, milestone: milestone, labels: [development]) }
let!(:issue2) { create(:labeled_issue, project: project, labels: [development, stretch]) }
let(:board) { create(:board, project: project) }
let!(:list) { create(:list, board: board, label: development, position: 0) }
before do before do
project.team << [user, :master] project.team << [user, :master]
...@@ -62,8 +65,8 @@ describe 'Issue Boards', feature: true, js: true do ...@@ -62,8 +65,8 @@ describe 'Issue Boards', feature: true, js: true do
end end
page.within('.issue-boards-sidebar') do page.within('.issue-boards-sidebar') do
expect(page).to have_content(issue.title) expect(page).to have_content(issue2.title)
expect(page).to have_content(issue.to_reference) expect(page).to have_content(issue2.to_reference)
end end
end end
...@@ -244,22 +247,22 @@ describe 'Issue Boards', feature: true, js: true do ...@@ -244,22 +247,22 @@ describe 'Issue Boards', feature: true, js: true do
wait_for_ajax wait_for_ajax
click_link label.title click_link bug.title
wait_for_vue_resource wait_for_vue_resource
find('.dropdown-menu-close-icon').click find('.dropdown-menu-close-icon').click
page.within('.value') do page.within('.value') do
expect(page).to have_selector('.label', count: 1) expect(page).to have_selector('.label', count: 3)
expect(page).to have_content(label.title) expect(page).to have_content(bug.title)
end end
end end
page.within(first('.board')) do page.within(first('.board')) do
page.within(first('.card')) do page.within(first('.card')) do
expect(page).to have_selector('.label', count: 1) expect(page).to have_selector('.label', count: 2)
expect(page).to have_content(label.title) expect(page).to have_content(bug.title)
end end
end end
end end
...@@ -274,32 +277,32 @@ describe 'Issue Boards', feature: true, js: true do ...@@ -274,32 +277,32 @@ describe 'Issue Boards', feature: true, js: true do
wait_for_ajax wait_for_ajax
click_link label.title click_link bug.title
click_link label2.title click_link regression.title
wait_for_vue_resource wait_for_vue_resource
find('.dropdown-menu-close-icon').click find('.dropdown-menu-close-icon').click
page.within('.value') do page.within('.value') do
expect(page).to have_selector('.label', count: 2) expect(page).to have_selector('.label', count: 4)
expect(page).to have_content(label.title) expect(page).to have_content(bug.title)
expect(page).to have_content(label2.title) expect(page).to have_content(regression.title)
end end
end end
page.within(first('.board')) do page.within(first('.board')) do
page.within(first('.card')) do page.within(first('.card')) do
expect(page).to have_selector('.label', count: 2) expect(page).to have_selector('.label', count: 3)
expect(page).to have_content(label.title) expect(page).to have_content(bug.title)
expect(page).to have_content(label2.title) expect(page).to have_content(regression.title)
end end
end end
end end
it 'removes a label' do it 'removes a label' do
page.within(first('.board')) do page.within(first('.board')) do
find('.card:nth-child(2)').click first('.card').click
end end
page.within('.labels') do page.within('.labels') do
...@@ -307,22 +310,22 @@ describe 'Issue Boards', feature: true, js: true do ...@@ -307,22 +310,22 @@ describe 'Issue Boards', feature: true, js: true do
wait_for_ajax wait_for_ajax
click_link label.title click_link stretch.title
wait_for_vue_resource wait_for_vue_resource
find('.dropdown-menu-close-icon').click find('.dropdown-menu-close-icon').click
page.within('.value') do page.within('.value') do
expect(page).to have_selector('.label', count: 0) expect(page).to have_selector('.label', count: 1)
expect(page).not_to have_content(label.title) expect(page).not_to have_content(stretch.title)
end end
end end
page.within(first('.board')) do page.within(first('.board')) do
page.within(find('.card:nth-child(2)')) do page.within(first('.card')) do
expect(page).not_to have_selector('.label', count: 1) expect(page).not_to have_selector('.label')
expect(page).not_to have_content(label.title) expect(page).not_to have_content(stretch.title)
end end
end end
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