Skip to content

Commit f850eca

Browse files
Steven Shepherdcguanzon
authored andcommitted
Refactor Group Limit specs to remove redundancy
Test Plan: - Run Specs Change-Id: I099e39d80463c9a64a110dcdab9e5beccf28e093 Reviewed-on: https://gerrit.instructure.com/54899 Tested-by: Jenkins Reviewed-by: Caleb Guanzon <cguanzon@instructure.com> Product-Review: Caleb Guanzon <cguanzon@instructure.com> QA-Review: Caleb Guanzon <cguanzon@instructure.com>
1 parent ee5ad7d commit f850eca

2 files changed

Lines changed: 21 additions & 12 deletions

File tree

spec/selenium/groups_teacher_spec.rb

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -144,25 +144,15 @@
144144
expect(f('.group-category-summary')).to include_text("Groups are limited to 2 members.")
145145

146146
# Creates a group and checks to see if group set's limit is inherited by its groups
147-
f('.btn.add-group').click
148-
wait_for_ajaximations
149-
f('#group_name').send_keys("Test Group")
150-
f('#groupEditSaveButton').click
151-
wait_for_ajaximations
147+
manually_create_group
152148
expect(f('.group-summary')).to include_text("0 / 2 students")
153149
end
154150

155151
it "should allow a teacher to set up a group with member limits", priority: "1", test_id: 94161 do
156152
group_test_setup(3,1,0)
157153
get "/courses/#{@course.id}/groups"
158154

159-
f('.btn.add-group').click
160-
wait_for_ajaximations
161-
f('#group_name').send_keys("Test Group")
162-
f('#group_max_membership').send_keys("2")
163-
wait_for_ajaximations
164-
f('#groupEditSaveButton').click
165-
wait_for_ajaximations
155+
manually_create_group(has_max_membership:true, member_count:2)
166156
expect(f('.group-summary')).to include_text("0 / 2 students")
167157
end
168158
end

spec/selenium/helpers/groups_common.rb

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,25 @@ def create_student_group_as_a_teacher(group_name = "Windfury", enroll_student_co
9393
group
9494
end
9595

96+
def manually_create_group(params={})
97+
default_params = {
98+
group_name:'Test Group',
99+
has_max_membership:false,
100+
member_count:0,
101+
}
102+
params = default_params.merge(params)
103+
104+
f('.btn.add-group').click
105+
wait_for_ajaximations
106+
f('#group_name').send_keys(params[:group_name])
107+
if params[:has_max_membership]
108+
f('#group_max_membership').send_keys(params[:member_count])
109+
wait_for_ajaximations
110+
end
111+
f('#groupEditSaveButton').click
112+
wait_for_ajaximations
113+
end
114+
96115
def delete_group
97116
f(".icon-settings").click
98117
wait_for_animations

0 commit comments

Comments
 (0)