summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2018-05-28 18:02:04 +0300
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2018-05-28 18:02:04 +0300
commitfcdf3931811845ee7b214ab8ad97118d7eb7adb8 (patch)
treeb48cdf0bf1f631a9ea2bafeca9e8cbeeed7286d0
parentba6384e7c7aedc2402fee8d6f2feeee743e5c14f (diff)
downloadgitlab-ce-fcdf3931811845ee7b214ab8ad97118d7eb7adb8.tar.gz
Fix tests after group settings page redesign
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
-rw-r--r--app/views/groups/edit.html.haml6
-rw-r--r--app/views/groups/settings/_advanced.html.haml2
-rw-r--r--spec/features/groups/group_settings_spec.rb21
-rw-r--r--spec/features/groups/share_lock_spec.rb31
-rw-r--r--spec/features/groups_spec.rb2
-rw-r--r--spec/features/uploads/user_uploads_avatar_to_group_spec.rb4
6 files changed, 44 insertions, 22 deletions
diff --git a/app/views/groups/edit.html.haml b/app/views/groups/edit.html.haml
index 390ef3f62c7..3c1f45faf2c 100644
--- a/app/views/groups/edit.html.haml
+++ b/app/views/groups/edit.html.haml
@@ -3,7 +3,7 @@
- expanded = Rails.env.test?
-%section.settings.as-general.no-animate#js-general-settings{ class: ('expanded' if expanded) }
+%section.settings.gs-general.no-animate#js-general-settings{ class: ('expanded' if expanded) }
.settings-header
%h4
= _('General group settings')
@@ -14,7 +14,7 @@
.settings-content
= render 'groups/settings/general'
-%section.settings.as-permissions.no-animate#js-permissions-settings{ class: ('expanded' if expanded) }
+%section.settings.gs-permissions.no-animate#js-permissions-settings{ class: ('expanded' if expanded) }
.settings-header
%h4
= _('Permissions')
@@ -25,7 +25,7 @@
.settings-content
= render 'groups/settings/permissions'
-%section.settings.as-advanced-settings.no-animate#js-advanced-settings{ class: ('expanded' if expanded) }
+%section.settings.gs-advanced.no-animate#js-advanced-settings{ class: ('expanded' if expanded) }
.settings-header
%h4
= _('Advanced settings')
diff --git a/app/views/groups/settings/_advanced.html.haml b/app/views/groups/settings/_advanced.html.haml
index ddefb98e671..b7c673db705 100644
--- a/app/views/groups/settings/_advanced.html.haml
+++ b/app/views/groups/settings/_advanced.html.haml
@@ -9,7 +9,7 @@
= link_to 'Learn more', help_page_path('user/group/index', anchor: 'changing-a-groups-path'), target: '_blank'
.input-group.gl-field-error-anchor
- .group-root-path.input-group-prepend.has-tooltip{ title: group_path, :'data-placement' => 'bottom' }
+ .group-root-path.input-group-prepend.has-tooltip{ title: group_path(@group), :'data-placement' => 'bottom' }
.input-group-text
%span>= root_url
- if parent
diff --git a/spec/features/groups/group_settings_spec.rb b/spec/features/groups/group_settings_spec.rb
index 1ce30015e81..bf329b0bb94 100644
--- a/spec/features/groups/group_settings_spec.rb
+++ b/spec/features/groups/group_settings_spec.rb
@@ -83,7 +83,7 @@ feature 'Edit group settings' do
attach_file(:group_avatar, Rails.root.join('spec', 'fixtures', 'banana_sample.gif'))
- expect { click_button 'Save group' }.to change { group.reload.avatar? }.to(true)
+ expect { save_group }.to change { group.reload.avatar? }.to(true)
end
it 'uploads new group avatar' do
@@ -97,10 +97,19 @@ feature 'Edit group settings' do
expect(page).not_to have_link('Remove avatar')
end
end
-end
-def update_path(new_group_path)
- visit edit_group_path(group)
- fill_in 'group_path', with: new_group_path
- click_button 'Save group'
+ def update_path(new_group_path)
+ visit edit_group_path(group)
+
+ page.within('.gs-advanced') do
+ fill_in 'group_path', with: new_group_path
+ click_button 'Change group path'
+ end
+ end
+
+ def save_group
+ page.within('.gs-general') do
+ click_button 'Save group'
+ end
+ end
end
diff --git a/spec/features/groups/share_lock_spec.rb b/spec/features/groups/share_lock_spec.rb
index 8842d1391aa..cefbc15e068 100644
--- a/spec/features/groups/share_lock_spec.rb
+++ b/spec/features/groups/share_lock_spec.rb
@@ -15,9 +15,8 @@ feature 'Group share with group lock' do
context 'when enabling the parent group share with group lock' do
scenario 'the subgroup share with group lock becomes enabled' do
visit edit_group_path(root_group)
- check 'group_share_with_group_lock'
- click_on 'Save group'
+ enable_group_lock
expect(subgroup.reload.share_with_group_lock?).to be_truthy
end
@@ -26,16 +25,15 @@ feature 'Group share with group lock' do
context 'when disabling the parent group share with group lock (which was already enabled)' do
background do
visit edit_group_path(root_group)
- check 'group_share_with_group_lock'
- click_on 'Save group'
+
+ enable_group_lock
end
context 'and the subgroup share with group lock is enabled' do
scenario 'the subgroup share with group lock does not change' do
visit edit_group_path(root_group)
- uncheck 'group_share_with_group_lock'
- click_on 'Save group'
+ disable_group_lock
expect(subgroup.reload.share_with_group_lock?).to be_truthy
end
@@ -44,19 +42,32 @@ feature 'Group share with group lock' do
context 'but the subgroup share with group lock is disabled' do
background do
visit edit_group_path(subgroup)
- uncheck 'group_share_with_group_lock'
- click_on 'Save group'
+
+ disable_group_lock
end
scenario 'the subgroup share with group lock does not change' do
visit edit_group_path(root_group)
- uncheck 'group_share_with_group_lock'
- click_on 'Save group'
+ disable_group_lock
expect(subgroup.reload.share_with_group_lock?).to be_falsey
end
end
end
end
+
+ def enable_group_lock
+ page.within('.gs-permissions') do
+ check 'group_share_with_group_lock'
+ click_on 'Save group'
+ end
+ end
+
+ def disable_group_lock
+ page.within('.gs-permissions') do
+ uncheck 'group_share_with_group_lock'
+ click_on 'Save group'
+ end
+ end
end
diff --git a/spec/features/groups_spec.rb b/spec/features/groups_spec.rb
index 185770c312f..236768b5d7f 100644
--- a/spec/features/groups_spec.rb
+++ b/spec/features/groups_spec.rb
@@ -141,7 +141,7 @@ feature 'Group' do
end
it 'saves new settings' do
- page.within('.as-general') do
+ page.within('.gs-general') do
fill_in 'group_name', with: new_name
click_button 'Save group'
end
diff --git a/spec/features/uploads/user_uploads_avatar_to_group_spec.rb b/spec/features/uploads/user_uploads_avatar_to_group_spec.rb
index e8884bc1a00..c8db82a562f 100644
--- a/spec/features/uploads/user_uploads_avatar_to_group_spec.rb
+++ b/spec/features/uploads/user_uploads_avatar_to_group_spec.rb
@@ -14,7 +14,9 @@ feature 'User uploads avatar to group' do
visible: false
)
- click_button 'Save group'
+ page.within('.gs-general') do
+ click_button 'Save group'
+ end
visit group_path(group)