From 04cf9a2feced2187d0f55fffb389eb476854935e Mon Sep 17 00:00:00 2001 From: Joonas Date: Wed, 2 Oct 2024 12:31:08 +0300 Subject: [PATCH] Fix specs --- spec/shared/filterable_login_code_examples.rb | 2 +- .../admin/verification_code_generation_spec.rb | 4 ++-- spec/system/log_in_with_access_code_spec.rb | 1 - spec/system/log_in_with_phone_number_spec.rb | 4 ++-- spec/system/verification_with_access_code_spec.rb | 2 +- spec/system/verification_with_phone_number_spec.rb | 12 ++++++------ 6 files changed, 12 insertions(+), 13 deletions(-) diff --git a/spec/shared/filterable_login_code_examples.rb b/spec/shared/filterable_login_code_examples.rb index b779bdc..bec390e 100644 --- a/spec/shared/filterable_login_code_examples.rb +++ b/spec/shared/filterable_login_code_examples.rb @@ -36,7 +36,7 @@ table = find("table.stack.table-list") first_school = table.find("tbody").all("tr")[0].find("td:nth-child(3)").text fill_in "q[creator_name_cont]", with: first_school - click_button("Search") + find('button[aria-label="Search"]').click rows = table.find("tbody").all("tr") rows.each do |row| school = row.find("td:nth-child(3)") diff --git a/spec/system/admin/verification_code_generation_spec.rb b/spec/system/admin/verification_code_generation_spec.rb index d272edd..5923d4a 100644 --- a/spec/system/admin/verification_code_generation_spec.rb +++ b/spec/system/admin/verification_code_generation_spec.rb @@ -2,7 +2,7 @@ require "spec_helper" -describe "verificqation code generation", type: :system do +describe "verification code generation", type: :system do include_context "with helsinki_smsauth_id authorization" let!(:admin) { create(:user, :admin, :confirmed, organization: organization) } @@ -16,7 +16,7 @@ end it "renders authorizations views" do - within ".secondary-nav" do + within "#admin-sidebar-menu-settings" do expect(page).to have_link("Login via text message") end diff --git a/spec/system/log_in_with_access_code_spec.rb b/spec/system/log_in_with_access_code_spec.rb index d024901..cbfd65d 100644 --- a/spec/system/log_in_with_access_code_spec.rb +++ b/spec/system/log_in_with_access_code_spec.rb @@ -37,7 +37,6 @@ signin_code_set.reload expect(signin_code_set.used_code_amount).to eq(1) - expect(page).to have_current_path("/authorizations") authorization = Decidim::Authorization.last expect(authorization.metadata["school"]).to eq(signin_code_set.metadata["school"]) expect(authorization.metadata["grade"]).to eq(signin_code_set.metadata["grade"]) diff --git a/spec/system/log_in_with_phone_number_spec.rb b/spec/system/log_in_with_phone_number_spec.rb index 068efbf..3370eda 100644 --- a/spec/system/log_in_with_phone_number_spec.rb +++ b/spec/system/log_in_with_phone_number_spec.rb @@ -33,7 +33,7 @@ it "authenticate and redirects the user" do verify_phone - expect(page).to have_current_path("/authorizations") + expect(page).to have_current_path("/") end end @@ -50,7 +50,7 @@ fill_in "Grade", with: 1 click_button "Save and continue" - expect(page).to have_current_path decidim_verifications.authorizations_path + expect(page).to have_current_path decidim.root_path user = Decidim::User.last expect(user.phone_number).to eq("+3584551122334") authorization = Decidim::Authorization.last diff --git a/spec/system/verification_with_access_code_spec.rb b/spec/system/verification_with_access_code_spec.rb index e71369d..173df79 100644 --- a/spec/system/verification_with_access_code_spec.rb +++ b/spec/system/verification_with_access_code_spec.rb @@ -55,7 +55,7 @@ expect(authorization.metadata["school"]).to eq(school) expect(page).to have_current_path("/authorizations") within_flash_messages do - expect(page).to have_content("Congratulations. You've been successfully verified.") + expect(page).to have_content("Congratulations. You have been successfully verified.") end end end diff --git a/spec/system/verification_with_phone_number_spec.rb b/spec/system/verification_with_phone_number_spec.rb index 87eab96..70f4e1d 100644 --- a/spec/system/verification_with_phone_number_spec.rb +++ b/spec/system/verification_with_phone_number_spec.rb @@ -25,13 +25,13 @@ end it "shows the available authorizations" do - within "#user-settings-tabs" do + within "#dropdown-menu-profile" do expect(page).to have_css("a", text: "Authorizations") end click_link "Authorization" expect(page).to have_content "Participant settings - Authorizations" - within ".card--list__item" do - expect(page).to have_css("svg.icon--lock-unlocked", count: 1) + within ".verification__container" do + expect(page).to have_css("svg.verification__icon", count: 1) end end end @@ -41,7 +41,7 @@ sign_in user, scope: :user visit decidim.account_path click_link "Authorization" - find(".card--list__item").click + click_on "Login via text message" end context "when authorization belongs to someone else" do @@ -85,7 +85,7 @@ it "generates the authorization process" do expect(page).to have_current_path("/helsinki_smsauth_id/authorizations/edit") within_flash_messages do - expect(page).to have_content "Thanks! We've sent an SMS to your phone." + expect(page).to have_content "Thanks! We have sent an SMS to your phone." end expect(page).to have_link("Resend the code", href: "/helsinki_smsauth_id/authorizations/resend_code") @@ -105,7 +105,7 @@ expect(authorization).not_to be_granted expect(page).to have_current_path("/helsinki_smsauth_id/authorizations/school_info") visit "/authorizations" - expect(page).to have_css('svg[aria-label="Pending verification"]') + expect(page).to have_css("section.authorizations-list > div.verification__container-title", text: "PENDING VERIFICATION") end context "when adding school info" do