Replace "execute_script" in publisher_steps definitions

This commit is contained in:
Sage Ross 2021-12-30 14:39:33 -08:00 committed by Benjamin Neff
parent 4548380080
commit 637dad208a
No known key found for this signature in database
GPG key ID: 971464C3F1A90194

View file

@ -13,9 +13,11 @@ Then /^the publisher should be expanded$/ do
end end
When /^I click to delete the first uploaded photo$/ do When /^I click to delete the first uploaded photo$/ do
page.execute_script("$('#photodropzone .x').css('display', 'block');")
image_count = all(".publisher_photo img", wait: false).count image_count = all(".publisher_photo img", wait: false).count
find("#photodropzone .x", match: :first).trigger "click" within "ul#photodropzone" do
first("img").hover
find(".x", match: :first).trigger "click"
end
page.assert_selector(".publisher_photo img", count: image_count - 1) page.assert_selector(".publisher_photo img", count: image_count - 1)
end end
@ -68,12 +70,6 @@ When /^I post an extremely long status message$/ do
end end
When /^I select "([^"]*)" on the aspect dropdown$/ do |text| When /^I select "([^"]*)" on the aspect dropdown$/ do |text|
page.execute_script( find("button.dropdown-toggle").click
"$('#publisher .dropdown .dropdown_list, #publisher .aspect-dropdown .dropdown-menu') find(".dropdown-menu li", text: text).click
.find('li').each(function(i,el){
var elem = $(el);
if ('" + text + "' == $.trim(elem.text()) ) {
elem.click();
}});"
)
end end