Commit ace19a7e authored by Kerri Miller's avatar Kerri Miller

Merge branch '322755-combine-issue-card-feature-tests' into 'master'

Combine feature tests for checking issue card info

See merge request gitlab-org/gitlab!61707
parents 093bee4c 35b7275c
......@@ -20,16 +20,6 @@ RSpec.describe 'Blocking issues count' do
create(:issue_link, source: issue2, target: blocked_issue, link_type: IssueLink::TYPE_BLOCKS)
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
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 @@
require 'spec_helper'
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
create(:issue, project: project, weight: 2)
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
before do
project.add_developer(user)
sign_in(user)
end
it 'allows user to update weight from none to something' do
user = create(:user)
issue = create(:issue, author: user, project: project)
project.add_developer(user)
sign_in(user)
visit project_issue_path(project, issue)
page.within('.weight') do
......@@ -39,12 +30,8 @@ RSpec.describe 'Issue weight', :js do
end
it 'allows user to update weight from one value to another' do
user = create(:user)
issue = create(:issue, author: user, project: project, weight: 2)
project.add_developer(user)
sign_in(user)
visit project_issue_path(project, issue)
page.within('.weight') do
......@@ -61,12 +48,8 @@ RSpec.describe 'Issue weight', :js do
end
it 'allows user to remove weight' do
user = create(:user)
issue = create(:issue, author: user, project: project, weight: 5)
project.add_developer(user)
sign_in(user)
visit project_issue_path(project, issue)
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