Fix tests

This commit is contained in:
aignatov-bio 2019-10-02 13:22:07 +02:00
parent 521a367960
commit 54627faeb3
5 changed files with 6 additions and 14 deletions

View file

@ -89,7 +89,7 @@ var avatarsModal = (function() {
initCropTool(); initCropTool();
initPredefinedAvatars(); initPredefinedAvatars();
initUpdateButton(); initUpdateButton();
$('.user-settings-edit-avatar').click(() => { $('.user-settings-edit-avatar img, .user-settings-edit-avatar').click(() => {
$(modal).modal('show'); $(modal).modal('show');
}); });
} }

View file

@ -72,7 +72,7 @@ class Users::RegistrationsController < Devise::RegistrationsController
yield resource if block_given? yield resource if block_given?
if resource_updated if resource_updated
# Set "needs confirmation" flash if neccesary # Set "needs confirmation" flash if neccesary
if is_flashing_format? if is_flashing_format? || account_update_params['change_avatar']
flash_key = update_needs_confirmation?(resource, prev_unconfirmed_email) ? flash_key = update_needs_confirmation?(resource, prev_unconfirmed_email) ?
:update_needs_confirmation : :updated :update_needs_confirmation : :updated
set_flash_message :notice, flash_key set_flash_message :notice, flash_key

View file

@ -32,7 +32,7 @@
</div> </div>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<div class="btn btn-primary save-button disabled"><%= t('general.save') %></div> <button type="button" class="btn btn-primary save-button disabled"><%= t('general.save') %></button>
</div> </div>
</div> </div>
</div> </div>

View file

@ -18,20 +18,12 @@ Background:
And I click "Settings" link within "#user-account-dropdown" And I click "Settings" link within "#user-account-dropdown"
Then I should see "My profile" Then I should see "My profile"
@javascript
Scenario: Unsuccessful avatar image upload, file is too big
Given I'm on the profile page
Then I click on image within ".avatar-container" element
And I attach a "Moon.png" file to "#user_raw_avatar" field
And I trigger click '#user-avatar-field .btn-success'
And I should see "Your avatar file cannot be larger than 0.2 MB. (Please try again with a smaller file.)" error message
@javascript @javascript
Scenario: Successful upload avatar image Scenario: Successful upload avatar image
Given I'm on the profile page Given I'm on the profile page
Then I click on image within ".avatar-container" element Then I click on image within ".avatar-container" element
And I attach a "Star.png" file to "#user_raw_avatar" field And I attach a "Star.png" file to "#raw_avatar" field
Then I click "Upload" button Then I click "Save" button
And I should see "Your account has been updated successfully" flash message And I should see "Your account has been updated successfully" flash message
@javascript @javascript

View file

@ -69,7 +69,7 @@ end
Then(/^I attach a "([^"]*)" file to "([^"]*)" field$/) do |file, field_id| Then(/^I attach a "([^"]*)" file to "([^"]*)" field$/) do |file, field_id|
wait_for_ajax wait_for_ajax
find(field_id).attach_file(Rails.root.join('features', 'assets', file)) find(field_id, :visible => false).attach_file(Rails.root.join('features', 'assets', file))
# "expensive" operation needs some time :=) # "expensive" operation needs some time :=)
sleep(0.5) sleep(0.5)
end end