Skip to content

Commit

Permalink
Make the link overlay spec work again
Browse files Browse the repository at this point in the history
It was not working since we change some UI and was self-pending since.

Fixed the underlying issues and make it more robust by using capybaras wait
feature.
  • Loading branch information
tvdeyen committed Jul 7, 2021
1 parent eb4f36b commit f8db000
Showing 1 changed file with 12 additions and 20 deletions.
32 changes: 12 additions & 20 deletions spec/features/admin/link_overlay_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
let!(:article) do
create(:alchemy_element,
name: "article",
page: page1,
page_version: page1.draft_version,
autogenerate_contents: true)
end
Expand All @@ -60,29 +59,22 @@
click_link "Link text"
end

begin
within "#overlay_tab_internal_link" do
expect(page).to have_selector("#s2id_page_urlname")
select2_search(page2.name, from: "Page")
click_link "apply"
end

within "#element_#{article.id}" do
click_button "Save"
end

within "#flash_notices" do
expect(page).to have_content "Saved element."
end
within "#overlay_tab_internal_link" do
expect(page).to have_selector("#s2id_page_urlname")
select2_search(page2.name, from: "Page")
click_button "apply"
end

click_button_with_label "Publish page"
within "#element_#{article.id}" do
click_button "Save"
end

visit "/#{page1.urlname}"
within "#flash_notices" do
expect(page).to have_content "Saved element."
end

within_frame "alchemy_preview_window" do
expect(page).to have_link("Link me", href: "/#{page2.urlname}")
rescue Capybara::ElementNotFound => e
pending e.message
raise e
end
end
end
Expand Down

0 comments on commit f8db000

Please sign in to comment.