2014-09-22 10:30:25 -04:00
|
|
|
class Spinach::Features::Profile < Spinach::FeatureSteps
|
2012-09-10 11:35:03 -04:00
|
|
|
include SharedAuthentication
|
|
|
|
include SharedPaths
|
2012-09-10 05:40:51 -04:00
|
|
|
|
2013-06-26 14:34:20 -04:00
|
|
|
step 'I should see my profile info' do
|
2015-06-12 00:44:13 -04:00
|
|
|
expect(page).to have_content "This information will appear on your profile"
|
2012-09-10 05:40:51 -04:00
|
|
|
end
|
|
|
|
|
2014-01-18 14:07:00 -05:00
|
|
|
step 'I change my profile info' do
|
2015-05-21 04:44:17 -04:00
|
|
|
fill_in 'user_skype', with: 'testskype'
|
|
|
|
fill_in 'user_linkedin', with: 'testlinkedin'
|
|
|
|
fill_in 'user_twitter', with: 'testtwitter'
|
|
|
|
fill_in 'user_website_url', with: 'testurl'
|
|
|
|
fill_in 'user_location', with: 'Ukraine'
|
|
|
|
fill_in 'user_bio', with: 'I <3 GitLab'
|
2016-09-26 12:24:14 -04:00
|
|
|
fill_in 'user_organization', with: 'GitLab'
|
2016-03-01 10:05:57 -05:00
|
|
|
click_button 'Update profile settings'
|
2012-09-10 05:40:51 -04:00
|
|
|
@user.reload
|
|
|
|
end
|
|
|
|
|
2014-01-18 14:07:00 -05:00
|
|
|
step 'I should see new profile info' do
|
2015-05-21 04:44:17 -04:00
|
|
|
expect(@user.skype).to eq 'testskype'
|
|
|
|
expect(@user.linkedin).to eq 'testlinkedin'
|
|
|
|
expect(@user.twitter).to eq 'testtwitter'
|
|
|
|
expect(@user.website_url).to eq 'testurl'
|
|
|
|
expect(@user.bio).to eq 'I <3 GitLab'
|
2016-09-26 12:24:14 -04:00
|
|
|
expect(@user.organization).to eq 'GitLab'
|
2015-06-12 00:44:13 -04:00
|
|
|
expect(find('#user_location').value).to eq 'Ukraine'
|
2012-09-10 05:40:51 -04:00
|
|
|
end
|
|
|
|
|
2013-10-06 14:13:56 -04:00
|
|
|
step 'I change my avatar' do
|
2016-03-15 08:20:54 -04:00
|
|
|
attach_file(:user_avatar, File.join(Rails.root, 'spec', 'fixtures', 'banana_sample.gif'))
|
|
|
|
click_button "Update profile settings"
|
|
|
|
@user.reload
|
2013-10-06 14:13:56 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
step 'I should see new avatar' do
|
2015-06-12 00:44:13 -04:00
|
|
|
expect(@user.avatar).to be_instance_of AvatarUploader
|
2015-12-14 21:53:52 -05:00
|
|
|
expect(@user.avatar.url).to eq "/uploads/user/avatar/#{@user.id}/banana_sample.gif"
|
2013-10-06 14:13:56 -04:00
|
|
|
end
|
|
|
|
|
2013-12-02 13:03:07 -05:00
|
|
|
step 'I should see the "Remove avatar" button' do
|
2015-06-12 00:44:13 -04:00
|
|
|
expect(page).to have_link("Remove avatar")
|
2013-12-02 13:03:07 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
step 'I have an avatar' do
|
2016-03-15 08:20:54 -04:00
|
|
|
attach_file(:user_avatar, File.join(Rails.root, 'spec', 'fixtures', 'banana_sample.gif'))
|
|
|
|
click_button "Update profile settings"
|
|
|
|
@user.reload
|
2013-12-02 13:03:07 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
step 'I remove my avatar' do
|
|
|
|
click_link "Remove avatar"
|
|
|
|
@user.reload
|
|
|
|
end
|
|
|
|
|
|
|
|
step 'I should see my gravatar' do
|
2015-06-18 22:13:32 -04:00
|
|
|
expect(@user.avatar?).to eq false
|
2013-12-02 13:03:07 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
step 'I should not see the "Remove avatar" button' do
|
2015-06-12 00:44:13 -04:00
|
|
|
expect(page).not_to have_link("Remove avatar")
|
2013-12-02 13:03:07 -05:00
|
|
|
end
|
2015-11-03 10:39:09 -05:00
|
|
|
|
2015-08-05 03:48:16 -04:00
|
|
|
step 'I should see the gravatar host link' do
|
|
|
|
expect(page).to have_link("gravatar.com")
|
|
|
|
end
|
2013-12-02 13:03:07 -05:00
|
|
|
|
2013-09-24 03:48:36 -04:00
|
|
|
step 'I try change my password w/o old one' do
|
2015-06-12 01:36:00 -04:00
|
|
|
page.within '.update-password' do
|
2015-01-15 08:02:09 -05:00
|
|
|
fill_in "user_password", with: "22233344"
|
2013-11-25 13:07:55 -05:00
|
|
|
fill_in "user_password_confirmation", with: "22233344"
|
2016-03-01 09:55:39 -05:00
|
|
|
click_button "Save password"
|
2013-09-24 03:48:36 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2013-06-26 14:34:20 -04:00
|
|
|
step 'I change my password' do
|
2015-06-12 01:36:00 -04:00
|
|
|
page.within '.update-password' do
|
2013-11-25 13:07:55 -05:00
|
|
|
fill_in "user_current_password", with: "12345678"
|
2015-01-15 08:02:09 -05:00
|
|
|
fill_in "user_password", with: "22233344"
|
2013-11-25 13:07:55 -05:00
|
|
|
fill_in "user_password_confirmation", with: "22233344"
|
2016-03-01 09:55:39 -05:00
|
|
|
click_button "Save password"
|
2013-02-21 04:27:22 -05:00
|
|
|
end
|
2012-09-10 05:40:51 -04:00
|
|
|
end
|
|
|
|
|
2013-06-26 14:34:20 -04:00
|
|
|
step 'I unsuccessfully change my password' do
|
2015-06-12 01:36:00 -04:00
|
|
|
page.within '.update-password' do
|
2013-11-25 13:07:55 -05:00
|
|
|
fill_in "user_current_password", with: "12345678"
|
2015-01-15 08:02:09 -05:00
|
|
|
fill_in "user_password", with: "password"
|
2013-02-21 04:27:22 -05:00
|
|
|
fill_in "user_password_confirmation", with: "confirmation"
|
2016-03-01 09:55:39 -05:00
|
|
|
click_button "Save password"
|
2013-02-21 04:27:22 -05:00
|
|
|
end
|
2012-11-04 16:47:37 -05:00
|
|
|
end
|
|
|
|
|
2013-09-24 03:48:36 -04:00
|
|
|
step "I should see a missing password error message" do
|
2015-06-18 22:13:32 -04:00
|
|
|
page.within ".flash-container" do
|
|
|
|
expect(page).to have_content "You must provide a valid current password"
|
|
|
|
end
|
2013-09-24 03:48:36 -04:00
|
|
|
end
|
|
|
|
|
2013-06-26 14:34:20 -04:00
|
|
|
step "I should see a password error message" do
|
2016-02-08 17:56:45 -05:00
|
|
|
page.within '.alert-danger' do
|
2015-06-18 22:13:32 -04:00
|
|
|
expect(page).to have_content "Password confirmation doesn't match"
|
|
|
|
end
|
2012-11-04 16:47:37 -05:00
|
|
|
end
|
|
|
|
|
2013-06-26 14:34:20 -04:00
|
|
|
step 'I have activity' do
|
2012-11-05 22:31:55 -05:00
|
|
|
create(:closed_issue_event, author: current_user)
|
2012-09-27 16:23:11 -04:00
|
|
|
end
|
|
|
|
|
2013-06-26 14:34:20 -04:00
|
|
|
step 'I should see my activity' do
|
2015-07-03 07:54:50 -04:00
|
|
|
expect(page).to have_content "Signed in with standard authentication"
|
2012-09-27 16:23:11 -04:00
|
|
|
end
|
2012-11-21 15:01:40 -05:00
|
|
|
|
2013-06-26 14:34:20 -04:00
|
|
|
step 'my password is expired' do
|
|
|
|
current_user.update_attributes(password_expires_at: Time.now - 1.hour)
|
|
|
|
end
|
|
|
|
|
2013-09-17 16:37:36 -04:00
|
|
|
step "I am not an ldap user" do
|
2014-11-27 06:34:39 -05:00
|
|
|
current_user.identities.delete
|
2015-06-18 22:13:32 -04:00
|
|
|
expect(current_user.ldap_user?).to eq false
|
2013-09-17 16:37:36 -04:00
|
|
|
end
|
|
|
|
|
2013-06-26 14:34:20 -04:00
|
|
|
step 'I redirected to expired password page' do
|
2015-06-12 00:44:13 -04:00
|
|
|
expect(current_path).to eq new_profile_password_path
|
2013-06-26 14:34:20 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
step 'I submit new password' do
|
2014-07-29 08:28:20 -04:00
|
|
|
fill_in :user_current_password, with: '12345678'
|
2015-01-15 08:02:09 -05:00
|
|
|
fill_in :user_password, with: '12345678'
|
2013-06-26 14:34:20 -04:00
|
|
|
fill_in :user_password_confirmation, with: '12345678'
|
|
|
|
click_button "Set new password"
|
|
|
|
end
|
|
|
|
|
|
|
|
step 'I redirected to sign in page' do
|
2015-06-12 00:44:13 -04:00
|
|
|
expect(current_path).to eq new_user_session_path
|
2013-06-26 14:34:20 -04:00
|
|
|
end
|
2013-06-26 14:50:47 -04:00
|
|
|
|
2013-10-09 10:01:04 -04:00
|
|
|
step 'I should be redirected to password page' do
|
2015-06-12 00:44:13 -04:00
|
|
|
expect(current_path).to eq edit_profile_password_path
|
2013-10-09 10:01:04 -04:00
|
|
|
end
|
|
|
|
|
2013-09-24 03:48:36 -04:00
|
|
|
step 'I should be redirected to account page' do
|
2015-06-12 00:44:13 -04:00
|
|
|
expect(current_path).to eq profile_account_path
|
2013-09-24 03:48:36 -04:00
|
|
|
end
|
|
|
|
|
2013-06-26 14:50:47 -04:00
|
|
|
step 'I click on my profile picture' do
|
2016-07-05 04:20:01 -04:00
|
|
|
find(:css, '.header-user-dropdown-toggle').click
|
|
|
|
|
|
|
|
page.within ".header-user" do
|
|
|
|
click_link "Profile"
|
|
|
|
end
|
2013-06-26 14:50:47 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
step 'I should see my user page' do
|
2015-11-03 10:39:09 -05:00
|
|
|
page.within ".cover-block" do
|
2015-06-12 00:44:13 -04:00
|
|
|
expect(page).to have_content current_user.name
|
2015-11-03 10:39:09 -05:00
|
|
|
expect(page).to have_content current_user.username
|
2013-06-26 14:50:47 -04:00
|
|
|
end
|
|
|
|
end
|
2014-02-08 00:45:46 -05:00
|
|
|
|
|
|
|
step 'I have group with projects' do
|
2016-05-10 22:58:06 -04:00
|
|
|
@group = create(:group)
|
2014-02-08 00:45:46 -05:00
|
|
|
@group.add_owner(current_user)
|
|
|
|
@project = create(:project, namespace: @group)
|
|
|
|
@event = create(:closed_issue_event, project: @project)
|
2014-07-29 08:28:20 -04:00
|
|
|
|
2014-02-08 00:45:46 -05:00
|
|
|
@project.team << [current_user, :master]
|
|
|
|
end
|
|
|
|
|
|
|
|
step 'I should see groups I belong to' do
|
2015-11-03 10:39:09 -05:00
|
|
|
page.within ".content" do
|
|
|
|
click_link "Groups"
|
|
|
|
end
|
|
|
|
|
|
|
|
page.within "#groups" do
|
|
|
|
expect(page).to have_content @group.name
|
|
|
|
end
|
2014-02-08 00:45:46 -05:00
|
|
|
end
|
2014-12-19 09:15:29 -05:00
|
|
|
|
|
|
|
step 'I should see application form' do
|
2016-03-01 09:37:49 -05:00
|
|
|
expect(page).to have_content "Add new application"
|
2014-12-19 09:15:29 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
step 'I fill application form out and submit' do
|
|
|
|
fill_in :doorkeeper_application_name, with: 'test'
|
|
|
|
fill_in :doorkeeper_application_redirect_uri, with: 'https://test.com'
|
2016-03-01 09:37:49 -05:00
|
|
|
click_on "Save application"
|
2014-12-19 09:15:29 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
step 'I see application' do
|
2015-06-12 00:44:13 -04:00
|
|
|
expect(page).to have_content "Application: test"
|
|
|
|
expect(page).to have_content "Application Id"
|
|
|
|
expect(page).to have_content "Secret"
|
2014-12-19 09:15:29 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
step 'I click edit' do
|
|
|
|
click_on "Edit"
|
|
|
|
end
|
|
|
|
|
|
|
|
step 'I see edit application form' do
|
2015-06-12 00:44:13 -04:00
|
|
|
expect(page).to have_content "Edit application"
|
2014-12-19 09:15:29 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
step 'I change name of application and submit' do
|
2015-06-12 00:44:13 -04:00
|
|
|
expect(page).to have_content "Edit application"
|
2014-12-19 09:15:29 -05:00
|
|
|
fill_in :doorkeeper_application_name, with: 'test_changed'
|
2016-03-01 09:37:49 -05:00
|
|
|
click_on "Save application"
|
2014-12-19 09:15:29 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
step 'I see that application was changed' do
|
2015-06-12 00:44:13 -04:00
|
|
|
expect(page).to have_content "test_changed"
|
|
|
|
expect(page).to have_content "Application Id"
|
|
|
|
expect(page).to have_content "Secret"
|
2014-12-19 09:15:29 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
step 'I click to remove application' do
|
2015-06-12 01:36:00 -04:00
|
|
|
page.within '.oauth-applications' do
|
2014-12-19 09:15:29 -05:00
|
|
|
click_on "Destroy"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
step "I see that application is removed" do
|
2015-06-12 00:44:13 -04:00
|
|
|
expect(page.find(".oauth-applications")).not_to have_content "test_changed"
|
2014-12-19 09:15:29 -05:00
|
|
|
end
|
2012-09-10 05:40:51 -04:00
|
|
|
end
|