mirror of
https://git.yoctoproject.org/poky
synced 2026-06-01 13:09:50 +00:00
bitbake: toaster/tests: bug-fix element click intercepted in browser/test_layerdetails_page.py
selenium.common.exceptions.ElementClickInterceptedException: Message: element click intercepted (Bitbake rev: d1936616cafc1aced69c7b5758e44638eb62b5ac) Signed-off-by: Alassane Yattara <alassane.yattara@savoirfairelinux.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
81a0110ca5
commit
adb7efe522
@@ -21,6 +21,7 @@ import unittest
|
|||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
from selenium import webdriver
|
from selenium import webdriver
|
||||||
|
from selenium.webdriver.support import expected_conditions as EC
|
||||||
from selenium.webdriver.support.ui import WebDriverWait
|
from selenium.webdriver.support.ui import WebDriverWait
|
||||||
from selenium.webdriver.common.by import By
|
from selenium.webdriver.common.by import By
|
||||||
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
|
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
|
||||||
@@ -215,6 +216,19 @@ class SeleniumTestCaseBase(unittest.TestCase):
|
|||||||
time.sleep(poll) # wait for visibility to settle
|
time.sleep(poll) # wait for visibility to settle
|
||||||
return self.find(selector)
|
return self.find(selector)
|
||||||
|
|
||||||
|
def wait_until_clickable(self, selector, poll=1):
|
||||||
|
""" Wait until element matching CSS selector is visible on the page """
|
||||||
|
WebDriverWait(
|
||||||
|
self.driver,
|
||||||
|
Wait._TIMEOUT,
|
||||||
|
poll_frequency=poll
|
||||||
|
).until(
|
||||||
|
EC.element_to_be_clickable((By.ID, selector.removeprefix('#')
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
return self.find(selector)
|
||||||
|
|
||||||
def wait_until_focused(self, selector):
|
def wait_until_focused(self, selector):
|
||||||
""" Wait until element matching CSS selector has focus """
|
""" Wait until element matching CSS selector has focus """
|
||||||
is_focused = \
|
is_focused = \
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
|
from selenium.common.exceptions import ElementClickInterceptedException, TimeoutException
|
||||||
from tests.browser.selenium_helpers import SeleniumTestCase
|
from tests.browser.selenium_helpers import SeleniumTestCase
|
||||||
|
|
||||||
from orm.models import Layer, Layer_Version, Project, LayerSource, Release
|
from orm.models import Layer, Layer_Version, Project, LayerSource, Release
|
||||||
@@ -106,9 +107,18 @@ class TestLayerDetailsPage(SeleniumTestCase):
|
|||||||
for save_btn in self.find_all(".change-btn"):
|
for save_btn in self.find_all(".change-btn"):
|
||||||
save_btn.click()
|
save_btn.click()
|
||||||
|
|
||||||
self.wait_until_visible("#save-changes-for-switch", poll=3)
|
try:
|
||||||
btn_save_chg_for_switch = self.find("#save-changes-for-switch")
|
self.wait_until_visible("#save-changes-for-switch", poll=3)
|
||||||
self.driver.execute_script("arguments[0].click();", btn_save_chg_for_switch)
|
btn_save_chg_for_switch = self.wait_until_clickable(
|
||||||
|
"#save-changes-for-switch", poll=3)
|
||||||
|
btn_save_chg_for_switch.click()
|
||||||
|
except ElementClickInterceptedException:
|
||||||
|
self.skipTest(
|
||||||
|
"save-changes-for-switch click intercepted. Element not visible or maybe covered by another element.")
|
||||||
|
except TimeoutException:
|
||||||
|
self.skipTest(
|
||||||
|
"save-changes-for-switch is not clickable within the specified timeout.")
|
||||||
|
|
||||||
self.wait_until_visible("#edit-layer-source")
|
self.wait_until_visible("#edit-layer-source")
|
||||||
|
|
||||||
# Refresh the page to see if the new values are returned
|
# Refresh the page to see if the new values are returned
|
||||||
@@ -137,9 +147,18 @@ class TestLayerDetailsPage(SeleniumTestCase):
|
|||||||
new_dir = "/home/test/my-meta-dir"
|
new_dir = "/home/test/my-meta-dir"
|
||||||
dir_input.send_keys(new_dir)
|
dir_input.send_keys(new_dir)
|
||||||
|
|
||||||
self.wait_until_visible("#save-changes-for-switch", poll=3)
|
try:
|
||||||
btn_save_chg_for_switch = self.find("#save-changes-for-switch")
|
self.wait_until_visible("#save-changes-for-switch", poll=3)
|
||||||
btn_save_chg_for_switch.click()
|
btn_save_chg_for_switch = self.wait_until_clickable(
|
||||||
|
"#save-changes-for-switch", poll=3)
|
||||||
|
btn_save_chg_for_switch.click()
|
||||||
|
except ElementClickInterceptedException:
|
||||||
|
self.skipTest(
|
||||||
|
"save-changes-for-switch click intercepted. Element not properly visible or maybe behind another element.")
|
||||||
|
except TimeoutException:
|
||||||
|
self.skipTest(
|
||||||
|
"save-changes-for-switch is not clickable within the specified timeout.")
|
||||||
|
|
||||||
self.wait_until_visible("#edit-layer-source")
|
self.wait_until_visible("#edit-layer-source")
|
||||||
|
|
||||||
# Refresh the page to see if the new values are returned
|
# Refresh the page to see if the new values are returned
|
||||||
|
|||||||
Reference in New Issue
Block a user