#8191 Nightly failure in ipatests.test_webui.test_service.test_service::test_certificates
Opened by frenaud. Modified

The test fedora-29/test_webui_service failed in ::test_service::test_certificates in PR 4215, see logs:

self = <ipatests.test_webui.test_service.test_service object at 0x7fd466069550>
    @screenshot
    def test_certificates(self):
        """
        Test service certificate actions
        Requires to have CA installed.
        """
        if not self.has_ca():
            self.skip('CA is not configured')
        self.init_app()
        data = self.prep_data()
        pkey = data.get('pkey')
        hostname = self.config.get('ipa_server')
        csr = generate_csr(hostname)
        cert_widget_sel = "div.certificate-widget"
        self.add_record(ENTITY, data)
        self.navigate_to_record(pkey)
        # cert request
        self.action_list_action('request_cert', confirm=False)
        # testing if cancel button works
>       self.dialog_button_click('cancel')
/usr/lib/python3.7/site-packages/ipatests/test_webui/test_service.py:170: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/usr/lib/python3.7/site-packages/ipatests/test_webui/ui_driver.py:699: in dialog_button_click
    self._button_click(s, dialog, name)
/usr/lib/python3.7/site-packages/ipatests/test_webui/ui_driver.py:739: in _button_click
    btn.click()
/usr/local/lib/python3.7/site-packages/selenium/webdriver/remote/webelement.py:80: in click
    self._execute(Command.CLICK_ELEMENT)
/usr/local/lib/python3.7/site-packages/selenium/webdriver/remote/webelement.py:633: in _execute
    return self._parent.execute(command, params)
/usr/local/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py:321: in execute
    self.error_handler.check_response(response)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
self = <selenium.webdriver.remote.errorhandler.ErrorHandler object at 0x7fd4679abd10>
response = {'status': 400, 'value': '{"value":{"error":"element click intercepted","message":"Element <button class=\\"btn btn-de...te@chrome://marionette/content/listener.js:447:7\\nclickElement@chrome://marionette/content/listener.js:1315:18\\n"}}'}
    def check_response(self, response):
        """
        Checks that a JSON response from the WebDriver does not have an error.
        :Args:
         - response - The JSON response from the WebDriver server as a dictionary
           object.
        :Raises: If the response contains an error message.
        """
        status = response.get('status', None)
        if status is None or status == ErrorCode.SUCCESS:
            return
        value = None
        message = response.get("message", "")
        screen = response.get("screen", "")
        stacktrace = None
        if isinstance(status, int):
            value_json = response.get('value', None)
            if value_json and isinstance(value_json, basestring):
                import json
                try:
                    value = json.loads(value_json)
                    if len(value.keys()) == 1:
                        value = value['value']
                    status = value.get('error', None)
                    if status is None:
                        status = value["status"]
                        message = value["value"]
                        if not isinstance(message, basestring):
                            value = message
                            message = message.get('message')
                    else:
                        message = value.get('message', None)
                except ValueError:
                    pass
        exception_class = ErrorInResponseException
        if status in ErrorCode.NO_SUCH_ELEMENT:
            exception_class = NoSuchElementException
        elif status in ErrorCode.NO_SUCH_FRAME:
            exception_class = NoSuchFrameException
        elif status in ErrorCode.NO_SUCH_WINDOW:
            exception_class = NoSuchWindowException
        elif status in ErrorCode.STALE_ELEMENT_REFERENCE:
            exception_class = StaleElementReferenceException
        elif status in ErrorCode.ELEMENT_NOT_VISIBLE:
            exception_class = ElementNotVisibleException
        elif status in ErrorCode.INVALID_ELEMENT_STATE:
            exception_class = InvalidElementStateException
        elif status in ErrorCode.INVALID_SELECTOR \
                or status in ErrorCode.INVALID_XPATH_SELECTOR \
                or status in ErrorCode.INVALID_XPATH_SELECTOR_RETURN_TYPER:
            exception_class = InvalidSelectorException
        elif status in ErrorCode.ELEMENT_IS_NOT_SELECTABLE:
            exception_class = ElementNotSelectableException
        elif status in ErrorCode.ELEMENT_NOT_INTERACTABLE:
            exception_class = ElementNotInteractableException
        elif status in ErrorCode.INVALID_COOKIE_DOMAIN:
            exception_class = InvalidCookieDomainException
        elif status in ErrorCode.UNABLE_TO_SET_COOKIE:
            exception_class = UnableToSetCookieException
        elif status in ErrorCode.TIMEOUT:
            exception_class = TimeoutException
        elif status in ErrorCode.SCRIPT_TIMEOUT:
            exception_class = TimeoutException
        elif status in ErrorCode.UNKNOWN_ERROR:
            exception_class = WebDriverException
        elif status in ErrorCode.UNEXPECTED_ALERT_OPEN:
            exception_class = UnexpectedAlertPresentException
        elif status in ErrorCode.NO_ALERT_OPEN:
            exception_class = NoAlertPresentException
        elif status in ErrorCode.IME_NOT_AVAILABLE:
            exception_class = ImeNotAvailableException
        elif status in ErrorCode.IME_ENGINE_ACTIVATION_FAILED:
            exception_class = ImeActivationFailedException
        elif status in ErrorCode.MOVE_TARGET_OUT_OF_BOUNDS:
            exception_class = MoveTargetOutOfBoundsException
        elif status in ErrorCode.JAVASCRIPT_ERROR:
            exception_class = JavascriptException
        elif status in ErrorCode.SESSION_NOT_CREATED:
            exception_class = SessionNotCreatedException
        elif status in ErrorCode.INVALID_ARGUMENT:
            exception_class = InvalidArgumentException
        elif status in ErrorCode.NO_SUCH_COOKIE:
            exception_class = NoSuchCookieException
        elif status in ErrorCode.UNABLE_TO_CAPTURE_SCREEN:
            exception_class = ScreenshotException
        elif status in ErrorCode.ELEMENT_CLICK_INTERCEPTED:
            exception_class = ElementClickInterceptedException
        elif status in ErrorCode.INSECURE_CERTIFICATE:
            exception_class = InsecureCertificateException
        elif status in ErrorCode.INVALID_COORDINATES:
            exception_class = InvalidCoordinatesException
        elif status in ErrorCode.INVALID_SESSION_ID:
            exception_class = InvalidSessionIdException
        elif status in ErrorCode.UNKNOWN_METHOD:
            exception_class = UnknownMethodException
        else:
            exception_class = WebDriverException
        if value == '' or value is None:
            value = response['value']
        if isinstance(value, basestring):
            if exception_class == ErrorInResponseException:
                raise exception_class(response, value)
            raise exception_class(value)
        if message == "" and 'message' in value:
            message = value['message']
        screen = None
        if 'screen' in value:
            screen = value['screen']
        stacktrace = None
        if 'stackTrace' in value and value['stackTrace']:
            stacktrace = []
            try:
                for frame in value['stackTrace']:
                    line = self._value_or_default(frame, 'lineNumber', '')
                    file = self._value_or_default(frame, 'fileName', '<anonymous>')
                    if line:
                        file = "%s:%s" % (file, line)
                    meth = self._value_or_default(frame, 'methodName', '<anonymous>')
                    if 'className' in frame:
                        meth = "%s.%s" % (frame['className'], meth)
                    msg = "    at %s (%s)"
                    msg = msg % (meth, file)
                    stacktrace.append(msg)
            except TypeError:
                pass
        if exception_class == ErrorInResponseException:
            raise exception_class(response, message)
        elif exception_class == UnexpectedAlertPresentException:
            alert_text = None
            if 'data' in value:
                alert_text = value['data'].get('text')
            elif 'alert' in value:
                alert_text = value['alert'].get('text')
            raise exception_class(message, screen, stacktrace, alert_text)
>       raise exception_class(message, screen, stacktrace)
E       selenium.common.exceptions.ElementClickInterceptedException: Message: Element <button class="btn btn-default" name="cancel" type="button"> is not clickable at point (881,504) because another element <div class="widget global-activity-indicator slider"> obscures it
/usr/local/lib/python3.7/site-packages/selenium/webdriver/remote/errorhandler.py:242: ElementClickInterceptedException

The cancel button is obscured.


The test also failed in PR #4388 - [testing_master_previous] on fedora 30 at a different line:

>       self.close_notifications()
test_webui/test_service.py:269: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
test_webui/ui_driver.py:795: in close_notifications
    button.click()
/usr/local/lib/python3.7/site-packages/selenium/webdriver/remote/webelement.py:80: in click
    self._execute(Command.CLICK_ELEMENT)
/usr/local/lib/python3.7/site-packages/selenium/webdriver/remote/webelement.py:633: in _execute
    return self._parent.execute(command, params)
/usr/local/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py:321: in execute
    self.error_handler.check_response(response)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

Also happened in PR#4603 while testing master branch on fedora 31.

Also happened in PR #257 but at a different location:

self = <ipatests.test_webui.test_service.test_service object at 0x7fb9d7daf220>
    @screenshot
    def test_certificates(self):
        """
        Test service certificate actions
        Requires to have CA installed.
        """
        if not self.has_ca():
            self.skip('CA is not configured')
        self.init_app()
        data = self.prep_data()
        pkey = data.get('pkey')
        hostname = self.config.get('ipa_server')
        csr = generate_csr(hostname)
        cert_widget_sel = "div.certificate-widget"
        self.add_record(ENTITY, data)
        self.navigate_to_record(pkey)
        # cert request
        self.action_list_action('request_cert', confirm=False)
        # testing if cancel button works
        self.dialog_button_click('cancel')
        self.action_list_action('request_cert', confirm=False)
        self.assert_dialog()
        self.fill_text("textarea[name='csr'", csr)
        self.dialog_button_click('issue')
        self.wait_for_request(n=2, d=3)
        self.assert_visible(cert_widget_sel)
        widget = self.find(cert_widget_sel, By.CSS_SELECTOR)
        # cert view
        self.action_list_action('view', confirm=False,
                                parents_css_sel=cert_widget_sel)
        self.assert_dialog()
        self.dialog_button_click('close')
        # cert get
        self.action_list_action('get', confirm=False,
                                parents_css_sel=cert_widget_sel)
        self.assert_dialog()
        # check that text area is not empty
        self.assert_empty_value('textarea.certificate', negative=True)
        self.dialog_button_click('close')
        # cert download - we can only try to click the download action
        self.action_list_action('download', confirm=False,
                                parents_css_sel=cert_widget_sel)
        # check that revoke action is enabled
        self.assert_action_list_action('revoke',
                                       parents_css_sel=cert_widget_sel,
                                       facet_actions=False)
        # check that remove_hold action is not enabled
        self.assert_action_list_action('remove_hold', enabled=False,
                                       parents_css_sel=cert_widget_sel,
                                       facet_actions=False)
        # cert revoke/hold cancel
        self.action_list_action('revoke', confirm=False,
                                parents_css_sel=cert_widget_sel)
        self.wait()
        self.select('select', '6')
        self.dialog_button_click('cancel')
        # cert revoke/hold
        self.action_list_action('revoke', confirm=False,
                                parents_css_sel=cert_widget_sel)
        self.wait()
        self.select('select', '6')
        self.dialog_button_click('ok')
        self.wait_while_working(widget)
        self.assert_visible(cert_widget_sel + " div.watermark")
        # check that revoke action is not enabled
        self.assert_action_list_action('revoke', enabled=False,
                                       parents_css_sel=cert_widget_sel,
                                       facet_actions=False)
        # check that remove_hold action is enabled
        self.assert_action_list_action('remove_hold',
                                       parents_css_sel=cert_widget_sel,
                                       facet_actions=False)
        # cert remove hold cancel
        self.action_list_action('remove_hold', confirm=False,
                                parents_css_sel=cert_widget_sel)
        self.dialog_button_click('cancel')
        # cert remove hold
        self.action_list_action('remove_hold', confirm=False,
                                parents_css_sel=cert_widget_sel)
        self.wait()
        self.dialog_button_click('ok')
        self.wait_while_working(widget)
        # check that revoke action is enabled
        self.assert_action_list_action('revoke',
                                       parents_css_sel=cert_widget_sel,
                                       facet_actions=False)
        # check that remove_hold action is not enabled
        self.assert_action_list_action('remove_hold', enabled=False,
                                       parents_css_sel=cert_widget_sel,
                                       facet_actions=False)
        # cert revoke cancel
        self.action_list_action('revoke', confirm=False,
                                parents_css_sel=cert_widget_sel)
        self.wait()
>       self.select('select', '1')

Similar error observed in [testing_master_testing_selinux] Nightly PR 526

Metadata Update from @frenaud:
- Issue tagged with: webui

Also happened in PR#571 (testing_master_latest on fedora 32) but at a different location: report

Also happened in [testing_ipa-4.9_latest] Nightly PR #920 , but with slightly different error

>       self.close_notifications()
test_webui/test_service.py:269: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
test_webui/ui_driver.py:800: in close_notifications
    button.click()
/usr/local/lib/python3.9/site-packages/selenium/webdriver/remote/webelement.py:80: in click
    self._execute(Command.CLICK_ELEMENT)
/usr/local/lib/python3.9/site-packages/selenium/webdriver/remote/webelement.py:633: in _execute
    return self._parent.execute(command, params)
/usr/local/lib/python3.9/site-packages/selenium/webdriver/remote/webdriver.py:321: in execute
    self.error_handler.check_response(response)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
self = <selenium.webdriver.remote.errorhandler.ErrorHandler object at 0x7f76622bc0d0>
response = {'status': 404, 'value': '{"value":{"error":"stale element reference","message":"The element reference of <button clas...ontent/evaluate.js:240:29\\nreceiveMessage@chrome://marionette/content/actors/MarionetteCommandsChild.jsm:74:29\\n"}}'}
...
        if exception_class == ErrorInResponseException:
            raise exception_class(response, message)
        elif exception_class == UnexpectedAlertPresentException:
            alert_text = None
            if 'data' in value:
                alert_text = value['data'].get('text')
            elif 'alert' in value:
                alert_text = value['alert'].get('text')
            raise exception_class(message, screen, stacktrace, alert_text)
>       raise exception_class(message, screen, stacktrace)
E       selenium.common.exceptions.StaleElementReferenceException: Message: The element reference of <button class="close" type="button"> is stale; either the element is no longer attached to the DOM, it is not in the current frame context, or the document has been refreshed

report

And again the original error, present in https://github.com/freeipa-pr-ci2/freeipa/pull/935, report

Metadata Update from @mpolovka:
- Issue assigned to mpolovka

Metadata Update from @mpolovka:
- Assignee reset

Metadata Update from @mpolovka:
- Issue assigned to ebelko

Metadata