Commit 35b7275c authored by Coung Ngo's avatar Coung Ngo

Combine feature tests for checking issues cards info

Combine tests checking that health status, blocking issues,
and weight info is correctly shown on the issues list page
parent 73f2dfc3
...@@ -20,16 +20,6 @@ RSpec.describe 'Blocking issues count' do ...@@ -20,16 +20,6 @@ RSpec.describe 'Blocking issues count' do
create(:issue_link, source: issue2, target: blocked_issue, link_type: IssueLink::TYPE_BLOCKS) create(:issue_link, source: issue2, target: blocked_issue, link_type: IssueLink::TYPE_BLOCKS)
end end
it 'shows blocking issue counts on issue list row' do
page.within(".issues-list") do
page.within("li.issue:nth-child(2)") do
expect(page).to have_content('blocks one issue')
expect(page).to have_selector('[data-testid="blocking-issues"]')
expect(page.find('[data-testid="blocking-issues"]')).to have_content('1')
end
end
end
it 'sorts by blocking', :js do it 'sorts by blocking', :js do
find('.filter-dropdown-container .dropdown').click find('.filter-dropdown-container .dropdown').click
......
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'Health status' do
let(:project) { build(:project, :public) }
before do
stub_feature_flags(vue_issuables_list: false)
end
health_statuses = [
{ name: 'on_track', style: '.status-on-track', text: "On track" },
{ name: 'needs_attention', style: '.status-needs-attention', text: "Needs attention" },
{ name: 'at_risk', style: '.status-at-risk', text: "At risk" }
]
describe 'health status on issue list row' do
health_statuses.each do |status|
it "renders health status label for #{status[:name]}" do
create(:issue, project: project, health_status: status[:name])
visit project_issues_path(project)
page.within(first('.issuable-info')) do
expect(page).to have_selector('[data-testid="health-status"]')
expect(page).to have_css(status[:style])
expect(page).to have_content(status[:text])
end
end
end
end
end
...@@ -3,26 +3,17 @@ ...@@ -3,26 +3,17 @@
require 'spec_helper' require 'spec_helper'
RSpec.describe 'Issue weight', :js do RSpec.describe 'Issue weight', :js do
let(:project) { create(:project, :public) } let_it_be(:project) { create(:project, :public) }
let_it_be(:user) { create(:user) }
it 'shows weight on issue list row' do before do
create(:issue, project: project, weight: 2) project.add_developer(user)
sign_in(user)
visit project_issues_path(project)
page.within(first('.issuable-info')) do
expect(page).to have_selector('[data-testid="weight"]')
expect(page).to have_content(2)
end
end end
it 'allows user to update weight from none to something' do it 'allows user to update weight from none to something' do
user = create(:user)
issue = create(:issue, author: user, project: project) issue = create(:issue, author: user, project: project)
project.add_developer(user)
sign_in(user)
visit project_issue_path(project, issue) visit project_issue_path(project, issue)
page.within('.weight') do page.within('.weight') do
...@@ -39,12 +30,8 @@ RSpec.describe 'Issue weight', :js do ...@@ -39,12 +30,8 @@ RSpec.describe 'Issue weight', :js do
end end
it 'allows user to update weight from one value to another' do it 'allows user to update weight from one value to another' do
user = create(:user)
issue = create(:issue, author: user, project: project, weight: 2) issue = create(:issue, author: user, project: project, weight: 2)
project.add_developer(user)
sign_in(user)
visit project_issue_path(project, issue) visit project_issue_path(project, issue)
page.within('.weight') do page.within('.weight') do
...@@ -61,12 +48,8 @@ RSpec.describe 'Issue weight', :js do ...@@ -61,12 +48,8 @@ RSpec.describe 'Issue weight', :js do
end end
it 'allows user to remove weight' do it 'allows user to remove weight' do
user = create(:user)
issue = create(:issue, author: user, project: project, weight: 5) issue = create(:issue, author: user, project: project, weight: 5)
project.add_developer(user)
sign_in(user)
visit project_issue_path(project, issue) visit project_issue_path(project, issue)
page.within('.weight') do page.within('.weight') do
......
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'User views issues page', :js do
let_it_be(:user) { create(:user) }
let_it_be(:project) { create(:project, :public) }
let_it_be(:issue1) { create(:issue, project: project, health_status: 'on_track', weight: 2) }
let_it_be(:issue2) { create(:issue, project: project, health_status: 'needs_attention') }
let_it_be(:issue3) { create(:issue, project: project, health_status: 'at_risk') }
before do
stub_feature_flags(vue_issuables_list: false)
sign_in(user)
visit project_issues_path(project)
end
before_all do
create(:issue_link, source: issue1, target: issue2, link_type: IssueLink::TYPE_BLOCKS)
end
describe 'issue card' do
it 'shows health status, blocking issues, and weight information', :aggregate_failures do
within '.issue:nth-of-type(1)' do
expect(page).to have_css '.status-at-risk', text: 'At risk'
expect(page).not_to have_css '.blocking-issues'
expect(page).not_to have_css '.issuable-weight'
end
within '.issue:nth-of-type(2)' do
expect(page).to have_css '.status-needs-attention', text: 'Needs attention'
expect(page).not_to have_css '.blocking-issues'
expect(page).not_to have_css '.issuable-weight'
end
within '.issue:nth-of-type(3)' do
expect(page).to have_css '.status-on-track', text: 'On track'
expect(page).to have_css '.blocking-issues', text: 1
expect(page).to have_css '.issuable-weight', text: 2
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