Skip to content
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

Updates and moves consumer/account folder into system #8319

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2711,7 +2711,7 @@ See the %{link} to find out more about %{sitename}'s features and to start using
resolve_errors: Please resolve the following errors
more_items: "+ %{count} More"
default_card_updated: Default Card Updated
default_card_voids_auth: Changing your default card will remove shops' existing authorizations to charge it. You can re-authorize shops after updating the default card. Do you wish to change the default card?"
default_card_voids_auth: Changing your default card will remove shops' existing authorizations to charge it. You can re-authorize shops after updating the default card. Do you wish to change the default card?
cart:
add_to_cart_failed: >
There was a problem adding this product to the cart.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

require 'spec_helper'
require 'system_helper'

describe "Credit Cards", js: true do
include AuthenticationHelper
Expand Down Expand Up @@ -62,9 +62,15 @@
end

# Allows switching of default card
alert_text = <<~TEXT.strip
Changing your default card will remove shops' existing authorizations \
to charge it. You can re-authorize shops after updating the default \
card. Do you wish to change the default card?
TEXT
within(".card#card#{non_default_card.id}") do
find_field('default_card').click
accept_alert
Copy link
Contributor Author

@filipefurtad0 filipefurtad0 Oct 8, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Spec fails with this line, so I removed it - as it is not necessary, the modal is accepted by default.

Regardless of that we now have a warning here which goes:

Modal window with text `Changing your default card will remove shops' existing authorizations to charge it. You can re-authorize shops after updating the default card. Do you wish to change the default card?"` has been opened, but you didn't wrap your code into (`accept_prompt` | `dismiss_prompt` | `accept_confirm` | `dismiss_confirm` | `accept_alert`), accepting by default

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The old spec just called accept_alert once the alert was displayed. But now we need to "expect" an alert before it happens and wrap the alert-causing code in a block. I added a commit to show you how we should use it now.

And as it turns out, it revealed a mistake in the translation file! This is a good example why testing for explicit strings is much better than expect(text).to eq I18n.t(:key).

accept_alert(alert_text) do
find_field('default_card').click
end
expect(find_field('default_card')).to be_checked
end

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

require 'spec_helper'
require 'system_helper'

describe "Payments requiring action", js: true do
include AuthenticationHelper
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

require 'spec_helper'
require 'system_helper'

describe "Account Settings", js: true do
include AuthenticationHelper
Expand Down