Commit ea492e3a authored by Mark Lapierre's avatar Mark Lapierre

Merge branch 'qa-add-real-time-assignees-e2e-spec' into 'master'

Add e2e test for real time assignee updates

See merge request gitlab-org/gitlab!44214
parents ca70733e eea44869
......@@ -64,11 +64,17 @@ module QA
end
def has_assignee?(username)
page.within(element_selector_css(:assignee_block)) do
within_element(:assignee_block) do
has_text?(username)
end
end
def has_no_assignee_named?(username)
within_element(:assignee_block) do
has_no_text?(username)
end
end
def has_avatar_image_count?(count)
wait_assignees_block_finish_loading do
all_elements(:avatar_image, count: count)
......
......@@ -57,6 +57,21 @@ module QA
hash[:weight] = @weight if @weight
end
end
def api_put_path
"/projects/#{project.id}/issues/#{iid}"
end
def set_issue_assignees(assignee_ids:)
put_body = { assignee_ids: assignee_ids }
response = put Runtime::API::Request.new(api_client, api_put_path).url, put_body
unless response.code == HTTP_STATUS_OK
raise ResourceUpdateFailedError, "Could not update issue assignees to #{assignee_ids}. Request returned (#{response.code}): `#{response}`."
end
QA::Runtime::Logger.debug("Successfully updated issue assignees to #{assignee_ids}")
end
end
end
end
# frozen_string_literal: true
module QA
RSpec.describe 'Plan', :requires_admin, :actioncable, :orchestrated do
describe 'Assignees' do
let(:user1) { Resource::User.fabricate_or_use(Runtime::Env.gitlab_qa_username_1, Runtime::Env.gitlab_qa_password_1) }
let(:user2) { Resource::User.fabricate_or_use(Runtime::Env.gitlab_qa_username_2, Runtime::Env.gitlab_qa_password_2) }
let(:project) do
Resource::Project.fabricate_via_api! do |project|
project.name = 'project-to-test-assignees'
end
end
before do
Runtime::Feature.enable('real_time_issue_sidebar', project: project)
Runtime::Feature.enable('broadcast_issue_updates', project: project)
Flow::Login.sign_in
project.add_member(user1)
project.add_member(user2)
end
after do
Runtime::Feature.disable('real_time_issue_sidebar', project: project)
Runtime::Feature.disable('broadcast_issue_updates', project: project)
end
it 'update without refresh', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1048' do
issue = Resource::Issue.fabricate_via_api! do |issue|
issue.project = project
issue.assignee_ids = [user1.id]
end
issue.visit!
Page::Project::Issue::Show.perform do |show|
expect(show).to have_assignee(user1.name)
issue.set_issue_assignees(assignee_ids: [user2.id])
expect(show).to have_assignee(user2.name)
expect(show).to have_no_assignee_named(user1.name)
issue.set_issue_assignees(assignee_ids: [])
expect(show).to have_no_assignee_named(user1.name)
expect(show).to have_no_assignee_named(user2.name)
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