From 50a36a1bbcb21a42d256ad08fbc2750fe304e600 Mon Sep 17 00:00:00 2001 From: Sven Nierlein Date: Tue, 3 Sep 2024 09:42:04 +0200 Subject: [PATCH] tests: fix occasional chrome console errors [file:///.../Thruk/t/:45:8] Uncaught: TypeError: Cannot read properties of null (reading 'appendChild') at addRow (file:///.../Thruk/t/:46:9) at file:///.../Thruk/t/:238:9 [file:///.../Thruk/t/:45:8] Uncaught: TypeError: Cannot read properties of null (reading 'appendChild') at addRow (file:///.../Thruk/t/:46:9) at file:///.../Thruk/t/:239:9 those errors are from the directory index page of chrome itself. --- MANIFEST | 1 + t/TestUtils.pm | 11 +---------- t/data/blank.html | 2 ++ 3 files changed, 4 insertions(+), 10 deletions(-) create mode 100644 t/data/blank.html diff --git a/MANIFEST b/MANIFEST index bc66af7d2..74969eaeb 100644 --- a/MANIFEST +++ b/MANIFEST @@ -2057,6 +2057,7 @@ t/900-javascript_syntax.t t/900-javascript_utils.t t/ci/thruk_local.conf t/data/800-plugins/01-css.t +t/data/blank.html t/data/broken_config/a.conf t/data/broken_config/b.conf t/data/broken_config2/a.conf diff --git a/t/TestUtils.pm b/t/TestUtils.pm index 28863aba4..fe239adbe 100644 --- a/t/TestUtils.pm +++ b/t/TestUtils.pm @@ -1276,16 +1276,7 @@ sub js_init { tab => 'current', launch_arg => ["--password-store=basic", "--remote-allow-origins=*"], ); - $mech->get_local("."); - eval { - $mech->update_html(""); - }; - if($@) { - # retry once because of occasional: Could not find node with given id - # -32000 at .../lib/perl5/Chrome/DevToolsProtocol/Target.pm line 508 - sleep(2); - $mech->update_html(""); - } + $mech->get_local("./data/blank.html"); $mech->clear_js_errors(); my $console = $mech->add_listener('Runtime.consoleAPICalled', sub { diff --git a/t/data/blank.html b/t/data/blank.html new file mode 100644 index 000000000..90531a4b3 --- /dev/null +++ b/t/data/blank.html @@ -0,0 +1,2 @@ + +