Use labels in language selector tests

This way the test verifies there's a label associated to that form
field.
This commit is contained in:
Javi Martín
2021-06-25 20:05:31 +02:00
parent 554bc926c7
commit 93c521bd29
8 changed files with 38 additions and 50 deletions

View File

@@ -12,26 +12,21 @@ describe "Localization" do
scenario "Available locales appear in the locale switcher" do
login_as_manager
within(".locale-form .js-location-changer") do
expect(page).to have_content "Español"
expect(page).to have_content "English"
end
expect(page).to have_select "Language:", with_options: %w[Español English]
end
scenario "The current locale is selected" do
login_as_manager
expect(page).to have_select("locale-switcher", selected: "English")
expect(page).to have_select "Language:", selected: "English"
expect(page).to have_text("Management")
end
scenario "Changing the locale" do
login_as_manager
expect(page).to have_content("Language")
select "Español", from: "Language:"
select("Español", from: "locale-switcher")
expect(page).to have_content("Idioma")
expect(page).not_to have_content("Language")
expect(page).to have_select("locale-switcher", selected: "Español")
expect(page).not_to have_select "Language:"
expect(page).to have_select "Idioma:", selected: "Español"
end
scenario "Locale switcher not present if only one locale" do