Commit e96e2db0 authored by Doug Stull's avatar Doug Stull Committed by Stan Hu

Remove Members Area of Focus experiment

parent 2ba756c4
......@@ -23,7 +23,6 @@ import {
INVITE_MEMBERS_IN_COMMENT,
GROUP_FILTERS,
USERS_FILTER_ALL,
MEMBER_AREAS_OF_FOCUS,
INVITE_MEMBERS_FOR_TASK,
MODAL_LABELS,
LEARN_GITLAB,
......@@ -101,14 +100,6 @@ export default {
type: String,
required: true,
},
areasOfFocusOptions: {
type: Array,
required: true,
},
noSelectionAreasOfFocus: {
type: Array,
required: true,
},
tasksToBeDoneOptions: {
type: Array,
required: true,
......@@ -126,7 +117,6 @@ export default {
inviteeType: 'members',
newUsersToInvite: [],
selectedDate: undefined,
selectedAreasOfFocus: [],
selectedTasksToBeDone: [],
selectedTaskProject: this.projects[0],
groupToBeSharedWith: {},
......@@ -182,16 +172,6 @@ export default {
this.newUsersToInvite.length === 0 && Object.keys(this.groupToBeSharedWith).length === 0
);
},
areasOfFocusEnabled() {
return !this.tasksToBeDoneEnabled && this.areasOfFocusOptions.length !== 0;
},
areasOfFocusForPost() {
if (this.selectedAreasOfFocus.length === 0 && this.areasOfFocusEnabled) {
return this.noSelectionAreasOfFocus;
}
return this.selectedAreasOfFocus;
},
errorFieldDescription() {
if (this.inviteeType === 'group') {
return '';
......@@ -232,8 +212,6 @@ export default {
this.openModal(options);
if (this.isOnLearnGitlab) {
this.trackEvent(INVITE_MEMBERS_FOR_TASK.name, this.source);
} else {
this.trackEvent(MEMBER_AREAS_OF_FOCUS.name, MEMBER_AREAS_OF_FOCUS.view);
}
});
......@@ -280,8 +258,6 @@ export default {
if (this.source === INVITE_MEMBERS_IN_COMMENT) {
this.trackEvent(INVITE_MEMBERS_IN_COMMENT, 'comment_invite_success');
}
this.trackEvent(MEMBER_AREAS_OF_FOCUS.name, MEMBER_AREAS_OF_FOCUS.submit);
},
trackinviteMembersForTask() {
const label = 'selected_tasks_to_be_done';
......@@ -296,7 +272,6 @@ export default {
this.newUsersToInvite = [];
this.groupToBeSharedWith = {};
this.invalidFeedbackMessage = '';
this.selectedAreasOfFocus = [];
this.selectedTasksToBeDone = [];
[this.selectedTaskProject] = this.projects;
},
......@@ -350,7 +325,6 @@ export default {
email: usersToInviteByEmail,
access_level: this.selectedAccessLevel,
invite_source: this.source,
areas_of_focus: this.areasOfFocusForPost,
tasks_to_be_done: this.tasksToBeDoneForPost,
tasks_project_id: this.tasksProjectForPost,
};
......@@ -361,7 +335,6 @@ export default {
user_id: usersToAddById,
access_level: this.selectedAccessLevel,
invite_source: this.source,
areas_of_focus: this.areasOfFocusForPost,
tasks_to_be_done: this.tasksToBeDoneForPost,
tasks_project_id: this.tasksProjectForPost,
};
......@@ -517,16 +490,6 @@ export default {
</template>
</gl-datepicker>
</div>
<div v-if="areasOfFocusEnabled">
<label class="gl-mt-5">
{{ $options.labels.areasOfFocusLabel }}
</label>
<gl-form-checkbox-group
v-model="selectedAreasOfFocus"
:options="areasOfFocusOptions"
data-testid="area-of-focus-checks"
/>
</div>
<div v-if="showTasksToBeDone" data-testid="invite-members-modal-tasks-to-be-done">
<label class="gl-mt-5">
{{ $options.labels.members.tasksToBeDone.title }}
......
......@@ -3,11 +3,6 @@ import { __, s__ } from '~/locale';
export const SEARCH_DELAY = 200;
export const INVITE_MEMBERS_IN_COMMENT = 'invite_members_in_comment';
export const MEMBER_AREAS_OF_FOCUS = {
name: 'member_areas_of_focus',
view: 'view',
submit: 'submit',
};
export const INVITE_MEMBERS_FOR_TASK = {
minimum_access_level: 30,
name: 'invite_members_for_task',
......@@ -77,9 +72,6 @@ export const READ_MORE_TEXT = s__(
export const INVITE_BUTTON_TEXT = s__('InviteMembersModal|Invite');
export const CANCEL_BUTTON_TEXT = s__('InviteMembersModal|Cancel');
export const HEADER_CLOSE_LABEL = s__('InviteMembersModal|Close invite team members');
export const AREAS_OF_FOCUS_LABEL = s__(
'InviteMembersModal|What would you like new member(s) to focus on? (optional)',
);
export const MODAL_LABELS = {
members: {
......@@ -142,7 +134,6 @@ export const MODAL_LABELS = {
inviteButtonText: INVITE_BUTTON_TEXT,
cancelButtonText: CANCEL_BUTTON_TEXT,
headerCloseLabel: HEADER_CLOSE_LABEL,
areasOfFocusLabel: AREAS_OF_FOCUS_LABEL,
};
export const LEARN_GITLAB = 'learn_gitlab';
......@@ -40,10 +40,8 @@ export default function initInviteMembersModal() {
defaultAccessLevel: parseInt(el.dataset.defaultAccessLevel, 10),
groupSelectFilter: el.dataset.groupsFilter,
groupSelectParentId: parseInt(el.dataset.parentId, 10),
areasOfFocusOptions: JSON.parse(el.dataset.areasOfFocusOptions),
tasksToBeDoneOptions: JSON.parse(el.dataset.tasksToBeDoneOptions || '[]'),
projects: JSON.parse(el.dataset.projects || '[]'),
noSelectionAreasOfFocus: JSON.parse(el.dataset.noSelectionAreasOfFocus),
usersFilter: el.dataset.usersFilter,
filterId: parseInt(el.dataset.filterId, 10),
},
......
......@@ -35,13 +35,6 @@ module InviteMembersHelper
default_access_level: Gitlab::Access::GUEST
}
experiment(:member_areas_of_focus, user: current_user) do |e|
e.publish_to_database
e.control { dataset.merge!(areas_of_focus_options: [], no_selection_areas_of_focus: []) }
e.candidate { dataset.merge!(areas_of_focus_options: member_areas_of_focus_options.to_json, no_selection_areas_of_focus: ['no_selection']) }
end
if show_invite_members_for_task?(source)
dataset.merge!(
tasks_to_be_done_options: tasks_to_be_done_options.to_json,
......@@ -55,26 +48,6 @@ module InviteMembersHelper
private
def member_areas_of_focus_options
[
{
value: 'Contribute to the codebase', text: s_('InviteMembersModal|Contribute to the codebase')
},
{
value: 'Collaborate on open issues and merge requests', text: s_('InviteMembersModal|Collaborate on open issues and merge requests')
},
{
value: 'Configure CI/CD', text: s_('InviteMembersModal|Configure CI/CD')
},
{
value: 'Configure security features', text: s_('InviteMembersModal|Configure security features')
},
{
value: 'Other', text: s_('InviteMembersModal|Other')
}
]
end
# Overridden in EE
def users_filter_data(group)
{}
......
......@@ -92,7 +92,6 @@ module Members
super
track_invite_source(member)
track_areas_of_focus(member)
end
def track_invite_source(member)
......@@ -110,12 +109,6 @@ module Members
member.invite? ? 'net_new_user' : 'existing_user'
end
def track_areas_of_focus(member)
areas_of_focus.each do |area_of_focus|
Gitlab::Tracking.event(self.class.name, 'area_of_focus', label: area_of_focus, property: member.id.to_s)
end
end
def create_tasks_to_be_done
return if params[:tasks_to_be_done].blank? || params[:tasks_project_id].blank?
......@@ -128,10 +121,6 @@ module Members
TasksToBeDone::CreateWorker.perform_async(member_task.id, current_user.id, valid_members.map(&:user_id))
end
def areas_of_focus
params[:areas_of_focus] || []
end
def user_limit
limit = params.fetch(:limit, DEFAULT_INVITE_LIMIT)
......
---
name: member_areas_of_focus
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/65273
rollout_issue_url: https://gitlab.com/gitlab-org/growth/team-tasks/-/issues/406
milestone: '14.2'
type: experiment
group: group::expansion
default_enabled: false
......@@ -42,7 +42,6 @@ POST /projects/:id/invitations
| `access_level` | integer | yes | A valid access level |
| `expires_at` | string | no | A date string in the format YEAR-MONTH-DAY |
| `invite_source` | string | no | The source of the invitation that starts the member creation process. See [this issue](https://gitlab.com/gitlab-org/gitlab/-/issues/327120). |
| `areas_of_focus` | string | no | Areas the inviter wants the member to focus upon. |
| `tasks_to_be_done` | array of strings | no | Tasks the inviter wants the member to focus on. The tasks are added as issues to a specified project. The possible values are: `ci`, `code` and `issues`. If specified, requires `tasks_project_id`. [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/69299) in GitLab 14.6 |
| `tasks_project_id` | integer | no | The project ID in which to create the task issues. If specified, requires `tasks_to_be_done`. [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/69299) in GitLab 14.6 |
......
......@@ -429,7 +429,6 @@ POST /projects/:id/members
| `access_level` | integer | yes | A valid access level |
| `expires_at` | string | no | A date string in the format `YEAR-MONTH-DAY` |
| `invite_source` | string | no | The source of the invitation that starts the member creation process. See [this issue](https://gitlab.com/gitlab-org/gitlab/-/issues/327120). |
| `areas_of_focus` | string | no | Areas the inviter wants the member to focus upon. |
| `tasks_to_be_done` | array of strings | no | Tasks the inviter wants the member to focus on. The tasks are added as issues to a specified project. The possible values are: `ci`, `code` and `issues`. If specified, requires `tasks_project_id`. [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/69299) in GitLab 14.5 [with a flag](../administration/feature_flags.md) named `invite_members_for_task`. Disabled by default. |
| `tasks_project_id` | integer | no | The project ID in which to create the task issues. If specified, requires `tasks_to_be_done`. [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/69299) in GitLab 14.5 [with a flag](../administration/feature_flags.md) named `invite_members_for_task`. Disabled by default. |
......
......@@ -24,7 +24,6 @@ module API
requires :access_level, type: Integer, values: Gitlab::Access.all_values, desc: 'A valid access level (defaults: `30`, developer access level)'
optional :expires_at, type: DateTime, desc: 'Date string in the format YEAR-MONTH-DAY'
optional :invite_source, type: String, desc: 'Source that triggered the member creation process', default: 'invitations-api'
optional :areas_of_focus, type: Array[String], coerce_with: Validations::Types::CommaSeparatedToArray.coerce, desc: 'Areas the inviter wants the member to focus upon'
optional :tasks_to_be_done, type: Array[String], coerce_with: Validations::Types::CommaSeparatedToArray.coerce, desc: 'Tasks the inviter wants the member to do'
optional :tasks_project_id, type: Integer, desc: 'The project ID in which to create the task issues'
end
......
......@@ -95,7 +95,6 @@ module API
requires :user_id, types: [Integer, String], desc: 'The user ID of the new member or multiple IDs separated by commas.'
optional :expires_at, type: DateTime, desc: 'Date string in the format YEAR-MONTH-DAY'
optional :invite_source, type: String, desc: 'Source that triggered the member creation process', default: 'members-api'
optional :areas_of_focus, type: Array[String], coerce_with: Validations::Types::CommaSeparatedToArray.coerce, desc: 'Areas the inviter wants the member to focus upon'
optional :tasks_to_be_done, type: Array[String], coerce_with: Validations::Types::CommaSeparatedToArray.coerce, desc: 'Tasks the inviter wants the member to do'
optional :tasks_project_id, type: Integer, desc: 'The project ID in which to create the task issues'
end
......
......@@ -19071,21 +19071,9 @@ msgstr ""
msgid "InviteMembersModal|Close invite team members"
msgstr ""
msgid "InviteMembersModal|Collaborate on open issues and merge requests"
msgstr ""
msgid "InviteMembersModal|Configure CI/CD"
msgstr ""
msgid "InviteMembersModal|Configure security features"
msgstr ""
msgid "InviteMembersModal|Congratulations on creating your project, you're almost there!"
msgstr ""
msgid "InviteMembersModal|Contribute to the codebase"
msgstr ""
msgid "InviteMembersModal|Create issues for your new team member to work on (optional)"
msgstr ""
......@@ -19110,9 +19098,6 @@ msgstr ""
msgid "InviteMembersModal|Members were successfully added"
msgstr ""
msgid "InviteMembersModal|Other"
msgstr ""
msgid "InviteMembersModal|Search for a group to invite"
msgstr ""
......@@ -19131,9 +19116,6 @@ msgstr ""
msgid "InviteMembersModal|To assign issues to a new team member, you need a project for the issues. %{linkStart}Create a project to get started.%{linkEnd}"
msgstr ""
msgid "InviteMembersModal|What would you like new member(s) to focus on? (optional)"
msgstr ""
msgid "InviteMembersModal|You're inviting a group to the %{strongStart}%{name}%{strongEnd} group."
msgstr ""
......
......@@ -85,33 +85,6 @@ RSpec.describe 'Groups > Members > Manage members' do
property: 'existing_user',
user: user1
)
expect_no_snowplow_event(
category: 'Members::CreateService',
action: 'area_of_focus'
)
end
it 'adds a user to group with area_of_focus', :js, :snowplow, :aggregate_failures do
stub_experiments(member_areas_of_focus: :candidate)
group.add_owner(user1)
visit group_group_members_path(group)
invite_member(user2.name, role: 'Reporter', area_of_focus: true)
wait_for_requests
expect_snowplow_event(
category: 'Members::CreateService',
action: 'area_of_focus',
label: 'Contribute to the codebase',
property: group.members.last.id.to_s
)
expect_snowplow_event(
category: 'Members::CreateService',
action: 'area_of_focus',
label: 'Collaborate on open issues and merge requests',
property: group.members.last.id.to_s
)
end
it 'do not disclose email addresses', :js do
......@@ -221,36 +194,9 @@ RSpec.describe 'Groups > Members > Manage members' do
property: 'net_new_user',
user: user1
)
expect_no_snowplow_event(
category: 'Members::CreateService',
action: 'area_of_focus'
)
end
end
it 'invite user to group with area_of_focus', :js, :snowplow, :aggregate_failures do
stub_experiments(member_areas_of_focus: :candidate)
group.add_owner(user1)
visit group_group_members_path(group)
invite_member('test@example.com', role: 'Reporter', area_of_focus: true)
wait_for_requests
expect_snowplow_event(
category: 'Members::InviteService',
action: 'area_of_focus',
label: 'Contribute to the codebase',
property: group.members.last.id.to_s
)
expect_snowplow_event(
category: 'Members::InviteService',
action: 'area_of_focus',
label: 'Collaborate on open issues and merge requests',
property: group.members.last.id.to_s
)
end
context 'when user is a guest' do
before do
group.add_guest(user1)
......
......@@ -6,7 +6,6 @@ import {
GlSprintf,
GlLink,
GlModal,
GlFormCheckboxGroup,
} from '@gitlab/ui';
import MockAdapter from 'axios-mock-adapter';
import { stubComponent } from 'helpers/stub_component';
......@@ -19,7 +18,6 @@ import ModalConfetti from '~/invite_members/components/confetti.vue';
import MembersTokenSelect from '~/invite_members/components/members_token_select.vue';
import {
INVITE_MEMBERS_IN_COMMENT,
MEMBER_AREAS_OF_FOCUS,
INVITE_MEMBERS_FOR_TASK,
CANCEL_BUTTON_TEXT,
INVITE_BUTTON_TEXT,
......@@ -52,12 +50,7 @@ const inviteeType = 'members';
const accessLevels = { Guest: 10, Reporter: 20, Developer: 30, Maintainer: 40, Owner: 50 };
const defaultAccessLevel = 10;
const inviteSource = 'unknown';
const noSelectionAreasOfFocus = ['no_selection'];
const helpLink = 'https://example.com';
const areasOfFocusOptions = [
{ text: 'area1', value: 'area1' },
{ text: 'area2', value: 'area2' },
];
const tasksToBeDoneOptions = [
{ text: 'First task', value: 'first' },
{ text: 'Second task', value: 'second' },
......@@ -96,9 +89,7 @@ const createComponent = (data = {}, props = {}) => {
isProject,
inviteeType,
accessLevels,
areasOfFocusOptions,
defaultAccessLevel,
noSelectionAreasOfFocus,
tasksToBeDoneOptions,
projects,
helpLink,
......@@ -164,7 +155,6 @@ describe('InviteMembersModal', () => {
const membersFormGroupInvalidFeedback = () => findMembersFormGroup().props('invalidFeedback');
const membersFormGroupDescription = () => findMembersFormGroup().props('description');
const findMembersSelect = () => wrapper.findComponent(MembersTokenSelect);
const findAreaofFocusCheckBoxGroup = () => wrapper.findComponent(GlFormCheckboxGroup);
const findTasksToBeDone = () => wrapper.findByTestId('invite-members-modal-tasks-to-be-done');
const findTasks = () => wrapper.findByTestId('invite-members-modal-tasks');
const findProjectSelect = () => wrapper.findByTestId('invite-members-modal-project-select');
......@@ -215,21 +205,6 @@ describe('InviteMembersModal', () => {
});
});
describe('rendering the areas_of_focus', () => {
it('renders the areas_of_focus checkboxes', () => {
createComponent();
expect(findAreaofFocusCheckBoxGroup().props('options')).toBe(areasOfFocusOptions);
expect(findAreaofFocusCheckBoxGroup().exists()).toBe(true);
});
it('does not render the areas_of_focus checkboxes', () => {
createComponent({}, { areasOfFocusOptions: [] });
expect(findAreaofFocusCheckBoxGroup().exists()).toBe(false);
});
});
describe('rendering the tasks to be done', () => {
const setupComponent = (
extraData = {},
......@@ -442,20 +417,6 @@ describe('InviteMembersModal', () => {
"The member's email address is not allowed for this project. Go to the Admin area > Sign-up restrictions, and check Allowed domains for sign-ups.";
const expectedSyntaxError = 'email contains an invalid email address';
it('calls the API with the expected focus data when an areas_of_focus checkbox is clicked', () => {
const spy = jest.spyOn(Api, 'addGroupMembersByUserId');
const expectedFocus = [areasOfFocusOptions[0].value];
createComponent({ newUsersToInvite: [user1] });
findAreaofFocusCheckBoxGroup().vm.$emit('input', expectedFocus);
clickInviteButton();
expect(spy).toHaveBeenCalledWith(
user1.id.toString(),
expect.objectContaining({ areas_of_focus: expectedFocus }),
);
});
describe('when inviting an existing user to group by user ID', () => {
const postData = {
user_id: '1,2',
......@@ -463,7 +424,6 @@ describe('InviteMembersModal', () => {
expires_at: undefined,
invite_source: inviteSource,
format: 'json',
areas_of_focus: noSelectionAreasOfFocus,
tasks_to_be_done: [],
tasks_project_id: '',
};
......@@ -476,16 +436,6 @@ describe('InviteMembersModal', () => {
jest.spyOn(Api, 'addGroupMembersByUserId').mockResolvedValue({ data: postData });
});
it('includes the non-default selected areas of focus', () => {
const focus = ['abc'];
const updatedPostData = { ...postData, areas_of_focus: focus };
wrapper.setData({ selectedAreasOfFocus: focus });
clickInviteButton();
expect(Api.addGroupMembersByUserId).toHaveBeenCalledWith(id, updatedPostData);
});
describe('when triggered from regular mounting', () => {
beforeEach(() => {
clickInviteButton();
......@@ -661,7 +611,6 @@ describe('InviteMembersModal', () => {
expires_at: undefined,
email: 'email@example.com',
invite_source: inviteSource,
areas_of_focus: noSelectionAreasOfFocus,
tasks_to_be_done: [],
tasks_project_id: '',
format: 'json',
......@@ -675,16 +624,6 @@ describe('InviteMembersModal', () => {
jest.spyOn(Api, 'inviteGroupMembersByEmail').mockResolvedValue({ data: postData });
});
it('includes the non-default selected areas of focus', () => {
const focus = ['abc'];
const updatedPostData = { ...postData, areas_of_focus: focus };
wrapper.setData({ selectedAreasOfFocus: focus });
clickInviteButton();
expect(Api.inviteGroupMembersByEmail).toHaveBeenCalledWith(id, updatedPostData);
});
describe('when triggered from regular mounting', () => {
beforeEach(() => {
clickInviteButton();
......@@ -792,7 +731,6 @@ describe('InviteMembersModal', () => {
access_level: defaultAccessLevel,
expires_at: undefined,
invite_source: inviteSource,
areas_of_focus: noSelectionAreasOfFocus,
format: 'json',
tasks_to_be_done: [],
tasks_project_id: '',
......@@ -951,30 +889,12 @@ describe('InviteMembersModal', () => {
expect(ExperimentTracking).not.toHaveBeenCalledWith(INVITE_MEMBERS_IN_COMMENT);
});
it('tracks the view for areas_of_focus', () => {
eventHub.$emit('openModal', { inviteeType: 'members' });
expect(ExperimentTracking).toHaveBeenCalledWith(MEMBER_AREAS_OF_FOCUS.name);
expect(ExperimentTracking.prototype.event).toHaveBeenCalledWith(MEMBER_AREAS_OF_FOCUS.view);
});
it('tracks the view for learn_gitlab source', () => {
eventHub.$emit('openModal', { inviteeType: 'members', source: LEARN_GITLAB });
expect(ExperimentTracking).toHaveBeenCalledWith(INVITE_MEMBERS_FOR_TASK.name);
expect(ExperimentTracking.prototype.event).toHaveBeenCalledWith(LEARN_GITLAB);
});
it('tracks the invite for areas_of_focus', () => {
eventHub.$emit('openModal', { inviteeType: 'members' });
clickInviteButton();
expect(ExperimentTracking).toHaveBeenCalledWith(MEMBER_AREAS_OF_FOCUS.name);
expect(ExperimentTracking.prototype.event).toHaveBeenCalledWith(
MEMBER_AREAS_OF_FOCUS.submit,
);
});
});
});
});
......@@ -16,52 +16,14 @@ RSpec.describe InviteMembersHelper do
end
describe '#common_invite_modal_dataset' do
context 'when member_areas_of_focus is enabled', :experiment do
context 'with control experience' do
before do
stub_experiments(member_areas_of_focus: :control)
end
it 'has expected attributes' do
attributes = {
areas_of_focus_options: [],
no_selection_areas_of_focus: []
}
expect(helper.common_invite_modal_dataset(project)).to include(attributes)
end
end
context 'with candidate experience' do
before do
stub_experiments(member_areas_of_focus: :candidate)
end
it 'has expected attributes', :aggregate_failures do
output = helper.common_invite_modal_dataset(project)
expect(output[:no_selection_areas_of_focus]).to eq ['no_selection']
expect(Gitlab::Json.parse(output[:areas_of_focus_options]).first['value']).to eq 'Contribute to the codebase'
end
end
end
context 'when member_areas_of_focus is disabled' do
before do
stub_feature_flags(member_areas_of_focus: false)
end
it 'has expected attributes' do
attributes = {
id: project.id,
name: project.name,
default_access_level: Gitlab::Access::GUEST,
areas_of_focus_options: [],
no_selection_areas_of_focus: []
}
expect(helper.common_invite_modal_dataset(project)).to include(attributes)
end
it 'has expected common attributes' do
attributes = {
id: project.id,
name: project.name,
default_access_level: Gitlab::Access::GUEST
}
expect(helper.common_invite_modal_dataset(project)).to include(attributes)
end
context 'tasks_to_be_done' do
......
......@@ -152,20 +152,6 @@ RSpec.describe API::Invitations do
end
end
context 'with areas_of_focus', :snowplow do
it 'tracks the areas_of_focus from params' do
post invitations_url(source, maintainer),
params: { email: email, access_level: Member::DEVELOPER, areas_of_focus: 'Other' }
expect_snowplow_event(
category: 'Members::InviteService',
action: 'area_of_focus',
label: 'Other',
property: source.members.last.id.to_s
)
end
end
context 'with tasks_to_be_done and tasks_project_id in the params' do
let(:project_id) { source_type == 'project' ? source.id : create(:project, namespace: source).id }
......
......@@ -387,33 +387,6 @@ RSpec.describe API::Members do
end
end
context 'with areas_of_focus considerations', :snowplow do
let(:user_id) { stranger.id }
context 'when areas_of_focus is present in params' do
it 'tracks the areas_of_focus' do
post api("/#{source_type.pluralize}/#{source.id}/members", maintainer),
params: { user_id: user_id, access_level: Member::DEVELOPER, areas_of_focus: 'Other' }
expect_snowplow_event(
category: 'Members::CreateService',
action: 'area_of_focus',
label: 'Other',
property: source.members.last.id.to_s
)
end
end
context 'when areas_of_focus is not present in params' do
it 'does not track the areas_of_focus' do
post api("/#{source_type.pluralize}/#{source.id}/members", maintainer),
params: { user_id: user_id, access_level: Member::DEVELOPER }
expect_no_snowplow_event(category: 'Members::CreateService', action: 'area_of_focus')
end
end
end
context 'with tasks_to_be_done and tasks_project_id in the params' do
let(:project_id) { source_type == 'project' ? source.id : create(:project, namespace: source).id }
......
......@@ -127,76 +127,6 @@ RSpec.describe Members::CreateService, :aggregate_failures, :clean_gitlab_redis_
end
end
context 'when tracking the areas of focus', :snowplow do
context 'when areas_of_focus is not passed' do
it 'does not track' do
execute_service
expect_no_snowplow_event(category: described_class.name, action: 'area_of_focus')
end
end
context 'when 1 areas_of_focus is passed' do
let(:additional_params) { { invite_source: '_invite_source_', areas_of_focus: ['no_selection'] } }
it 'tracks the areas_of_focus from params' do
execute_service
expect_snowplow_event(
category: described_class.name,
action: 'area_of_focus',
label: 'no_selection',
property: source.members.last.id.to_s
)
end
context 'when passing many user ids' do
let(:another_user) { create(:user) }
let(:user_ids) { [member.id, another_user.id].join(',') }
it 'tracks the areas_of_focus from params' do
execute_service
members = source.members.last(2)
expect_snowplow_event(
category: described_class.name,
action: 'area_of_focus',
label: 'no_selection',
property: members.first.id.to_s
)
expect_snowplow_event(
category: described_class.name,
action: 'area_of_focus',
label: 'no_selection',
property: members.last.id.to_s
)
end
end
end
context 'when multiple areas_of_focus are passed' do
let(:additional_params) { { invite_source: '_invite_source_', areas_of_focus: %w[no_selection Other] } }
it 'tracks the areas_of_focus from params' do
execute_service
expect_snowplow_event(
category: described_class.name,
action: 'area_of_focus',
label: 'no_selection',
property: source.members.last.id.to_s
)
expect_snowplow_event(
category: described_class.name,
action: 'area_of_focus',
label: 'Other',
property: source.members.last.id.to_s
)
end
end
end
context 'when assigning tasks to be done' do
let(:additional_params) do
{ invite_source: '_invite_source_', tasks_to_be_done: %w(ci code), tasks_project_id: source.id }
......
......@@ -5,7 +5,7 @@ module Spec
module Helpers
module Features
module InviteMembersModalHelper
def invite_member(name, role: 'Guest', expires_at: nil, area_of_focus: false)
def invite_member(name, role: 'Guest', expires_at: nil)
click_on 'Invite members'
page.within '[data-testid="invite-members-modal"]' do
......@@ -14,7 +14,6 @@ module Spec
wait_for_requests
click_button name
choose_options(role, expires_at)
choose_area_of_focus if area_of_focus
click_button 'Invite'
......@@ -44,13 +43,6 @@ module Spec
fill_in 'YYYY-MM-DD', with: expires_at.strftime('%Y-%m-%d') if expires_at
end
def choose_area_of_focus
page.within '[data-testid="area-of-focus-checks"]' do
check 'Contribute to the codebase'
check 'Collaborate on open issues and merge requests'
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