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

fix test_obc_creation_and_deletion test #10754

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

DanielOsypenko
Copy link
Contributor

Fix issue with this stack trace:

self = ObjectBucketClaimsTab Web Page
locator = ('input[placeholder="Select BucketClass"],input[class="pf-c-form-control pf-m-search"], input[id="search-bar"], input[data-test="name-filter-input"]', 'css selector')
text = 'noobaa-default-bucket-class', timeout = 30


def do_send_keys(self, locator, text, timeout=30):
    """
    Send text to element on OpenShift Console

    locator (tuple): (GUI element needs to operate on (str), type (By))
    text (str): Send text to element
    timeout (int): Looks for a web element repeatedly until timeout (sec) happens.

    """
    # wait for page fully loaded only if an element was not located
    # prevents needless waiting and frequent crushes on ODF Overview page,
    # when metrics and alerts frequently updated
    if not self.get_elements(locator):
        self.page_has_loaded()
    wait = WebDriverWait(self.driver, timeout)
    try:
        if (
            version.get_semantic_version(get_ocp_version(), True)
            <= version.VERSION_4_11
        ):
            element = wait.until(
                ec.presence_of_element_located((locator[1], locator[0]))
            )
        else:

          element = wait.until(
                ec.visibility_of_element_located((locator[1], locator[0]))
            )

ocs_ci/ocs/ui/base_ui.py:287: 



self = <selenium.webdriver.support.wait.WebDriverWait (session="ebc617a4f8f2236e09eb507e8939c85c")>
method = <selenium.webdriver.support.expected_conditions.visibility_of_element_located object at 0x7f04d8380f40>
message = ''


def until(self, method, message=''):
    """Calls the method provided with the driver as an argument until the \
    return value is not False."""
    screen = None
    stacktrace = None

    end_time = time.time() + self._timeout
    while True:
        try:
            value = method(self._driver)
            if value:
                return value
        except self._ignored_exceptions as exc:
            screen = getattr(exc, 'screen', None)
            stacktrace = getattr(exc, 'stacktrace', None)
        time.sleep(self._poll)
        if time.time() > end_time:
            break

  raise TimeoutException(message, screen, stacktrace)
E       selenium.common.exceptions.TimeoutException: Message:



venv/lib64/python3.9/site-packages/selenium/webdriver/support/wait.py:80: TimeoutException


During handling of the above exception, another exception occurred:


self = <test_mcg_ui.TestObcUserInterface object at 0x7f050f6ab4c0>
setup_ui_class_factory = <function setup_ui_class_factory..factory at 0x7f04d8556430>
storageclass = 'openshift-storage.noobaa.io'
bucketclass = 'noobaa-default-bucket-class', delete_via = 'Actions'
verify_ob_removal = True


@ui
@tier1
@runs_on_provider
@bugzilla("2097772")
@pytest.mark.parametrize(
    argnames=["storageclass", "bucketclass", "delete_via", "verify_ob_removal"],
    argvalues=[
        pytest.param(
            *[
                "openshift-storage.noobaa.io",
                "noobaa-default-bucket-class",
                "three_dots",
                True,
            ],
            marks=[pytest.mark.polarion_id("OCS-4698"), mcg],
        ),
        pytest.param(
            *[
                "openshift-storage.noobaa.io",
                "noobaa-default-bucket-class",
                "Actions",
                True,
            ],
            marks=[pytest.mark.polarion_id("OCS-2542"), mcg],
        ),
        pytest.param(
            *[
                "ocs-storagecluster-ceph-rgw",
                None,
                "three_dots",
                True,
            ],
            marks=[pytest.mark.polarion_id("OCS-4845"), on_prem_platform_required],
        ),
    ],
)
def test_obc_creation_and_deletion(
    self,
    setup_ui_class_factory,
    storageclass,
    bucketclass,
    delete_via,
    verify_ob_removal,
):
    """
    Test creation and deletion of an OBC via the UI

    The test covers BZ #2097772 Introduce tooltips for contextual information
    The test covers BZ #2175685 RGW OBC creation via the UI is blocked by "Address form errors to proceed"
    """
    setup_ui_class_factory()

    obc_name = create_unique_resource_name(
        resource_description="ui", resource_type="obc"
    )

    obc_ui_obj = ObjectBucketClaimsTab()

    if (
        config.DEPLOYMENT["external_mode"]
        and storageclass == "ocs-storagecluster-ceph-rgw"
    ):
        storageclass = "ocs-external-storagecluster-ceph-rgw"

  obc_page = obc_ui_obj.create_obc_ui(obc_name, storageclass, bucketclass)

tests/functional/object/mcg/ui/test_mcg_ui.py:362: 



ocs_ci/ocs/ui/page_objects/object_bucket_claims_tab.py:158: in create_obc_ui
    self.do_send_keys(self.obc_loc["bucketclass_text_field"], bucketclass)



self = ObjectBucketClaimsTab Web Page
locator = ('input[placeholder="Select BucketClass"],input[class="pf-c-form-control pf-m-search"], input[id="search-bar"], input[data-test="name-filter-input"]', 'css selector')
text = 'noobaa-default-bucket-class', timeout = 30


def do_send_keys(self, locator, text, timeout=30):
    """
    Send text to element on OpenShift Console

    locator (tuple): (GUI element needs to operate on (str), type (By))
    text (str): Send text to element
    timeout (int): Looks for a web element repeatedly until timeout (sec) happens.

    """
    # wait for page fully loaded only if an element was not located
    # prevents needless waiting and frequent crushes on ODF Overview page,
    # when metrics and alerts frequently updated
    if not self.get_elements(locator):
        self.page_has_loaded()
    wait = WebDriverWait(self.driver, timeout)
    try:
        if (
            version.get_semantic_version(get_ocp_version(), True)
            <= version.VERSION_4_11
        ):
            element = wait.until(
                ec.presence_of_element_located((locator[1], locator[0]))
            )
        else:
            element = wait.until(
                ec.visibility_of_element_located((locator[1], locator[0]))
            )
        element.send_keys(text)
    except TimeoutException as e:
        self.take_screenshot()
        self.copy_dom()
        logger.error(e)

      raise TimeoutException(
            f"Failed to find the element ({locator[1]},{locator[0]})"
        )
E           selenium.common.exceptions.TimeoutException: Message: Failed to find the element (css selector,input[placeholder="Select BucketClass"],input[class="pf-c-form-control pf-m-search"], input[id="search-bar"], input[data-test="name-filter-input"])

@DanielOsypenko DanielOsypenko self-assigned this Oct 27, 2024
@DanielOsypenko DanielOsypenko requested a review from a team as a code owner October 27, 2024 13:43
@pull-request-size pull-request-size bot added the size/S PR that changes 10-29 lines label Oct 27, 2024
@DanielOsypenko DanielOsypenko force-pushed the test_obc_creation_and_deletion-address-intermittent-timing-issue branch from 382fb2a to 78a5425 Compare October 27, 2024 13:44
@DanielOsypenko
Copy link
Contributor Author

Signed-off-by: Daniel Osypenko <[email protected]>
@@ -2,6 +2,9 @@
import string
import time

from retry import retry
from selenium.common.exceptions import TimeoutException

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

space?

Copy link

openshift-ci bot commented Oct 28, 2024

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: am-agrawa, DanielOsypenko

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm size/S PR that changes 10-29 lines
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants