Add missing expectations in remotely translatable tests

After changing the language, we were checking that certain content isn't
there.

However, the content wasn't there before changing the language either,
so the test will pass even if the request to change the language hasn't
finished.

Although this is probably OK because we aren't changing the language
using an AJAX request, and so Capybara will correctly wait until the
request is finished before finishing the test, confirming that the page
has changed after a request is something we try to do in every test.
This commit is contained in:
Javi Martín
2024-09-15 00:06:18 +02:00
parent d5fd7b77fd
commit d636f1fe75

View File

@@ -38,6 +38,7 @@ shared_examples "remotely_translatable" do |factory_name, path_name, path_argume
select "Español", from: "Language:" select "Español", from: "Language:"
expect(page).to have_select "Idioma:"
expect(page).not_to have_button("Traducir página") expect(page).not_to have_button("Traducir página")
end end
@@ -47,6 +48,7 @@ shared_examples "remotely_translatable" do |factory_name, path_name, path_argume
select "Español", from: "Language:" select "Español", from: "Language:"
expect(page).to have_select "Idioma:"
expect(page).not_to have_button("Traducir página") expect(page).not_to have_button("Traducir página")
end end
@@ -57,9 +59,9 @@ shared_examples "remotely_translatable" do |factory_name, path_name, path_argume
select "Español", from: "Language:" select "Español", from: "Language:"
expect(page).not_to have_button("Traducir página")
expect(page).to have_content "En un breve periodo de tiempo refrescando la página " \ expect(page).to have_content "En un breve periodo de tiempo refrescando la página " \
"podrá ver todo el contenido en su idioma" "podrá ver todo el contenido en su idioma"
expect(page).not_to have_button("Traducir página")
end end
end end
@@ -73,6 +75,7 @@ shared_examples "remotely_translatable" do |factory_name, path_name, path_argume
select "Español", from: "Language:" select "Español", from: "Language:"
expect(page).to have_select "Idioma:"
expect(page).not_to have_button("Traducir página") expect(page).not_to have_button("Traducir página")
end end
end end
@@ -97,6 +100,7 @@ shared_examples "remotely_translatable" do |factory_name, path_name, path_argume
select "Español", from: "Language:" select "Español", from: "Language:"
expect(page).to have_select "Idioma:"
expect(page).not_to have_button("Traducir página") expect(page).not_to have_button("Traducir página")
end end
end end
@@ -167,10 +171,10 @@ shared_examples "remotely_translatable" do |factory_name, path_name, path_argume
visit path visit path
select "Español", from: "Idioma:" select "Español", from: "Idioma:"
expect(page).not_to have_button "Traducir página"
expect(page).not_to have_content "Se han solicitado correctamente las traducciones."
expect(page).to have_content "En un breve periodo de tiempo refrescando la página " \ expect(page).to have_content "En un breve periodo de tiempo refrescando la página " \
"podrá ver todo el contenido en su idioma" "podrá ver todo el contenido en su idioma"
expect(page).not_to have_button "Traducir página"
expect(page).not_to have_content "Se han solicitado correctamente las traducciones."
end end
end end