From 1c4cc68121d67bc3b6fb507905f60da81f25eb7b Mon Sep 17 00:00:00 2001 From: taitus Date: Mon, 23 Sep 2024 15:34:25 +0200 Subject: [PATCH] WIP --- spec/shared/system/remotely_translatable.rb | 15 ++++++++------- spec/spec_helper.rb | 1 + 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/spec/shared/system/remotely_translatable.rb b/spec/shared/system/remotely_translatable.rb index d90fd27231ec..f8de5a108343 100644 --- a/spec/shared/system/remotely_translatable.rb +++ b/spec/shared/system/remotely_translatable.rb @@ -18,28 +18,29 @@ context "After click remote translations button" do describe "without delayed jobs" do + scenario "request a translation of an already translated text" do response = generate_response(resource) expect_any_instance_of(RemoteTranslations::Microsoft::Client).to receive(:call).and_return(response) - in_browser(:one) do + # Navegador 1: Usa la sesión de Capybara para el primer usuario + Capybara.using_session(:user_one) do visit path select "Español", from: "Language:" - expect(page).to have_button "Traducir página" end - in_browser(:two) do + # Navegador 2: Usa una segunda sesión de Capybara para el segundo usuario + Capybara.using_session(:user_two) do visit path select "Español", from: "Language:" click_button "Traducir página" - - expect(page).to have_content "Se han solicitado correctamente las traducciones" + expect(page).to have_content "Se han solicitado correctamente las traducciones", wait: 10 end - in_browser(:one) do + # Volver a Navegador 1 para realizar más acciones + Capybara.using_session(:user_one) do click_button "Traducir página" - expect(page).not_to have_button "Traducir página" end end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 2ee4b259b963..9854ebcd4aa9 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -9,6 +9,7 @@ Dir["./spec/shared/**/*.rb"].sort.each { |f| require f } RSpec.configure do |config| + Capybara.always_include_port = false config.use_transactional_fixtures = true config.fixture_path = "spec/fixtures/files"