Fix double execution

This commit is contained in:
Adrian Vollmer 2024-04-03 20:31:56 +02:00
parent f7530f8ff9
commit 648a962ca4
2 changed files with 2 additions and 10 deletions

View File

@ -17,10 +17,8 @@ def test_copy_button(selenium):
assert "copy-button documentation" in selenium.title
selenium.switch_to.frame("main")
# Not sure why there are two buttons, but we need the second one.
# The first cannot be clicked by selenium because it's obscured.
button = selenium.find_element(By.CSS_SELECTOR, "button.copybtn + button.copybtn")
button = selenium.find_element(By.CSS_SELECTOR, "button.copybtn")
assert button.get_attribute("data-tooltip") == "Copy"
assert "success" not in button.get_attribute("class")

View File

@ -101,15 +101,9 @@ var normalize_path = function(path) {
var on_set_data = function(argument) {
window.global_context = argument;
console.log("Received data from parent", window.global_context);
console.debug("Received data from parent", window.global_context);
try {
monkey_patch();
// Trigger DOMContentLoaded again, some scripts that have just
// been executed expect it.
window.document.dispatchEvent(new Event("DOMContentLoaded", {
bubbles: true,
cancelable: true
}));
} finally {
observer.observe(window.document.body, {subtree: true, childList: true});
window.parent.postMessage({