diff --git a/spec/system/consumer/account/cards_spec.rb b/spec/system/consumer/account/cards_spec.rb index 14bd3c35be..b55e8b0b0b 100644 --- a/spec/system/consumer/account/cards_spec.rb +++ b/spec/system/consumer/account/cards_spec.rb @@ -39,9 +39,9 @@ describe "Credit Cards", js: true do it "passes the smoke test" do visit "/account" - find("a", text: /#{I18n.t('spree.users.show.tabs.cards')}/i).click + find("a", text: /Credit Cards/i).click - expect(page).to have_content I18n.t(:saved_cards) + expect(page).to have_content 'Saved cards' # Lists saved cards within(".card#card#{default_card.id}") do @@ -69,7 +69,7 @@ describe "Credit Cards", js: true do expect(find_field('default_card')).to be_checked end - expect(page).to have_content I18n.t('js.default_card_updated') + expect(page).to have_content 'Default Card Updated' expect(default_card.reload.is_default).to be false within(".card#card#{default_card.id}") do @@ -78,17 +78,18 @@ describe "Credit Cards", js: true do expect(non_default_card.reload.is_default).to be true # Shows the interface for adding a card - click_button I18n.t(:add_a_card) + click_button 'Add a Card' expect(page).to have_field 'first_name' expect(page).to have_selector '#card-element.StripeElement' # Allows deletion of cards within(".card#card#{default_card.id}") do - click_button I18n.t(:delete) + click_button 'Delete' end - expect(page).to have_content I18n.t(:card_has_been_removed, - number: "x-#{default_card.last_digits}") + expect(page).to have_content( + format("Your card has been removed (number: %s)", "x-#{default_card.last_digits}") + ) expect(page).to have_no_selector ".card#card#{default_card.id}" # Allows authorisation of card use by shops @@ -96,7 +97,7 @@ describe "Credit Cards", js: true do expect(find_field('allow_charges')).to_not be_checked find_field('allow_charges').click end - expect(page).to have_content I18n.t('js.changes_saved') + expect(page).to have_content 'Changes saved.' expect(customer.reload.allow_charges).to be true end diff --git a/spec/system/consumer/account/payments_spec.rb b/spec/system/consumer/account/payments_spec.rb index 6553d0c08c..16e71da1a9 100644 --- a/spec/system/consumer/account/payments_spec.rb +++ b/spec/system/consumer/account/payments_spec.rb @@ -24,8 +24,8 @@ describe "Payments requiring action", js: true do it "shows a table of payments requiring authorization" do visit "/account" - find("a", text: /#{I18n.t('spree.users.show.tabs.transactions')}/i).click - expect(page).to have_content I18n.t("spree.users.transactions.authorisation_required") + find("a", text: /Transactions/i).click + expect(page).to have_content 'Authorisation Required' end end @@ -37,8 +37,8 @@ describe "Payments requiring action", js: true do it "does not show the table of payments requiring authorization" do visit "/account" - find("a", text: /#{I18n.t('spree.users.show.tabs.transactions')}/i).click - expect(page).to_not have_content I18n.t("spree.users.transactions.authorisation_required") + find("a", text: /Transactions/i).click + expect(page).to_not have_content 'Authorisation Required' end end end diff --git a/spec/system/consumer/account/settings_spec.rb b/spec/system/consumer/account/settings_spec.rb index fa4c1ce132..7aff0a0524 100644 --- a/spec/system/consumer/account/settings_spec.rb +++ b/spec/system/consumer/account/settings_spec.rb @@ -18,8 +18,8 @@ describe "Account Settings", js: true do setup_email login_as user visit "/account" - find("a", text: /#{I18n.t('spree.users.show.tabs.settings')}/i).click - expect(page).to have_content I18n.t('spree.users.form.account_settings') + find("a", text: /Account Settings/i).click + expect(page).to have_content 'Account Settings' end it "allows the user to update their email address" do @@ -27,19 +27,19 @@ describe "Account Settings", js: true do performing_deliveries do expect do - click_button I18n.t(:update) + click_button 'Update' end.to enqueue_job ActionMailer::MailDeliveryJob end expect(enqueued_jobs.last.to_s).to match "new@email.com" - expect(find(".alert-box.success").text.strip).to eq "#{I18n.t('spree.account_updated')}\n×" + expect(find(".alert-box.success").text.strip).to eq "Account updated!\n×" user.reload expect(user.email).to eq 'old@email.com' expect(user.unconfirmed_email).to eq 'new@email.com' - find("a", text: /#{I18n.t('spree.users.show.tabs.settings')}/i).click - expect(page).to have_content I18n.t('spree.users.show.unconfirmed_email', - unconfirmed_email: 'new@email.com') + find("a", text: /Account Settings/i).click + expect(page).to have_content "Pending email confirmation for: %s. \ +Your email address will be updated once the new email is confirmed." % 'new@email.com' end it "allows the user to change their password" do @@ -48,8 +48,8 @@ describe "Account Settings", js: true do fill_in 'user_password', with: 'NewPassword' fill_in 'user_password_confirmation', with: 'NewPassword' - click_button I18n.t(:update) - expect(find(".alert-box.success").text.strip).to eq "#{I18n.t('spree.account_updated')}\n×" + click_button 'Update' + expect(find(".alert-box.success").text.strip).to eq "Account updated!\n×" expect(user.reload.encrypted_password).to_not eq initial_password end diff --git a/spec/system/consumer/account_spec.rb b/spec/system/consumer/account_spec.rb index 1d83fa20f1..1f361a0374 100644 --- a/spec/system/consumer/account_spec.rb +++ b/spec/system/consumer/account_spec.rb @@ -45,9 +45,9 @@ describe ' visit "/account" # No distributors allow changes to orders - expect(page).to have_no_content I18n.t('spree.users.orders.open_orders') + expect(page).to have_no_content 'Open Orders' - expect(page).to have_content I18n.t('spree.users.orders.past_orders') + expect(page).to have_content 'Past Orders' # Lists all other orders expect(page).to have_content d1o1.number.to_s @@ -62,7 +62,7 @@ describe ' href: "#{distributor_credit.permalink}/shop", count: 1) # Viewing transaction history - find("a", text: /#{I18n.t('spree.users.show.tabs.transactions')}/i).click + find("a", text: /Transactions/i).click # It shows all hubs that have been ordered from with balance or credit expect(page).to have_content distributor1.name @@ -91,15 +91,15 @@ describe ' it "shows such orders in a section labelled 'Open Orders'" do visit '/account' - expect(page).to have_content I18n.t('spree.users.orders.open_orders') + expect(page).to have_content 'Open Orders' expect(page).to have_link 'Edit', href: order_path(d1o1) expect(page).to have_link 'Edit', href: order_path(d1o2) expect(page).to have_link(distributor1.name, href: "#{distributor1.permalink}/shop", count: 2) - expect(page).to have_link I18n.t('spree.users.open_orders.cancel'), + expect(page).to have_link 'Cancel', href: cancel_order_path(d1o1) - expect(page).to have_link I18n.t('spree.users.open_orders.cancel'), + expect(page).to have_link 'Cancel', href: cancel_order_path(d1o2) end end @@ -108,7 +108,7 @@ describe ' context "without any completed orders" do it "displays an appropriate message" do visit "/account" - expect(page).to have_content I18n.t(:you_have_no_orders_yet) + expect(page).to have_content 'You have no orders yet' end end diff --git a/spec/system/consumer/authentication_spec.rb b/spec/system/consumer/authentication_spec.rb index c07aeef687..f80e31ad84 100644 --- a/spec/system/consumer/authentication_spec.rb +++ b/spec/system/consumer/authentication_spec.rb @@ -66,17 +66,17 @@ describe "Authentication", js: true do fill_in "Password", with: user.password click_login_button - expect(page).to have_content I18n.t('email_unconfirmed') + expect(page).to have_content 'You must confirm your email address before you can reset your password.' expect do - page.find("a", text: I18n.t('devise.confirmations.resend_confirmation_email')).click + page.find("a", text: 'Resend confirmation email.').click end.to enqueue_job ActionMailer::MailDeliveryJob expect(enqueued_jobs.last.to_s).to match "confirmation_instructions" - expect(page).to have_content I18n.t('devise.confirmations.send_instructions') + expect(page).to have_content 'You will receive an email with instructions about how to confirm your account in a few minutes.' visit spree.spree_user_confirmation_path(confirmation_token: user.confirmation_token) expect(user.reload.confirmed?).to be true - expect(page).to have_text I18n.t('devise.confirmations.confirmed') + expect(page).to have_text 'Thanks for confirming your email! You can now log in.' end end end @@ -114,7 +114,7 @@ describe "Authentication", js: true do expect do click_signup_button - expect(page).to have_content I18n.t('devise.user_registrations.spree_user.signed_up_but_unconfirmed') + expect(page).to have_content 'A message with a confirmation link has been sent to your email address. Please open the link to activate your account.' end.to enqueue_job ActionMailer::MailDeliveryJob end end @@ -150,13 +150,13 @@ describe "Authentication", js: true do it "cannot reset password before confirming email" do fill_in "Your email", with: email click_reset_password_button - expect(page).to have_content I18n.t('email_unconfirmed') - page.find("a", text: I18n.t('devise.confirmations.resend_confirmation_email')).click - expect(page).to have_content I18n.t('devise.confirmations.send_instructions') + expect(page).to have_content 'You must confirm your email address before you can reset your password.' + page.find("a", text: 'Resend confirmation email.').click + expect(page).to have_content 'You will receive an email with instructions about how to confirm your account in a few minutes.' visit spree.spree_user_confirmation_path(confirmation_token: user.confirmation_token) expect(user.reload.confirmed?).to be true - expect(page).to have_text I18n.t('devise.confirmations.confirmed') + expect(page).to have_text 'Thanks for confirming your email! You can now log in.' select_login_tab "Forgot Password?" fill_in "Your email", with: email @@ -205,7 +205,7 @@ describe "Authentication", js: true do it "shows confirmed message in modal" do visit root_path(anchor: "/login", validation: "confirmed") expect(page).to have_login_modal - expect(page).to have_content I18n.t('devise.confirmations.confirmed') + expect(page).to have_content 'Thanks for confirming your email! You can now log in.' end end @@ -230,7 +230,7 @@ describe "Authentication", js: true do fill_in_and_submit_login_form(user) expect_logged_in - expect(page).to have_content I18n.t(:home_shop, locale: :es).upcase + expect(page).to have_content 'COMPRAR AHORA' end end @@ -243,7 +243,7 @@ describe "Authentication", js: true do fill_in_and_submit_login_form(user) expect_logged_in - expect(page).to have_content I18n.t(:home_shop, locale: :en).upcase + expect(page).to have_content 'SHOP NOW' expect(user.reload.locale).to eq "en" end end @@ -259,7 +259,7 @@ describe "Authentication", js: true do fill_in_and_submit_login_form(user) expect_logged_in - expect(page).to have_content I18n.t(:home_shop, locale: :es).upcase + expect(page).to have_content 'COMPRAR AHORA' expect(user.reload.locale).to eq "es" page.driver.remove_cookie("locale") diff --git a/spec/system/consumer/cookies_spec.rb b/spec/system/consumer/cookies_spec.rb index dcfb4c3d23..74ad7bebb6 100644 --- a/spec/system/consumer/cookies_spec.rb +++ b/spec/system/consumer/cookies_spec.rb @@ -62,7 +62,7 @@ describe "Cookies", js: true do scenario "it is not showing" do Spree::Config[:cookies_consent_banner_toggle] = false visit root_path - expect(page).to have_no_content I18n.t('legal.cookies_banner.cookies_usage') + expect(page).to have_no_content 'This site uses cookies in order to make your navigation frictionless and secure, and to help us understand how you use it in order to improve the features we offer.' end end end @@ -124,7 +124,7 @@ describe "Cookies", js: true do end def expect_visible_cookies_policy_page - expect(page).to have_content I18n.t('legal.cookies_policy.header') + expect(page).to have_content 'How We Use Cookies' end def expect_visible_cookies_banner @@ -136,7 +136,7 @@ describe "Cookies", js: true do end def accept_cookies_button_text - I18n.t('legal.cookies_banner.cookies_accept_button') + 'Accept Cookies' end def visit_root_path_and_wait @@ -169,10 +169,10 @@ describe "Cookies", js: true do end def matomo_description_text - I18n.t('legal.cookies_policy.cookie_matomo_basics_desc') + 'Matomo first party cookies to collect statistics.' end def matomo_opt_out_iframe - I18n.t('legal.cookies_policy.statistics_cookies_matomo_optout') + 'Do you want to opt-out of Matomo analytics? We don’t collect any personal data, and Matomo helps us to improve our service, but we respect your choice :-)' end end diff --git a/spec/system/consumer/multilingual_spec.rb b/spec/system/consumer/multilingual_spec.rb index 796ac9c386..75f92d7269 100644 --- a/spec/system/consumer/multilingual_spec.rb +++ b/spec/system/consumer/multilingual_spec.rb @@ -128,9 +128,8 @@ describe 'Multilingual', js: true do find('.language-switcher').click within '.language-switcher .dropdown' do - expect(page).not_to have_link I18n.t('language_name', locale: :en), href: '/locales/en' - expect(page).to have_link I18n.t('language_name', locale: :es, default: 'Language Name'), - href: '/locales/es' + expect(page).not_to have_link 'English', href: '/locales/en' + expect(page).to have_link 'Español', href: '/locales/es' find('li a[href="/locales/es"]').click end diff --git a/spec/system/consumer/registration_spec.rb b/spec/system/consumer/registration_spec.rb index 17329c3169..445540be59 100644 --- a/spec/system/consumer/registration_spec.rb +++ b/spec/system/consumer/registration_spec.rb @@ -161,7 +161,7 @@ describe "Registration", js: true do fill_in "Email", with: user.email fill_in "Password", with: user.password click_button 'Login' - expect(page).to have_content I18n.t('registration.steps.limit_reached.headline') + expect(page).to have_content 'Oh no!' end end end diff --git a/spec/system/consumer/shopping/cart_spec.rb b/spec/system/consumer/shopping/cart_spec.rb index 6e371dd953..d87b430951 100644 --- a/spec/system/consumer/shopping/cart_spec.rb +++ b/spec/system/consumer/shopping/cart_spec.rb @@ -239,7 +239,7 @@ describe "full-page cart", js: true do # shows a relevant Flash message expect(page).to have_selector ".alert-box", - text: I18n.t('spree.orders.error_flash_for_unavailable_items') + text: 'An item in your cart has become unavailable. Please update the selected quantities.' # "Continue Shopping" and "Checkout" buttons are disabled expect(page).to have_selector "a.continue-shopping[disabled=disabled]" @@ -255,7 +255,7 @@ describe "full-page cart", js: true do expect(page).to_not have_selector "#order_line_items_attributes_0_quantity.ng-invalid-stock" expect(page).to have_selector "#update-button.alert" - click_button I18n.t("update") + click_button 'Update' # "Continue Shopping" and "Checkout" buttons are not disabled after cart is updated expect(page).to_not have_selector "a.continue-shopping[disabled=disabled]" @@ -294,7 +294,7 @@ describe "full-page cart", js: true do expect(page).to have_no_content item1.variant.name expect(page).to have_no_content item2.variant.name - expect(page).to have_link I18n.t(:orders_bought_edit_button), href: spree.account_path + expect(page).to have_link 'Edit confirmed items', href: spree.account_path find("td.toggle-bought").click expect(page).to have_content item1.variant.name diff --git a/spec/system/consumer/shopping/checkout_auth_spec.rb b/spec/system/consumer/shopping/checkout_auth_spec.rb index d9aa53581a..eafb3d23b0 100644 --- a/spec/system/consumer/shopping/checkout_auth_spec.rb +++ b/spec/system/consumer/shopping/checkout_auth_spec.rb @@ -110,7 +110,7 @@ describe "As a consumer I want to check out my cart", js: true do end expect(page).to have_selector 'div.login-modal' - expect(page).to have_content I18n.t('devise.failure.already_registered') + expect(page).to have_content 'This email address is already registered. Please log in to continue, or go back and use another email address.' end end end diff --git a/spec/system/consumer/shopping/orders_spec.rb b/spec/system/consumer/shopping/orders_spec.rb index be3452d41b..a82003eca4 100644 --- a/spec/system/consumer/shopping/orders_spec.rb +++ b/spec/system/consumer/shopping/orders_spec.rb @@ -143,7 +143,7 @@ describe "Order Management", js: true do expect(find("tr.variant-#{item1.variant.id}")).to have_content item1.product.name expect(find("tr.variant-#{item2.variant.id}")).to have_content item2.product.name expect(find("tr.variant-#{item3.variant.id}")).to have_content item3.product.name - expect(page).to have_no_button I18n.t(:save_changes) + expect(page).to have_no_button 'Save Changes' end end @@ -158,8 +158,8 @@ describe "Order Management", js: true do it "allows quantity to be changed, items to be removed and the order to be cancelled" do visit order_path(order) - expect(page).to have_button I18n.t(:order_saved), disabled: true - expect(page).to have_no_button I18n.t(:save_changes) + expect(page).to have_button 'Order Saved', disabled: true + expect(page).to have_no_button 'Save Changes' # Changing the quantity of an item within "tr.variant-#{item1.variant.id}" do @@ -171,14 +171,14 @@ describe "Order Management", js: true do fill_in 'order_line_items_attributes_0_quantity', with: 5 end - expect(page).to have_button I18n.t(:save_changes) + expect(page).to have_button 'Save Changes' expect(find("tr.variant-#{item2.variant.id}")).to have_content item2.product.name expect(find("tr.variant-#{item3.variant.id}")).to have_content item3.product.name expect(find("tr.order-adjustment")).to have_content "Shipping" expect(find("tr.order-adjustment")).to have_content "5.00" - click_button I18n.t(:save_changes) + click_button 'Save Changes' expect(find(".order-total.grand-total")).to have_content "115.00" expect(item1.reload.quantity).to eq 5 @@ -193,9 +193,9 @@ describe "Order Management", js: true do # Cancelling the order accept_alert do - click_link(I18n.t(:cancel_order)) + click_link('Cancel Order') end - expect(page).to have_content I18n.t(:orders_show_cancelled) + expect(page).to have_content 'Cancelled' expect(order.reload).to be_canceled end end diff --git a/spec/system/consumer/shopping/shopping_spec.rb b/spec/system/consumer/shopping/shopping_spec.rb index 7c4e42749f..d8e1699e70 100644 --- a/spec/system/consumer/shopping/shopping_spec.rb +++ b/spec/system/consumer/shopping/shopping_spec.rb @@ -677,7 +677,7 @@ describe "As a consumer I want to shop with a distributor", js: true do def expect_out_of_stock_behavior # Shows an "out of stock" modal, with helpful user feedback within(".out-of-stock-modal") do - expect(page).to have_content I18n.t('js.out_of_stock.out_of_stock_text').strip + expect(page).to have_content 'While you\'ve been shopping, the stock levels for one or more of the products in your cart have reduced. Here\'s what\'s changed:' end # Removes the item from the client-side cart and marks the variant as unavailable diff --git a/spec/system/consumer/shopping/unit_price_spec.rb b/spec/system/consumer/shopping/unit_price_spec.rb index c134dd4f4d..5de66229ff 100644 --- a/spec/system/consumer/shopping/unit_price_spec.rb +++ b/spec/system/consumer/shopping/unit_price_spec.rb @@ -39,12 +39,12 @@ describe "As a consumer, I want to check unit price information for a product", find('.question-mark-icon').click expect(page).to have_selector '.joyride-tip-guide.question-mark-tooltip' within '.joyride-tip-guide.question-mark-tooltip' do - expect(page).to have_content I18n.t('js.shopfront.unit_price_tooltip') + expect(page).to have_content 'This is the unit price of this product. It allows you to compare the price of products independent of packaging sizes & weights.' end page.find("body").click expect(page).not_to have_selector '.joyride-tip-guide.question-mark-tooltip' - expect(page).to have_no_content I18n.t('js.shopfront.unit_price_tooltip') + expect(page).to have_no_content 'This is the unit price of this product. It allows you to compare the price of products independent of packaging sizes & weights.' end end @@ -60,11 +60,11 @@ describe "As a consumer, I want to check unit price information for a product", find(".cart-content .question-mark-icon").click expect(page).to have_selector '.joyride-tip-guide.question-mark-tooltip' within '.joyride-tip-guide.question-mark-tooltip' do - expect(page).to have_content I18n.t('js.shopfront.unit_price_tooltip') + expect(page).to have_content 'This is the unit price of this product. It allows you to compare the price of products independent of packaging sizes & weights.' end page.find("body").click expect(page).not_to have_selector '.joyride-tip-guide.question-mark-tooltip' - expect(page).to have_no_content I18n.t('js.shopfront.unit_price_tooltip') + expect(page).to have_no_content 'This is the unit price of this product. It allows you to compare the price of products independent of packaging sizes & weights.' end end end diff --git a/spec/system/consumer/shopping/variant_overrides_spec.rb b/spec/system/consumer/shopping/variant_overrides_spec.rb index 5fbb24de3e..3cd3ae9a15 100644 --- a/spec/system/consumer/shopping/variant_overrides_spec.rb +++ b/spec/system/consumer/shopping/variant_overrides_spec.rb @@ -253,6 +253,6 @@ describe "shopping with variant overrides defined", js: true do def click_checkout toggle_cart wait_for_cart - click_link I18n.t('shared.menu.cart_sidebar.checkout') + click_link 'Checkout' end end diff --git a/spec/system/consumer/user_password_spec.rb b/spec/system/consumer/user_password_spec.rb index a55140b813..ac31691219 100644 --- a/spec/system/consumer/user_password_spec.rb +++ b/spec/system/consumer/user_password_spec.rb @@ -20,7 +20,7 @@ describe "User password confirm/reset page" do visit spree.spree_user_confirmation_path(confirmation_token: user.confirmation_token) expect(user.reload.confirmed?).to be true - expect(page).to have_text I18n.t(:change_my_password) + expect(page).to have_text 'Change my password' fill_in "Password", with: "my secret" fill_in "Password Confirmation", with: "my secret" @@ -34,7 +34,7 @@ describe "User password confirm/reset page" do visit spree.spree_user_confirmation_path(confirmation_token: user.confirmation_token) expect(user.reload.confirmed?).to be true - expect(page).to have_text I18n.t(:change_my_password) + expect(page).to have_text 'Change my password' fill_in "Password", with: "" fill_in "Password Confirmation", with: ""