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

test: Fix unintentional ignoring of console errors #19053

Merged
merged 1 commit into from
Oct 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 31 additions & 2 deletions test/common/testlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -1702,12 +1702,41 @@ def login_and_go(self, path: Optional[str] = None, user: Optional[str] = None, h

# List of allowed console.error() messages during tests; these match substrings
default_allowed_console_errors = [
# HACK: Fix these ASAP, these are major bugs
"Warning: validateDOMNesting.*cannot appear as a",
"Warning: Encountered two children with the same key",
"Warning: Failed.*type.*prop Invalid prop",
"Warning: Failed.*type:.*is marked as required in.*but its value is `null`",
"Warning: Failed.*type:.*is marked as required in.*but its value is `undefined`",
"Warning: React does not recognize the.*prop on a DOM element",
"Warning: .*prop on .* should not be null",
# HACK: this should be fixed, it's completely expected on OSes without tracer
"Tracer failed:.*",
# HACK: These should be fixed, but debugging these is not trivial, and the impact is very low
"Warning: .* setState.*on an unmounted component",
"Warning: Can't perform a React state update on an unmounted component."
"Warning: Can't perform a React state update on an unmounted component",
"Warning: Cannot update a component.*while rendering a different component",
"Warning: A component is changing an uncontrolled input to be controlled",
"Warning: A component is changing a controlled input to be uncontrolled",
"Warning: Can't call.*on a component that is not yet mounted. This is a no-op",
"Warning: Cannot update during an existing state transition",
r"Warning: You are calling ReactDOMClient.createRoot\(\) on a container that has already been passed to createRoot",

# FIXME: PatternFly complains about these, but https://www.a11y-collective.com/blog/the-first-rule-for-using-aria/
# and https://www.accessibility-developer-guide.com/knowledge/aria/bad-practices/
"aria-label",
# messages from our own pages
"CPU temperature metric closed.*",
"failed to call cockpit.Machines.Update().*",
"Failed to enable pmproxy in firewalld.*",
"Getting properties for problem.*",
"Channel for reportd D-Bus client closed.*",
"checkRealm failed.*",
]

default_allowed_console_errors += os.environ.get("TEST_ALLOW_BROWSER_ERRORS", "").split(",")
env_allow = os.environ.get("TEST_ALLOW_BROWSER_ERRORS")
if env_allow:
default_allowed_console_errors += env_allow.split(",")

def allow_journal_messages(self, *patterns: str):
"""Don't fail if the journal contains a entry completely matching the given regexp"""
Expand Down
1 change: 1 addition & 0 deletions test/verify/check-networkmanager-wireguard
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ class TestWireGuard(packagelib.PackageCase, netlib.NetworkCase):
# Validate each field, enter the right value, and then proceed to the next field
#
# check private-key
self.allow_browser_errors("wg: Key is not the correct length or format")
b.click("#network-wireguard-settings-paste-key")
b.set_input_text("#network-wireguard-settings-private-key-input", "incorrect key")
b.set_input_text("#network-wireguard-settings-addresses-input", m1_ip4)
Expand Down
5 changes: 5 additions & 0 deletions test/verify/check-sosreport
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,8 @@ exit 1""", perm="755")
b.wait_not_present("#sos-dialog")

self.allow_journal_messages('.*comm="sosreport".*')
# HACK: Fix this in the code, this is useless
self.allow_browser_errors('error: {"problem":null,"exit_status":1,"exit_signal":null')

def testWithUrlRoot(self):
self.testBasic(urlroot="/webcon")
Expand Down Expand Up @@ -173,6 +175,9 @@ only-plugins=release,date,host,cgroups,networking
m.execute("while pgrep -a -x sos; do sleep 1; done", timeout=10)
self.assertEqual(m.execute("ls /var/tmp/sosreport* 2>/dev/null || true"), "")

# HACK: Fix this in the code, this is useless
self.allow_browser_errors('error: {"problem":"cancelled","exit_status":null')

def testAppStream(self):
b = self.browser
m = self.machine
Expand Down