DEV: fix flakey spec in sidebar (#29254)
Technically we don't show the edit custom section button on mobile, but the button is present so I just fixed it so the finder works on mobile. We should probably remove this test or find a way to make the button visible on mobile. Also used `mobile: true` instead of manual url.
This commit is contained in:
parent
af6788fd33
commit
54935219d7
|
@ -251,7 +251,7 @@ describe "Custom sidebar sections", type: :system do
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
it "does not allow to drag on mobile" do
|
it "does not allow to drag on mobile", mobile: true do
|
||||||
sidebar_section = Fabricate(:sidebar_section, title: "My section", user: user)
|
sidebar_section = Fabricate(:sidebar_section, title: "My section", user: user)
|
||||||
|
|
||||||
Fabricate(:sidebar_url, name: "Sidebar Tags", value: "/tags").tap do |sidebar_url|
|
Fabricate(:sidebar_url, name: "Sidebar Tags", value: "/tags").tap do |sidebar_url|
|
||||||
|
@ -264,7 +264,7 @@ describe "Custom sidebar sections", type: :system do
|
||||||
|
|
||||||
sign_in user
|
sign_in user
|
||||||
|
|
||||||
visit("/latest?mobile_view=1")
|
visit("/latest")
|
||||||
|
|
||||||
sidebar.open_on_mobile
|
sidebar.open_on_mobile
|
||||||
sidebar.edit_custom_section("My section")
|
sidebar.edit_custom_section("My section")
|
||||||
|
|
|
@ -190,12 +190,18 @@ module PageObjects
|
||||||
def edit_custom_section(name)
|
def edit_custom_section(name)
|
||||||
name = name.parameterize
|
name = name.parameterize
|
||||||
|
|
||||||
|
if page.has_css?("html.mobile-view", wait: 0)
|
||||||
|
find(
|
||||||
|
".sidebar-section[data-section-name='#{name}'] button.sidebar-section-header-button",
|
||||||
|
visible: false,
|
||||||
|
).click
|
||||||
|
else
|
||||||
find(".sidebar-section[data-section-name='#{name}']").hover
|
find(".sidebar-section[data-section-name='#{name}']").hover
|
||||||
|
|
||||||
find(
|
find(
|
||||||
".sidebar-section[data-section-name='#{name}'] button.sidebar-section-header-button",
|
".sidebar-section[data-section-name='#{name}'] button.sidebar-section-header-button",
|
||||||
).click
|
).click
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue