Commit f2d88f4f authored by Jan Provaznik's avatar Jan Provaznik

Merge branch 'split-flaky-sidebar-spec-euko2' into 'master'

Split and rename project issue sidebar specs

See merge request gitlab-org/gitlab!56818
parents a880600c 82b6be65
......@@ -2,19 +2,19 @@
require 'spec_helper'
RSpec.describe 'Issue Boards', :js do
RSpec.describe 'Project issue boards sidebar assignee', :js do
include BoardHelpers
let(:user) { create(:user) }
let(:project) { create(:project, :public) }
let!(:development) { create(:label, project: project, name: 'Development') }
let!(:regression) { create(:label, project: project, name: 'Regression') }
let!(:stretch) { create(:label, project: project, name: 'Stretch') }
let!(:issue1) { create(:labeled_issue, project: project, assignees: [user], labels: [development], relative_position: 2) }
let!(:issue2) { create(:labeled_issue, project: project, labels: [development, stretch], relative_position: 1) }
let(:board) { create(:board, project: project) }
let!(:list) { create(:list, board: board, label: development, position: 0) }
let(:card) { find('.board:nth-child(2)').first('.board-card') }
let_it_be(:user) { create(:user) }
let_it_be(:project) { create(:project, :public) }
let_it_be(:development) { create(:label, project: project, name: 'Development') }
let_it_be(:regression) { create(:label, project: project, name: 'Regression') }
let_it_be(:stretch) { create(:label, project: project, name: 'Stretch') }
let!(:issue1) { create(:labeled_issue, project: project, assignees: [user], labels: [development], relative_position: 2) }
let!(:issue2) { create(:labeled_issue, project: project, labels: [development, stretch], relative_position: 1) }
let(:board) { create(:board, project: project) }
let!(:list) { create(:list, board: board, label: development, position: 0) }
let(:card) { find('.board:nth-child(2)').first('.board-card') }
before do
project.add_maintainer(user)
......
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'Project issue boards sidebar due date', :js do
include BoardHelpers
let_it_be(:user) { create(:user) }
let_it_be(:project) { create(:project, :public) }
let_it_be(:issue) { create(:issue, project: project, relative_position: 1) }
let_it_be(:board) { create(:board, project: project) }
let_it_be(:list) { create(:list, board: board, position: 0) }
let(:card) { find('.board:nth-child(1)').first('.board-card') }
around do |example|
freeze_time { example.run }
end
before do
project.add_maintainer(user)
sign_in(user)
visit project_board_path(project, board)
wait_for_requests
end
context 'due date' do
it 'updates due date' do
click_card(card)
page.within('.due_date') do
today = Date.today.day
click_link 'Edit'
click_button today.to_s
wait_for_requests
expect(page).to have_content(today.to_s(:medium))
end
end
end
end
......@@ -2,20 +2,20 @@
require 'spec_helper'
RSpec.describe 'Issue Boards', :js do
RSpec.describe 'Project issue boards sidebar labels', :js do
include BoardHelpers
let(:user) { create(:user) }
let(:project) { create(:project, :public) }
let!(:development) { create(:label, project: project, name: 'Development') }
let!(:bug) { create(:label, project: project, name: 'Bug') }
let!(:regression) { create(:label, project: project, name: 'Regression') }
let!(:stretch) { create(:label, project: project, name: 'Stretch') }
let!(:issue1) { create(:labeled_issue, project: project, labels: [development], relative_position: 2) }
let!(:issue2) { create(:labeled_issue, project: project, labels: [development, stretch], relative_position: 1) }
let(:board) { create(:board, project: project) }
let!(:list) { create(:list, board: board, label: development, position: 0) }
let(:card) { find('.board:nth-child(2)').first('.board-card') }
let_it_be(:user) { create(:user) }
let_it_be(:project) { create(:project, :public) }
let_it_be(:development) { create(:label, project: project, name: 'Development') }
let_it_be(:bug) { create(:label, project: project, name: 'Bug') }
let_it_be(:regression) { create(:label, project: project, name: 'Regression') }
let_it_be(:stretch) { create(:label, project: project, name: 'Stretch') }
let_it_be(:issue1) { create(:labeled_issue, project: project, labels: [development], relative_position: 2) }
let_it_be(:issue2) { create(:labeled_issue, project: project, labels: [development, stretch], relative_position: 1) }
let_it_be(:board) { create(:board, project: project) }
let_it_be(:list) { create(:list, board: board, label: development, position: 0) }
let(:card) { find('.board:nth-child(2)').first('.board-card') }
before do
project.add_maintainer(user)
......
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'Project issue boards sidebar milestones', :js do
include BoardHelpers
let_it_be(:user) { create(:user) }
let_it_be(:project) { create(:project, :public) }
let_it_be(:milestone) { create(:milestone, project: project) }
let_it_be(:issue1) { create(:issue, project: project, relative_position: 1) }
let_it_be(:issue2) { create(:issue, project: project, milestone: milestone, relative_position: 2) }
let_it_be(:board) { create(:board, project: project) }
let_it_be(:list) { create(:list, board: board, position: 0) }
let(:card1) { find('.board:nth-child(1) .board-card:nth-of-type(1)') }
let(:card2) { find('.board:nth-child(1) .board-card:nth-of-type(2)') }
before do
project.add_maintainer(user)
sign_in(user)
visit project_board_path(project, board)
wait_for_requests
end
context 'milestone' do
it 'adds a milestone' do
click_card(card1)
page.within('.milestone') do
click_link 'Edit'
wait_for_requests
click_link milestone.title
wait_for_requests
page.within('.value') do
expect(page).to have_content(milestone.title)
end
end
end
it 'removes a milestone' do
click_card(card2)
page.within('.milestone') do
click_link 'Edit'
wait_for_requests
click_link "No milestone"
wait_for_requests
page.within('.value') do
expect(page).not_to have_content(milestone.title)
end
end
end
end
end
......@@ -2,34 +2,21 @@
require 'spec_helper'
RSpec.describe 'Issue Boards', :js do
RSpec.describe 'Project issue boards sidebar', :js do
include BoardHelpers
let(:user) { create(:user) }
let(:project) { create(:project, :public) }
let!(:milestone) { create(:milestone, project: project) }
let!(:development) { create(:label, project: project, name: 'Development') }
let!(:regression) { create(:label, project: project, name: 'Regression') }
let!(:stretch) { create(:label, project: project, name: 'Stretch') }
let!(:issue1) { create(:labeled_issue, project: project, milestone: milestone, labels: [development], relative_position: 2) }
let!(:issue2) { create(:labeled_issue, project: project, labels: [development, stretch], relative_position: 1) }
let(:board) { create(:board, project: project) }
let!(:list) { create(:list, board: board, label: development, position: 0) }
let(:card) { find('.board:nth-child(2)').first('.board-card') }
let(:application_settings) { {} }
around do |example|
freeze_time { example.run }
end
let_it_be(:user) { create(:user) }
let_it_be(:project) { create(:project, :public) }
let_it_be(:issue) { create(:issue, project: project, relative_position: 1) }
let_it_be(:board) { create(:board, project: project) }
let_it_be(:list) { create(:list, board: board, position: 0) }
let(:card) { find('.board:nth-child(1)').first('.board-card') }
before do
project.add_maintainer(user)
sign_in(user)
stub_application_setting(application_settings)
visit project_board_path(project, board)
wait_for_requests
end
......@@ -64,115 +51,8 @@ RSpec.describe 'Issue Boards', :js do
click_card(card)
page.within('.issue-boards-sidebar') do
expect(page).to have_content(issue2.title)
expect(page).to have_content(issue2.to_reference)
end
end
context 'milestone' do
it 'adds a milestone' do
click_card(card)
page.within('.milestone') do
click_link 'Edit'
wait_for_requests
click_link milestone.title
wait_for_requests
page.within('.value') do
expect(page).to have_content(milestone.title)
end
end
end
it 'removes a milestone' do
click_card(card)
page.within('.milestone') do
click_link 'Edit'
wait_for_requests
click_link "No milestone"
wait_for_requests
page.within('.value') do
expect(page).not_to have_content(milestone.title)
end
end
end
end
context 'time tracking' do
let(:compare_meter_tooltip) { find('.time-tracking .time-tracking-content .compare-meter')['title'] }
before do
issue2.timelogs.create(time_spent: 14400, user: user)
issue2.update!(time_estimate: 128800)
click_card(card)
end
it 'shows time tracking progress bar' do
expect(compare_meter_tooltip).to eq('Time remaining: 3d 7h 46m')
end
context 'when time_tracking_limit_to_hours is true' do
let(:application_settings) { { time_tracking_limit_to_hours: true } }
it 'shows time tracking progress bar' do
expect(compare_meter_tooltip).to eq('Time remaining: 31h 46m')
end
end
end
context 'due date' do
it 'updates due date' do
click_card(card)
page.within('.due_date') do
click_link 'Edit'
click_button Date.today.day.to_s
wait_for_requests
expect(page).to have_content(Date.today.to_s(:medium))
end
end
end
context 'subscription' do
it 'changes issue subscription' do
click_card(card)
wait_for_requests
page.within('.subscriptions') do
find('[data-testid="subscription-toggle"] button:not(.is-checked)').click
wait_for_requests
expect(page).to have_css('[data-testid="subscription-toggle"] button.is-checked')
end
end
it 'has checked subscription toggle when already subscribed' do
create(:subscription, user: user, project: project, subscribable: issue2, subscribed: true)
visit project_board_path(project, board)
wait_for_requests
click_card(card)
wait_for_requests
page.within('.subscriptions') do
find('[data-testid="subscription-toggle"] button.is-checked').click
wait_for_requests
expect(page).to have_css('[data-testid="subscription-toggle"] button:not(.is-checked)')
end
expect(page).to have_content(issue.title)
expect(page).to have_content(issue.to_reference)
end
end
end
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'Project issue boards sidebar subscription', :js do
include BoardHelpers
let_it_be(:user) { create(:user) }
let_it_be(:project) { create(:project, :public) }
let_it_be(:issue1) { create(:issue, project: project, relative_position: 1) }
let_it_be(:issue2) { create(:issue, project: project, relative_position: 2) }
let_it_be(:subscription) { create(:subscription, user: user, project: project, subscribable: issue2, subscribed: true) }
let_it_be(:board) { create(:board, project: project) }
let_it_be(:list) { create(:list, board: board, position: 0) }
let(:card1) { find('.board:nth-child(1) .board-card:nth-of-type(1)') }
let(:card2) { find('.board:nth-child(1) .board-card:nth-of-type(2)') }
before do
project.add_maintainer(user)
sign_in(user)
visit project_board_path(project, board)
wait_for_requests
end
context 'subscription' do
it 'changes issue subscription' do
click_card(card1)
wait_for_requests
page.within('.subscriptions') do
find('[data-testid="subscription-toggle"] button:not(.is-checked)').click
wait_for_requests
expect(page).to have_css('[data-testid="subscription-toggle"] button.is-checked')
end
end
it 'has checked subscription toggle when already subscribed' do
click_card(card2)
wait_for_requests
page.within('.subscriptions') do
find('[data-testid="subscription-toggle"] button.is-checked').click
wait_for_requests
expect(page).to have_css('[data-testid="subscription-toggle"] button:not(.is-checked)')
end
end
end
end
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'Project issue boards sidebar time tracking', :js do
include BoardHelpers
let_it_be(:user) { create(:user) }
let_it_be(:project) { create(:project, :public) }
let_it_be(:board) { create(:board, project: project) }
let_it_be(:list) { create(:list, board: board, position: 0) }
let!(:issue) { create(:issue, project: project, relative_position: 1) }
let(:card) { find('.board:nth-child(1)').first('.board-card') }
let(:application_settings) { {} }
before do
project.add_maintainer(user)
sign_in(user)
stub_application_setting(application_settings)
visit project_board_path(project, board)
wait_for_requests
end
context 'time tracking' do
let(:compare_meter_tooltip) { find('.time-tracking .time-tracking-content .compare-meter')['title'] }
before do
issue.timelogs.create!(time_spent: 14400, user: user)
issue.update!(time_estimate: 128800)
click_card(card)
end
it 'shows time tracking progress bar' do
expect(compare_meter_tooltip).to eq('Time remaining: 3d 7h 46m')
end
context 'when time_tracking_limit_to_hours is true' do
let(:application_settings) { { time_tracking_limit_to_hours: true } }
it 'shows time tracking progress bar' do
expect(compare_meter_tooltip).to eq('Time remaining: 31h 46m')
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