Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unneeded yui scrolling #1861

Merged
merged 6 commits into from
Dec 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 2 additions & 30 deletions src/main/java/org/jenkinsci/test/acceptance/po/Control.java
Original file line number Diff line number Diff line change
Expand Up @@ -215,25 +215,8 @@ public void selectDropdownMenu(String displayName) {
@Override
protected WebElement find(String caption) {
WebElement menuButton = resolve();
try {
WebElement menu = findElement(menuButton, by.xpath(".."));
return findElement(menu, by.button(caption));
} catch (NoSuchElementException e) {
// With enough implementations registered the one we are looking for might
// require scrolling in menu to become visible. This dirty hack stretch
// yui menu so that all the items are visible.
executeScript("YAHOO.util.Dom.batch("
+ " document.querySelector('.yui-menu-body-scrolled'),"
+ " function (el) {"
+ " el.style.height = 'auto';"
+ " YAHOO.util.Dom.removeClass(el, 'yui-menu-body-scrolled');"
+ " }"
+ ");");
// we can not use `Select` as these are YUI menus and we need to wait for it to be visible
WebElement menu =
findElement(menuButton, by.xpath("ancestor::*[contains(@class,'yui-menu-button')]/.."));
return findElement(menu, by.link(caption));
}
WebElement menu = findElement(menuButton, by.xpath(".."));
return findElement(menu, by.button(caption));
}
};

Expand All @@ -250,17 +233,6 @@ public void selectDropdownMenuAlt(Class<?> type) {
protected WebElement find(String caption) {
WebElement menuButton = resolve();

// With enough implementations registered the one we are looking for might
// require scrolling in menu to become visible. This dirty hack stretch
// yui menu so that all the items are visible.
executeScript("YAHOO.util.Dom.batch("
+ " document.querySelector('.yui-menu-body-scrolled'),"
+ " function (el) {"
+ " el.style.height = 'auto';"
+ " YAHOO.util.Dom.removeClass(el, 'yui-menu-body-scrolled');"
+ " }"
+ ");");

Select context = new Select(findElement(
menuButton,
by.xpath("ancestor-or-self::*[contains(@class,'setting-input dropdownList')] | "
Expand Down
Loading