From d636f1fe75fece002d0837b7c175a9f271b471a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Sun, 15 Sep 2024 00:06:18 +0200 Subject: [PATCH] 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. --- spec/shared/system/remotely_translatable.rb | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/spec/shared/system/remotely_translatable.rb b/spec/shared/system/remotely_translatable.rb index f23d7e3ac..8b564498a 100644 --- a/spec/shared/system/remotely_translatable.rb +++ b/spec/shared/system/remotely_translatable.rb @@ -38,6 +38,7 @@ shared_examples "remotely_translatable" do |factory_name, path_name, path_argume select "Español", from: "Language:" + expect(page).to have_select "Idioma:" expect(page).not_to have_button("Traducir página") end @@ -47,6 +48,7 @@ shared_examples "remotely_translatable" do |factory_name, path_name, path_argume select "Español", from: "Language:" + expect(page).to have_select "Idioma:" expect(page).not_to have_button("Traducir página") end @@ -57,9 +59,9 @@ shared_examples "remotely_translatable" do |factory_name, path_name, path_argume 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 " \ "podrá ver todo el contenido en su idioma" + expect(page).not_to have_button("Traducir página") end end @@ -73,6 +75,7 @@ shared_examples "remotely_translatable" do |factory_name, path_name, path_argume select "Español", from: "Language:" + expect(page).to have_select "Idioma:" expect(page).not_to have_button("Traducir página") end end @@ -97,6 +100,7 @@ shared_examples "remotely_translatable" do |factory_name, path_name, path_argume select "Español", from: "Language:" + expect(page).to have_select "Idioma:" expect(page).not_to have_button("Traducir página") end end @@ -167,10 +171,10 @@ shared_examples "remotely_translatable" do |factory_name, path_name, path_argume visit path 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 " \ "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