Fix UI test failures for operation category popover
- Click the option checkbox's label instead of the input, as Bootstrap
Material Design restyles checkboxes making the input itself not
interactable in headless Chrome
- Wait for any in-progress accordion transition before opening the target
category in categoryLinkClick. When the search box collapses an open
category and a category link is clicked during that transition,
Bootstrap silently ignores the collapse('show') call
This commit is contained in:
parent
bcf48f51d4
commit
aea2b5fa25
@ -385,13 +385,23 @@ class OperationsWaiter {
|
|||||||
// any other open category automatically. Calling "show" on an already
|
// any other open category automatically. Calling "show" on an already
|
||||||
// open category would toggle-close it mid-transition, so skip it.
|
// open category would toggle-close it mid-transition, so skip it.
|
||||||
const categoryElement = document.getElementById(categoryId);
|
const categoryElement = document.getElementById(categoryId);
|
||||||
if (categoryElement && !categoryElement.classList.contains("show")) {
|
if (!categoryElement) return;
|
||||||
|
|
||||||
|
const showCategory = function() {
|
||||||
|
if (!categoryElement.classList.contains("show")) {
|
||||||
$(categoryElement).collapse("show");
|
$(categoryElement).collapse("show");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Scroll the category into view
|
|
||||||
if (categoryElement) {
|
|
||||||
categoryElement.scrollIntoView({behavior: "smooth", block: "nearest"});
|
categoryElement.scrollIntoView({behavior: "smooth", block: "nearest"});
|
||||||
|
};
|
||||||
|
|
||||||
|
// Bootstrap ignores "show" while another panel in the accordion is still
|
||||||
|
// mid-transition (e.g. a category collapsed by the search box a moment
|
||||||
|
// earlier), so wait for any in-progress transition to finish first.
|
||||||
|
const transitioning = document.querySelector("#categories .collapsing");
|
||||||
|
if (transitioning) {
|
||||||
|
$(transitioning).one("hidden.bs.collapse shown.bs.collapse", showCategory);
|
||||||
|
} else {
|
||||||
|
showCategory();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -286,13 +286,14 @@ module.exports = {
|
|||||||
browser
|
browser
|
||||||
.expect.element("#catHashing").to.be.visible;
|
.expect.element("#catHashing").to.be.visible;
|
||||||
|
|
||||||
// Toggle the option off
|
// Toggle the option off. The checkbox input is restyled by Bootstrap
|
||||||
|
// Material Design and is not directly interactable, so click its label.
|
||||||
browser
|
browser
|
||||||
.click("#options");
|
.click("#options");
|
||||||
|
|
||||||
browser
|
browser
|
||||||
.waitForElementVisible("#options-modal", 1000)
|
.waitForElementVisible("#options-modal", 1000)
|
||||||
.click("#showOpCategories")
|
.click("label[for='showOpCategories']")
|
||||||
.pause(500)
|
.pause(500)
|
||||||
.click("#options-modal .modal-footer .btn-secondary[data-dismiss='modal']")
|
.click("#options-modal .modal-footer .btn-secondary[data-dismiss='modal']")
|
||||||
.waitForElementNotVisible("#options-modal", 1000);
|
.waitForElementNotVisible("#options-modal", 1000);
|
||||||
@ -315,7 +316,7 @@ module.exports = {
|
|||||||
browser
|
browser
|
||||||
.click("#options")
|
.click("#options")
|
||||||
.waitForElementVisible("#options-modal", 1000)
|
.waitForElementVisible("#options-modal", 1000)
|
||||||
.click("#showOpCategories")
|
.click("label[for='showOpCategories']")
|
||||||
.pause(500)
|
.pause(500)
|
||||||
.click("#options-modal .modal-footer .btn-secondary[data-dismiss='modal']")
|
.click("#options-modal .modal-footer .btn-secondary[data-dismiss='modal']")
|
||||||
.waitForElementNotVisible("#options-modal", 1000);
|
.waitForElementNotVisible("#options-modal", 1000);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user