#9947 webui tests: regression in test_webui/test_pwpolicy.py::test_pwpolicy::test_negative_value
Closed: fixed by frenaud. Opened by frenaud.

Issue

The commit https://github.com/freeipa/freeipa/commit/a1e76fa0b18ac0f7648c122645f76c3bd4c66818 introduced a regression in the test test_webui/test_pwpolicy.py::test_pwpolicy::test_negative_value

Steps to Reproduce

  1. Run the webui test test_webui/test_pwpolicy.py::test_pwpolicy::test_negative_value

See logs in https://$ARTIFACTS_SERVER/idm-ci/freeipa_upstream_nightly/Nightly-rawhide/master/2026-02-16_10-11/rawhide/test_webui_policy/2/report.html?sort=result

self = <ipatests.test_webui.test_pwpolicy.test_pwpolicy object at 0x7f32d4bcd940>
    @screenshot
    def test_negative_value(self):
        """
        Negative test for Password policy fields in edit page
        """
        self.init_app()
        self.add_record(group.ENTITY, [group.DATA, group.DATA4])
        self.navigate_to_entity(pwpolicy.ENTITY)
        non_interger_expected_error = 'Must be an integer'
        minimum_value_expected_error = 'Minimum value is 0'
        non_integer = 'nonInteger'
        maximum_value = '2147483649'
        minimum_value = '-1'
        self.add_record(pwpolicy.ENTITY, pwpolicy.DATA1,
                        dialog_btn='add_and_edit')
        for field in FIELDS:
            # bigger than max value
            # verifying if field value is more than 20000
            if field == 'krbmaxpwdlife':
                self.check_expected_error(field, 'Maximum value is 20000',
                                          maximum_value)
            # verifying if field value is more than 5
            elif field == 'krbpwdmindiffchars':
                self.check_expected_error(field, 'Maximum value is 5',
                                          maximum_value)
            # verifying if field value is more than 2147483647
            else:
>               self.check_expected_error(field, 'Maximum value is 2147483647',
                                          maximum_value)
field      = 'krbminpwdlife'
maximum_value = '2147483649'
minimum_value = '-1'
minimum_value_expected_error = 'Minimum value is 0'
non_integer = 'nonInteger'
non_interger_expected_error = 'Must be an integer'
self       = <ipatests.test_webui.test_pwpolicy.test_pwpolicy object at 0x7f32d4bcd940>
test_webui/test_pwpolicy.py:156: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
test_webui/test_pwpolicy.py:200: in check_expected_error
    self.assert_field_validation(expected_error, field=pwdfield)
        expected_error = 'Maximum value is 2147483647'
        pwdfield   = 'krbminpwdlife'
        self       = <ipatests.test_webui.test_pwpolicy.test_pwpolicy object at 0x7f32d4bcd940>
        value      = '2147483649'
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
self = <ipatests.test_webui.test_pwpolicy.test_pwpolicy object at 0x7f32d4bcd940>
expect_error = 'Maximum value is 2147483647'
parent = <selenium.webdriver.remote.webelement.WebElement (session="bdff3090-df83-448b-b7f5-65f5673497c0", element="38b95cfb-0b8e-4ea7-9044-ebe977e3b187")>
field = 'krbminpwdlife'
    def assert_field_validation(self, expect_error, parent=None, field=None):
        """
        Assert for error in field validation
        """
        if not parent:
            parent = self.get_form()
        if field:
            field_s = '.widget[name="{}"]'.format(field)
            parent = self.find(field_s, By.CSS_SELECTOR, context=parent)
        req_field_css = '.help-block[name="error_link"]'
        res = self.find(req_field_css, By.CSS_SELECTOR, context=parent)
>       assert expect_error in res.text, \
               ^^^^^^^^^^^^^^^^^^^^^^^^
            'Expected error: {} not found'.format(expect_error)
E       AssertionError: Expected error: Maximum value is 2147483647 not found
expect_error = 'Maximum value is 2147483647'
field      = 'krbminpwdlife'
field_s    = '.widget[name="krbminpwdlife"]'
parent     = <selenium.webdriver.remote.webelement.WebElement (session="bdff3090-df83-448b-b7f5-65f5673497c0", element="38b95cfb-0b8e-4ea7-9044-ebe977e3b187")>
req_field_css = '.help-block[name="error_link"]'
res        = <selenium.webdriver.remote.webelement.WebElement (session="bdff3090-df83-448b-b7f5-65f5673497c0", element="d2ccc9b3-9190-405f-9158-30a4219db988")>
self       = <ipatests.test_webui.test_pwpolicy.test_pwpolicy object at 0x7f32d4bcd940>
test_webui/ui_driver.py:2364: AssertionError

Actual behavior

The test expects a min value for krbminpwdlife = 2147483649 but the commit changed the min value to 480000

Expected behavior

The test needs to be updated and expect 480000

Version/Release/Distribution

python3-ipatests-4.14.0.dev202602160814+gita1e76fa0b-0.fc45.noarch


Metadata Update from @frenaud:
- Issue assigned to frenaud

Metadata Update from @frenaud:
- Custom field on_review adjusted to https://github.com/freeipa/freeipa/pull/8187

master:

  • d88b18bf4427e57bd7fcc2027ce30efe31cff7ea webui tests: update expected max value for krbminpwdlife

ipa-4-13:

  • 8a7486bc980b7f9b19e6b15dee6642679198c40f webui tests: update expected max value for krbminpwdlife

ipa-4-12:

  • bf270a166f7de72c75b618b186f5e6cd0f7fd5e4 webui tests: update expected max value for krbminpwdlife

Metadata Update from @frenaud:
- Issue close_status updated to: fixed
- Issue status updated to: Closed (was: Open)

Metadata