diff --git a/decidim-ephemeral_participation/lib/decidim/ephemeral_participation/test/shared_examples/with_ephemerable_participation.rb b/decidim-ephemeral_participation/lib/decidim/ephemeral_participation/test/shared_examples/with_ephemerable_participation.rb
index 46b32b167..3691d971d 100644
--- a/decidim-ephemeral_participation/lib/decidim/ephemeral_participation/test/shared_examples/with_ephemerable_participation.rb
+++ b/decidim-ephemeral_participation/lib/decidim/ephemeral_participation/test/shared_examples/with_ephemerable_participation.rb
@@ -69,11 +69,18 @@ def create_ephemeral_participant
let(:document_number) { "123456789X" }
def click_ephemeral_participation_button(selector = ephemeral_participation_action_button_selector)
- click_ephemeral_parcipation_action_button(selector)
- accept_confirm { click_on("I want to participate without registering") }
+ click_ephemeral_participation_action_button(selector)
+ accept_confirm { click_ephemeral_participation_login_button }
end
- def click_ephemeral_parcipation_action_button(_selector = ephemeral_participation_action_button_selector)
+ def click_ephemeral_participation_login_button
+ # Modals takes too long rendering. We wait for the buttons to be visible and enabled.
+ sleep(0.2)
+ click_on("I want to participate without registering")
+ sleep(0.2)
+ end
+
+ def click_ephemeral_participation_action_button(_selector = ephemeral_participation_action_button_selector)
page.find(ephemeral_participation_action_button_selector).click
end
@@ -94,10 +101,10 @@ def submit_unverifiable_form
let(:email) { "unique@email.example" }
def register_workflows
- [
- "decidim-generators/lib/decidim/generators/app_templates/dummy_authorization_handler.rb",
- "decidim-generators/lib/decidim/generators/app_templates/another_dummy_authorization_handler.rb"
- ].each { |file_path| require "#{Gem::Specification.find_by_name("decidim").gem_dir}/#{file_path}" }
+ %w(lib/decidim/generators/app_templates/dummy_authorization_handler.rb
+ lib/decidim/generators/app_templates/another_dummy_authorization_handler.rb).each do |file_path|
+ require "#{Gem::Specification.find_by_name("decidim-generators").gem_dir}/#{file_path}"
+ end
Decidim::Verifications.register_workflow(:dummy_authorization_handler) do |workflow|
workflow.form = "DummyAuthorizationHandler"
diff --git a/decidim-ephemeral_participation/spec/rails_helper.rb b/decidim-ephemeral_participation/spec/rails_helper.rb
index ee8491ac8..3bbda0e5b 100644
--- a/decidim-ephemeral_participation/spec/rails_helper.rb
+++ b/decidim-ephemeral_participation/spec/rails_helper.rb
@@ -1,3 +1,3 @@
# frozen_string_literal: true
-require "../../spec/rails_helper"
+require_relative "../../spec/rails_helper"
diff --git a/decidim-ephemeral_participation/spec/system/admin/component_spec.rb b/decidim-ephemeral_participation/spec/system/admin/component_spec.rb
index f82bf1936..74bf35cc7 100644
--- a/decidim-ephemeral_participation/spec/system/admin/component_spec.rb
+++ b/decidim-ephemeral_participation/spec/system/admin/component_spec.rb
@@ -52,9 +52,9 @@
es: "Alerta!"
)
- find("*[type=submit]").click
+ find("*[type=submit][name=commit]").click
- expect(page).to have_css("div.callout.success")
+ expect(page).to have_css("div.callout-wrapper .flash.success")
end
end
@@ -73,9 +73,9 @@
es: "Alerta!"
)
- find("*[type=submit]").click
+ find("*[type=submit][name=commit]").click
- expect(page).to have_css("div.callout.alert")
+ expect(page).to have_css("div.callout-wrapper .flash.alert")
end
end
end
@@ -102,26 +102,26 @@
it "updates permissions when selecting ephemeral authorization for a given action" do
check("component_permissions_permissions_vote_authorization_handlers_dummy_authorization_handler")
- find("*[type=submit]").click
+ find("*[type=submit][name=commit]").click
- expect(page).to have_css("div.callout.success")
+ expect(page).to have_css("div.callout-wrapper .flash.success")
end
it "updates permissions when selecting regular authorization for a given action" do
check("component_permissions_permissions_vote_authorization_handlers_another_dummy_authorization_handler")
- find("*[type=submit]").click
+ find("*[type=submit][name=commit]").click
- expect(page).to have_css("div.callout.success")
+ expect(page).to have_css("div.callout-wrapper .flash.success")
end
it "fails to update permissions when selecting more than one authorization for a given action" do
check("component_permissions_permissions_vote_authorization_handlers_dummy_authorization_handler")
check("component_permissions_permissions_vote_authorization_handlers_another_dummy_authorization_handler")
- find("*[type=submit]").click
+ find("*[type=submit][name=commit]").click
- expect(page).to have_css("div.callout.alert")
+ expect(page).to have_css("div.callout-wrapper .flash.alert")
end
end
@@ -133,26 +133,26 @@
it "updates permissions when selecting ephemeral authorization for a given action" do
check("component_permissions_permissions_vote_authorization_handlers_dummy_authorization_handler")
- find("*[type=submit]").click
+ find("*[type=submit][name=commit]").click
- expect(page).to have_css("div.callout.success")
+ expect(page).to have_css("div.callout-wrapper .flash.success")
end
it "updates permissions when selecting regular authorization for a given action" do
check("component_permissions_permissions_vote_authorization_handlers_another_dummy_authorization_handler")
- find("*[type=submit]").click
+ find("*[type=submit][name=commit]").click
- expect(page).to have_css("div.callout.success")
+ expect(page).to have_css("div.callout-wrapper .flash.success")
end
it "updates permissions when selecting more than one authorization for a given action" do
check("component_permissions_permissions_vote_authorization_handlers_dummy_authorization_handler")
check("component_permissions_permissions_vote_authorization_handlers_another_dummy_authorization_handler")
- find("*[type=submit]").click
+ find("*[type=submit][name=commit]").click
- expect(page).to have_css("div.callout.success")
+ expect(page).to have_css("div.callout-wrapper .flash.success")
end
end
end
@@ -173,26 +173,26 @@
it "updates permissions when selecting ephemeral authorization for a given action" do
check("component_permissions_permissions_vote_authorization_handlers_dummy_authorization_handler")
- find("*[type=submit]").click
+ find("*[type=submit][name=commit]").click
- expect(page).to have_css("div.callout.success")
+ expect(page).to have_css("div.callout-wrapper .flash.success")
end
it "updates permissions when selecting regular authorization for a given action" do
check("component_permissions_permissions_vote_authorization_handlers_another_dummy_authorization_handler")
- find("*[type=submit]").click
+ find("*[type=submit][name=commit]").click
- expect(page).to have_css("div.callout.success")
+ expect(page).to have_css("div.callout-wrapper .flash.success")
end
it "updates permissions when selecting more than one authorization for a given action" do
check("component_permissions_permissions_vote_authorization_handlers_dummy_authorization_handler")
check("component_permissions_permissions_vote_authorization_handlers_another_dummy_authorization_handler")
- find("*[type=submit]").click
+ find("*[type=submit][name=commit]").click
- expect(page).to have_css("div.callout.success")
+ expect(page).to have_css("div.callout-wrapper .flash.success")
end
end
@@ -204,26 +204,26 @@
it "updates permissions when selecting ephemeral authorization for a given action" do
check("component_permissions_permissions_vote_authorization_handlers_dummy_authorization_handler")
- find("*[type=submit]").click
+ find("*[type=submit][name=commit]").click
- expect(page).to have_css("div.callout.success")
+ expect(page).to have_css("div.callout-wrapper .flash.success")
end
it "updates permissions when selecting regular authorization for a given action" do
check("component_permissions_permissions_vote_authorization_handlers_another_dummy_authorization_handler")
- find("*[type=submit]").click
+ find("*[type=submit][name=commit]").click
- expect(page).to have_css("div.callout.success")
+ expect(page).to have_css("div.callout-wrapper .flash.success")
end
it "updates permissions when selecting more than one authorization for a given action" do
check("component_permissions_permissions_vote_authorization_handlers_dummy_authorization_handler")
check("component_permissions_permissions_vote_authorization_handlers_another_dummy_authorization_handler")
- find("*[type=submit]").click
+ find("*[type=submit][name=commit]").click
- expect(page).to have_css("div.callout.success")
+ expect(page).to have_css("div.callout-wrapper .flash.success")
end
end
end
diff --git a/decidim-ephemeral_participation/spec/system/admin/conflicts_spec.rb b/decidim-ephemeral_participation/spec/system/admin/conflicts_spec.rb
index 64348eb5a..d2de9504b 100644
--- a/decidim-ephemeral_participation/spec/system/admin/conflicts_spec.rb
+++ b/decidim-ephemeral_participation/spec/system/admin/conflicts_spec.rb
@@ -24,7 +24,7 @@
shared_examples "fails to transfer the users" do
it "fails to transfer the users" do
- within(".callout") do
+ within(".callout-wrapper") do
expect(page).to have_content("There was a problem transfering the current participant to managed participant.")
end
@@ -46,7 +46,7 @@
context "when transfering the user" do
before do
- click_on(href: "/admin/conflicts/#{conflict.id}/edit")
+ find(:xpath, "//a[@href='/admin/conflicts/#{conflict.id}/edit']").click
end
context "and submitting a registered email" do
@@ -78,7 +78,7 @@
context "when transfering the user" do
before do
- click_on(href: "/admin/conflicts/#{conflict.id}/edit")
+ find(:xpath, "//a[@href='/admin/conflicts/#{conflict.id}/edit']").click
end
context "and submitting a registered email" do
@@ -101,7 +101,7 @@
end
it "transfers the users successfuly" do
- within(".callout") do
+ within(".callout-wrapper") do
expect(page).to have_content("The current transfer has been successfully completed.")
end
diff --git a/decidim-ephemeral_participation/spec/system/admin/organization_spec.rb b/decidim-ephemeral_participation/spec/system/admin/organization_spec.rb
index b274ff747..6d37177ca 100644
--- a/decidim-ephemeral_participation/spec/system/admin/organization_spec.rb
+++ b/decidim-ephemeral_participation/spec/system/admin/organization_spec.rb
@@ -35,7 +35,7 @@
choose("organization_available_authorizations_dummy_authorization_handler_allow_ephemeral_participation")
- find("*[type=submit]").click
+ find("*[type=submit][name=commit]").click
expect(page).to have_css("div.flash.success")
diff --git a/decidim-ephemeral_participation/spec/system/user/complete_registration_spec.rb b/decidim-ephemeral_participation/spec/system/user/complete_registration_spec.rb
index e0c249166..ffc06b95a 100644
--- a/decidim-ephemeral_participation/spec/system/user/complete_registration_spec.rb
+++ b/decidim-ephemeral_participation/spec/system/user/complete_registration_spec.rb
@@ -2,7 +2,7 @@
require "rails_helper"
-describe "User menu" do
+describe "Complete registration" do
include_context "with ephemerable participation"
let!(:project) { create(:project, budget:) }
@@ -19,21 +19,15 @@
end
context "when the user clicks the ephemeral participation button and toggles the user menu" do
- let(:toggle_user_menu) do
- within(".topbar__user__logged") do
- click_on(current_user.name)
- end
- end
let(:current_user) { Decidim::User.last }
before do
click_ephemeral_participation_button
- toggle_user_menu
end
context "when the user clicks the complete registration link" do
before do
- within(".topbar__user__logged") do
+ within(".main-footer__top") do
click_on("Finish your registration")
end
end
@@ -46,7 +40,7 @@
fill_in("ephemeral_participant_email", with: email)
fill_in("ephemeral_participant_password", with: password)
fill_in("ephemeral_participant_password_confirmation", with: password)
- find("*[type=submit]").click
+ find("*[type=submit][name=commit]").click
end
end
let(:name) { "New name" }
diff --git a/decidim-ephemeral_participation/spec/system/user/ephemeral_participation_button_spec.rb b/decidim-ephemeral_participation/spec/system/user/ephemeral_participation_button_spec.rb
index 9c14ee4c8..ee5489e6c 100644
--- a/decidim-ephemeral_participation/spec/system/user/ephemeral_participation_button_spec.rb
+++ b/decidim-ephemeral_participation/spec/system/user/ephemeral_participation_button_spec.rb
@@ -36,9 +36,9 @@
end
it "renders the confirmation modal" do
- click_on("I want to participate without registering")
+ click_ephemeral_participation_login_button
- within(".confirm-modal-content") do
+ within("#confirm-modal-content") do
expect(page).to have_content("Are you sure?")
end
end
@@ -50,7 +50,7 @@
end
it "renders the verification form directly" do
- click_on("I want to participate without registering")
+ click_ephemeral_participation_login_button
within_flash_messages do
expect(page).to have_content("en.decidim.ephemeral_participation.ephemeral_participants.create")
diff --git a/decidim-ephemeral_participation/spec/system/user/permissions_spec.rb b/decidim-ephemeral_participation/spec/system/user/permissions_spec.rb
index 64fe6e7a7..067fac906 100644
--- a/decidim-ephemeral_participation/spec/system/user/permissions_spec.rb
+++ b/decidim-ephemeral_participation/spec/system/user/permissions_spec.rb
@@ -47,8 +47,8 @@ def perform_non_authorized_action
let(:perform_authorized_action_supposed_to_redirect) do
click_on(project.title["en"])
- within("#project") do
- click_on("Add to your vote")
+ within("#project-item") do
+ click_on("Add")
end
end
@@ -81,21 +81,23 @@ def perform_non_authorized_action
submit_authorization_form
end
- it "allows to perfom authorized action" do
- click_ephemeral_parcipation_action_button
+ it "allows to perform authorized action" do
+ click_ephemeral_participation_action_button
click_on("Vote")
click_on("Confirm")
- expect(page).to have_content("You've already voted for the budget.")
+ expect(page).to have_content("You have already voted for the budget.")
end
- it "disallows to perfom non authorized action" do
+ it "disallows to perform non authorized action" do
perform_non_authorized_action
- within_flash_messages do
- expect(page).to have_content("You are not authorized to perform this action")
- expect(page).to have_link("Finish your registration here")
+ within "#content" do
+ within_flash_messages do
+ expect(page).to have_content("You are not authorized to perform this action")
+ expect(page).to have_link("Finish your registration here")
+ end
end
end
@@ -103,7 +105,7 @@ def perform_non_authorized_action
[
decidim.account_path,
decidim.notifications_settings_path,
- decidim.data_portability_path,
+ decidim.download_your_data_path,
decidim.own_user_groups_path,
decidim.user_interests_path,
decidim.notifications_path,
@@ -141,7 +143,7 @@ def perform_non_authorized_action
it "allows answering the questionnaire" do
visit main_component_path(surveys_component)
- expect(page).to have_i18n_content(questionnaire.title, upcase: true)
+ expect(page).to have_i18n_content(questionnaire.title)
expect(page).to have_i18n_content(questionnaire.description)
fill_in(question.body["en"], with: "My first answer")
diff --git a/decidim-ephemeral_participation/spec/system/user/session_spec.rb b/decidim-ephemeral_participation/spec/system/user/session_spec.rb
index faf0b15c1..dbeea02f9 100644
--- a/decidim-ephemeral_participation/spec/system/user/session_spec.rb
+++ b/decidim-ephemeral_participation/spec/system/user/session_spec.rb
@@ -2,7 +2,7 @@
require "rails_helper"
-describe "Succesful verification" do
+describe "Session" do
include ActiveSupport::Testing::TimeHelpers
include_context "with ephemerable participation"
diff --git a/decidim-ephemeral_participation/spec/system/user/successful_verification_spec.rb b/decidim-ephemeral_participation/spec/system/user/successful_verification_spec.rb
index dc7e5fa96..fe0f09426 100644
--- a/decidim-ephemeral_participation/spec/system/user/successful_verification_spec.rb
+++ b/decidim-ephemeral_participation/spec/system/user/successful_verification_spec.rb
@@ -2,7 +2,7 @@
require "rails_helper"
-describe "Succesful verification" do
+describe "Successful verification" do
include_context "with ephemerable participation"
let!(:project) { create(:project, budget:) }
@@ -29,7 +29,7 @@
it "authorizes the user and redirects back to where ephemeral participation button was clicked" do
within_flash_messages do
- expect(page).to have_content("You've been successfully authorized")
+ expect(page).to have_content("You have been successfully authorized")
end
expect(page).to have_current_path(ephemeral_participation_path)
diff --git a/decidim-ephemeral_participation/spec/system/user/user_menu_spec.rb b/decidim-ephemeral_participation/spec/system/user/user_menu_spec.rb
index 11568090b..20e862276 100644
--- a/decidim-ephemeral_participation/spec/system/user/user_menu_spec.rb
+++ b/decidim-ephemeral_participation/spec/system/user/user_menu_spec.rb
@@ -22,8 +22,8 @@
let(:current_user) { Decidim::User.last }
let(:session_duration) { 5.minutes }
let(:toggle_user_menu) do
- within(".topbar__user__logged") do
- click_on(current_user.name)
+ within(".main-bar__dropdown-container") do
+ click_on("Account")
end
end
@@ -34,7 +34,7 @@
end
it "shows alternative user menu" do
- within(".topbar__user__logged") do
+ within(".main-bar__dropdown-container") do
expect(page).to have_content("#{(session_duration / 1.minute).round} min. before automatic sign out")
expect(page).to have_link("Finish your registration")
expect(page).to have_link("Cancel and sign out")
@@ -43,7 +43,7 @@
context "when the user clicks the sign out link" do
before do
- within(".topbar__user__logged") do
+ within(".main-bar__dropdown-container") do
click_on("Cancel and sign out")
end
end
@@ -59,7 +59,7 @@
context "when the user clicks the complete registration link" do
before do
- within(".topbar__user__logged") do
+ within(".main-bar__dropdown-container") do
click_on("Finish your registration")
end
end
diff --git a/decidim-ephemeral_participation/spec/system/user/verification_conflicts_spec.rb b/decidim-ephemeral_participation/spec/system/user/verification_conflicts_spec.rb
index 262a3ccea..e85a9fe7a 100644
--- a/decidim-ephemeral_participation/spec/system/user/verification_conflicts_spec.rb
+++ b/decidim-ephemeral_participation/spec/system/user/verification_conflicts_spec.rb
@@ -37,13 +37,7 @@
it "creates verification conflict and notifies admins" do
expect(Decidim::Verifications::Conflict.count).to eq(1)
- notification_job = {
- job: Decidim::EventPublisherJob,
- args: array_including("decidim.events.verifications.managed_user_error_event"),
- queue: "events"
- }
-
- expect(enqueued_jobs.last).to match(notification_job)
+ expect(enqueued_jobs.last[:args]).to include("decidim.events.verifications.managed_user_error_event")
end
it "shows an error" do
@@ -172,7 +166,6 @@
let(:submit_password_form) do
within("form#password_new_user") do
fill_in(:password_user_password, with: "decidim123456")
- fill_in(:password_user_password_confirmation, with: "decidim123456")
find("*[type=submit]").click
end
end
diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb
index d7beb130d..c06fa2dfc 100644
--- a/spec/rails_helper.rb
+++ b/spec/rails_helper.rb
@@ -5,7 +5,7 @@
require File.expand_path("../config/environment", __dir__)
# Prevent database truncation if the environment is production
abort("The Rails environment is running in production mode!") if Rails.env.production?
-require "spec_helper"
+require_relative "spec_helper"
require "rspec/rails"
# Add additional requires below this line. Rails is not loaded until this point!