-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Admin becoming user password hint#168385051 #712
Admin becoming user password hint#168385051 #712
Conversation
Add admin_only_become_user route to path_helpers Add feature file for admin becoming user password hint Add steps for admin becoming user password hint All tests green
features/step_definitions/admin-becoming-user-password-hint_steps.rb
Outdated
Show resolved
Hide resolved
features/step_definitions/admin-becoming-user-password-hint_steps.rb
Outdated
Show resolved
Hide resolved
features/step_definitions/admin-becoming-user-password-hint_steps.rb
Outdated
Show resolved
Hide resolved
features/step_definitions/admin-becoming-user-password-hint_steps.rb
Outdated
Show resolved
Hide resolved
features/step_definitions/admin-becoming-user-password-hint_steps.rb
Outdated
Show resolved
Hide resolved
features/step_definitions/admin-becoming-user-password-hint_steps.rb
Outdated
Show resolved
Hide resolved
.modal-header | ||
%h5.modal-title= t(".modalTitle") | ||
%button.close{"aria-label" => "Close", "data-dismiss" => "modal", :type => "button"} | ||
%span{"aria-hidden" => "true"} × |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hash attribute should start with one space after the opening brace
Hash attribute should end with one space before the closing brace
@patmbolger - While I was writing cucumber tests for @BasilMawejje, it seemed to me that we have no way to tell if the current user was actually the admin that became this user. The devise_masquerade gem does all of this: allows you to 'become' ("masquerade as") a user and keeps track if the current user was an admin that 'became' this user It has a simple method that we can use to see if the current user has been 'masqueraded': Instead of writing (and maintaining) our own functionality to do keep track of if an admin has 'become' a user, I think that we should use the Don't know if we should create a new PT story and PR or what. But we should all discuss this -- here and/or during the next team meeting. |
…into admin-becoming-user-password-hint#168385051
find('#currentPassword').evaluate_script("$('#currentPassword').focus()") | ||
end | ||
|
||
Then("I should see the text {capture_string}") do |capture_string| |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lint/UnusedBlockArgument: Unused block argument - capture_string. You can omit the argument if you don't care about it.
visit edit_user_registration_path(@user) | ||
end | ||
|
||
Then("I focus on {capture_string}{optional_string}") do |capture_string, optional_string| |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lint/UnusedBlockArgument: Unused block argument - capture_string. You can omit all the arguments if you don't care about them.
Lint/UnusedBlockArgument: Unused block argument - optional_string. You can omit all the arguments if you don't care about them.
visit admin_only_user_profile_edit_path(@user) | ||
end | ||
|
||
Then("I should see {capture_string}{optional_string}") do |capture_string, optional_string| |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lint/UnusedBlockArgument: Unused block argument - capture_string. You can omit all the arguments if you don't care about them.
Lint/UnusedBlockArgument: Unused block argument - optional_string. You can omit all the arguments if you don't care about them.
visit admin_only_become_user_path(@user) | ||
end | ||
|
||
Then("I click {capture_string}") do |capture_string| |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lint/UnusedBlockArgument: Unused block argument - capture_string. You can omit the argument if you don't care about it.
visit admin_only_user_profile_edit_path(@user) | ||
end | ||
|
||
Then("I should navigate to {capture_string}") do |capture_string| |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lint/UnusedBlockArgument: Unused block argument - capture_string. You can omit the argument if you don't care about it.
@@ -0,0 +1,23 @@ | |||
Given("I am on the {capture_string}{optional_string}{optional_string}{capture_string}") do |capture_string, optional_string, optional_string2, capture_string2| |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lint/UnusedBlockArgument: Unused block argument - capture_string. You can omit all the arguments if you don't care about them.
Lint/UnusedBlockArgument: Unused block argument - optional_string. You can omit all the arguments if you don't care about them.
Lint/UnusedBlockArgument: Unused block argument - optional_string2. You can omit all the arguments if you don't care about them.
Lint/UnusedBlockArgument: Unused block argument - capture_string2. You can omit all the arguments if you don't care about them.
visit admin_only_user_profile_edit_path(@user) | ||
end | ||
|
||
Then(/^I should see "([^"]*)" page$/) do |arg| |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lint/UnusedBlockArgument: Unused block argument - arg. You can omit the argument if you don't care about it.
347b529
to
65b12c2
Compare
Change admin become user path Modify spec background to make both users admin in order to work around Pundit error Add login_as to step file to simulate admin become action
|
||
Then("I should navigate to {capture_string}") do |capture_string| | ||
login_as(id = 1) | ||
visit user_path(id = 1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lint/UselessAssignment: Useless assignment to variable - id.
end | ||
|
||
Then("I should navigate to {capture_string}") do |capture_string| | ||
login_as(id = 1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lint/UselessAssignment: Useless assignment to variable - id.
@@ -0,0 +1,24 @@ | |||
Given("I am on the {capture_string}{optional_string}{optional_string}{capture_string}") do |capture_string, optional_string, optional_string2, capture_string2| | |||
visit admin_only_user_profile_edit_path(id = 1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lint/UselessAssignment: Useless assignment to variable - id.
85795d5
to
b879c8b
Compare
@weedySeaDragon In the spec background I made both users admins in order to work around the Pundit::NotDefinedError that comes when an admin becomes a non-admin user in the tests. All tests are green. You can review and give me feedback on the implementation. |
45720c9
to
c6c5fc6
Compare
The system is already doing what it should Once the admin "becomes" a user, the system expects that the password entered is the user's password. Hence we discovered we don't need this PR and are closing it. |
PT Story: Admin: becoming a user UX : needs hint about password
PT URL: https://www.pivotaltracker.com/story/show/168385051
Changes proposed in this pull request:
When an admin becomes a user and clicks 'Edit your profile' in the header dropdown menu, a pop up should come to the screen to remind the admin to use the admin password as the current password. This should happen when the admin sets focus to the current password field.
If the admin uses the tab key to navigate to the current password field, the pop up should still be activated to remind the admin which password to use.
Screenshots (Optional):
Ready for review:
@patmbolger @thesuss @weedySeaDragon