bitovi / testee

Automated cross-browser JavaScript testing made easy
https://www.npmjs.com/package/testee
MIT License
119 stars 27 forks source link

Getting browser timed out within 120 seconds despite chrome running in background. #207

Open sarosejoshi opened 1 year ago

sarosejoshi commented 1 year ago

Issue

Getting browser timed out within 120 seconds despite chrome running in background.

Version

Ubuntu: 20.04.5 LTS testee : 0.9.1 & 0.10.2 npm: 6.14.4 node: 10.19.0 Chrome: 108.0.5359.124

testee.json

{
    "port": 3621,
    "root": ".",
    "reporter": "Spec",
    "timeout": 120,
    "delay": 1000,
    "tunnel": {
        "type": "local"
    },
    "launch": {
        "type": "local"
    },
    "browsers": [{
        "browser": "chromium",
        "args": [
            "--headless",
            "--disable-gpu",
            "--no-sandbox",
            "--remote-debugging-port=9222"
        ]
    }]
}

test.html

<!doctype html>
<html lang="en">

<head>
    <meta charset="utf-8">
    <title>Menuboard Manager Studio tests</title>
    <link rel="stylesheet" href="https://code.jquery.com/qunit/qunit-2.9.2.css">
</head>

<body>
    <div id="qunit"></div>
    <div id="qunit-fixture"></div>

    <script src="https://code.jquery.com/qunit/qunit-2.9.2.js"></script>
    <script>
        localStorage.setItem('environment', 'test');
        FuncUnit = {
            frameMode: true
        };
    </script>
    <script>QUnit.config.testTimeout = 30000; // Qunit global timeout</script>
    <script src="./node_modules/funcunit/dist/funcunit.js"></script>
    <script type="module" src="./app/models/fixtures/fixtures.js"></script>
    <script type="module" src="./app/components/test.js"></script>
    <script type="module" src="./app/models/test.js"></script>
    <script type="module" src="./app/pages/test.js"></script>
    <script type="module" src="./app/util/test.js"></script>
    <script type="module" src="./app/test.js"></script>
</body>

</html>

Executing the testee

./node_modules/testee/bin/testee test.html --config=testee.json

While running the testee, the chromium-browser is running in background

# ps  aux
USER         PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root           1  0.0  0.0   4248  3464 pts/0    Ss   05:09   0:00 bash
root        1403  0.0  0.0   2616   528 pts/1    Ss   05:18   0:00 sh
root        1415 39.0  0.2 729804 85672 pts/0    Sl+  05:20   0:01 node ./node_modules/testee/bin/testee test.html --config=testee.json
root        1435 11.6  0.3 33948260 106240 pts/0 Sl+  05:20   0:00 /usr/bin/chromium-browser --headless --disable-gpu --no-sandbox --remote-debugging-port=9222 ht
root        1440  0.0  0.0   2660   580 pts/0    S+   05:20   0:00 cat
root        1441  0.0  0.0   2660   512 pts/0    S+   05:20   0:00 cat
root        1443  2.0  0.0 33600964 12320 ?      Sl   05:20   0:00 /opt/google/chrome/chrome_crashpad_handler --monitor-self-annotation=ptype=crashpad-handler --d
root        1447  0.6  0.1 33822564 56208 pts/0  S+   05:20   0:00 /opt/google/chrome/chrome --type=zygote --no-zygote-sandbox --no-sandbox --headless --headless 
root        1448  0.6  0.1 33822564 56260 pts/0  S+   05:20   0:00 /opt/google/chrome/chrome --type=zygote --no-sandbox --headless --headless --crashpad-handler-p
root        1462  1.0  0.1 33951608 62892 pts/0  Sl+  05:20   0:00 /opt/google/chrome/chrome --type=gpu-process --no-sandbox --headless --ozone-platform=headless 
root        1463  5.0  0.2 33888376 86212 pts/0  Sl+  05:20   0:00 /opt/google/chrome/chrome --type=utility --utility-sub-type=network.mojom.NetworkService --lang
r

The netstat shows the 9222 port is listening

#  netstat -anlp | grep -i listen
tcp        0      0 127.0.0.1:9222          0.0.0.0:*               LISTEN      1435/chromium-brows 
tcp6       0      0 :::3621                 :::*                    LISTEN      1415/node  

After few minutes, i get this

# ./node_modules/testee/bin/testee test.html --config=testee.json

General error
  1) http://localhost:3621/test.html?__token=jklg23 on {"browser":"chromium","args":["--headless","--disable-gpu","--no-sandbox","--remote-debugging-port=9222"]}

  0 passing (2m)
  1 failing

  1) General error
       http://localhost:3621/test.html?__token=jklg23 on {"browser":"chromium","args":["--headless","--disable-gpu","--no-sandbox","--remote-debugging-port=9222"]}:
     Error: Browser timed out within 120 seconds
      at Timeout.testTimedOut [as _onTimeout] (/usr/src/app/node_modules/testee/lib/runner.js:47:27)
      at ontimeout (timers.js:436:11)
      at tryOnTimeout (timers.js:300:5)
      at listOnTimeout (timers.js:263:5)
      at Timer.processTimers (timers.js:223:10)

Chrome logs

[0108/054726.757342:ERROR:bus.cc(399)] Failed to connect to the bus: Failed to connect to socket /var/run/dbus/system_bus_socket: No such file or directory
[0108/054726.757503:ERROR:bus.cc(399)] Failed to connect to the bus: Failed to connect to socket /var/run/dbus/system_bus_socket: No such file or directory

DevTools listening on ws://127.0.0.1:9222/devtools/browser/544b342c-00af-4a52-943c-4321c033f62e
[0108/054726.762641:WARNING:bluez_dbus_manager.cc(247)] Floss manager not present, cannot set Floss enable/disable.
[0108/054726.781717:WARNING:sandbox_linux.cc(380)] InitializeSandbox() called with multiple threads in process gpu-process.