Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
laurajaime committed Oct 11, 2024
1 parent 2493a66 commit df25b3d
Show file tree
Hide file tree
Showing 8 changed files with 45 additions and 33 deletions.
2 changes: 1 addition & 1 deletion app/views/decidim/admin/users/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
<% if space["published"] %>
<strong class="text-success"><%= t("assemblies.index.published", scope: "decidim.admin") %></strong>
<% else %>
<strong class="text-alert"><%= t("assemblies.index.not_published", scope: "decidim.admin") %></strong>
<strong class="text-alert"><%= t("assemblies.index.unpublished", scope: "decidim.admin") %></strong>
<% end %></td>
</tr>
<% end %>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
<% if assembly.published? %>
<strong class="text-success"><%= t("assemblies.index.published", scope: "decidim.admin") %></strong>
<% else %>
<strong class="text-alert"><%= t("assemblies.index.not_published", scope: "decidim.admin") %></strong>
<strong class="text-alert"><%= t("assemblies.index.unpublished", scope: "decidim.admin") %></strong>
<% end %>
</td>
<td class="table-list__actions">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
<% if conference.published? %>
<strong class="text-success"><%= t("conferences.index.published", scope: "decidim.admin") %></strong>
<% else %>
<strong class="text-alert"><%= t("conferences.index.not_published", scope: "decidim.admin") %></strong>
<strong class="text-alert"><%= t("conferences.index.unpublished", scope: "decidim.admin") %></strong>
<% end %>
</td>
<td class="table-list__actions">
Expand Down
9 changes: 2 additions & 7 deletions spec/features/check_overrides_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,5 @@

require "spec_helper"

RSpec.describe "Overrides" do
it "check failing tests in Decidim v0.28" do
# Make test succeed spec/system/department_admin_should_be_able_to_manage_assemblies_spec.rbL73
# expect(page).to have_current_path decidim_admin_assemblies.assemblies_path(q: { parent_id_eq: parent_assembly&.id })
expect(Decidim.version).to be < "0.28"
end
end
# RSpec.describe "Overrides" do
# end
4 changes: 2 additions & 2 deletions spec/system/admin_explores_processes_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@
end

def check_column_header_exists(position: 1, content: "")
within "#processes .card-section .table-scroll table thead th:nth-child(#{position})" do
within "#processes .table-scroll table thead th:nth-child(#{position})" do
expect(page).to have_content(content)
end
end

def check_column_data_exists(position: 1, content: "")
within "#processes .card-section .table-scroll table tbody td:nth-child(#{position})" do
within "#processes .table-scroll table tbody td:nth-child(#{position})" do
expect(page).to have_content(content)
end
end
Expand Down
52 changes: 35 additions & 17 deletions spec/system/department_admin_manages_newsletters_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,27 @@ def fill_newsletter_form
fill_in_i18n(
:newsletter_subject,
"#newsletter-subject-tabs",
en: "A fancy newsletter for %{name}",
es: "Un correo electrónico muy chulo para %{name}",
ca: "Un correu electrònic flipant per a %{name}"
**attributes[:subject].except("machine_translations")
)

fill_in_i18n_editor(
:newsletter_settings_introduction,
"#newsletter-settings--introduction-tabs",
en: "Hello %{name}! Relevant content.",
es: "Hola, %{name}! Contenido relevante.",
ca: "Hola, %{name}! Contingut rellevant."
)

fill_in_i18n(
:newsletter_settings_cta_text,
"#newsletter-settings--cta_text-tabs",
en: "Hello %{name}! Relevant content."
)

fill_in_i18n(
:newsletter_settings_cta_url,
"#newsletter-settings--cta_url-tabs",
en: "Hello %{name}! Relevant content."
)

fill_in_i18n_editor(
Expand All @@ -33,26 +51,26 @@ def fill_newsletter_form
es: "Hola, %{name}! Contenido relevante.",
ca: "Hola, %{name}! Contingut rellevant."
)

find("*[type=submit]").click
end

context "when creating and previewing a newsletter" do
it "allows a newsletter to be created" do
visit decidim_admin.newsletters_path

within ".secondary-nav" do
find(".button.new").click
end
find(".button.new").click

within "#basic_only_text .card-footer" do
click_link_or_button("Use this template")
within "#image_text_cta" do
click_link_or_button "Use this template"
end

within "#new_newsletter_" do
within ".new_newsletter" do
fill_newsletter_form
end

within ".new_newsletter" do
find("*[type=submit]").click
end

expect(page).to have_content("Preview")
expect(page).to have_content("A fancy newsletter for #{department_admin.name}")
end
Expand Down Expand Up @@ -126,8 +144,8 @@ def fill_newsletter_form
end
end

within ".button--double" do
accept_confirm { find("*", text: "Deliver").click }
within "form.newsletter_deliver .item__edit-sticky" do
accept_confirm { click_on("Deliver newsletter") }
end

wait_redirect
Expand Down Expand Up @@ -162,8 +180,8 @@ def fill_newsletter_form
end
end

within ".button--double" do
accept_confirm { find("*", text: "Deliver").click }
within "form.newsletter_deliver .item__edit-sticky" do
accept_confirm { click_on("Deliver newsletter") }
end

wait_redirect
Expand Down Expand Up @@ -204,8 +222,8 @@ def fill_newsletter_form
end
end

within ".button--double" do
accept_confirm { find("*", text: "Deliver").click }
within "form.newsletter_deliver .item__edit-sticky" do
accept_confirm { click_on("Deliver newsletter") }
end

wait_redirect
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,14 @@

it "is able to access the admin Dashboard" do
expect(page).to have_content("Dashboard")
expect(page).to have_content("Welcome to the Admin Panel.")
end

context "when accessing the dashboard some left menu elements should be accessible" do
it "is able to access 'Processes'" do
expect(page).to have_content("Processes")
click_link_or_button "Processes"
expect(page).to have_current_path "/admin/participatory_processes"
expect(page).to have_content("Participatory processes")
expect(page).to have_content("New process")
end

it "is able to access 'Assemblies'" do
Expand Down Expand Up @@ -52,7 +51,7 @@
expect(page).to have_content("Conferences")
click_link_or_button "Conferences"
expect(page).to have_current_path "/admin/conferences"
expect(page).to have_content("New Conference")
expect(page).to have_content("New conference")
end
# TODO: not supported at the moment
# it "should be able to access 'Initiatives'"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
let(:image2_path) { Decidim::Dev.asset(image2_filename) }

before do
click_link_or_button_or_button "New process"
click_link_or_button "New process"
end

it "creates a new participatory process with department admin's area" do
Expand Down

0 comments on commit df25b3d

Please sign in to comment.