wdio-mocha-framework icon indicating copy to clipboard operation
wdio-mocha-framework copied to clipboard

Failing to show test run report when running with remote selenium server

Open ckm2k1 opened this issue 7 years ago • 1 comments

We've been seeing an issue with the reporter failing to show a report at the end of a test run. At the moment, this only happens when using a remote selenium server with the test code running on the local machine.

The cause of the issue seems to be the timeout setting in function:

   waitUntilSettled () {
        return new Promise((resolve) => {
            const start = (new Date()).getTime()
            const interval = setInterval(() => {
                const now = (new Date()).getTime()

                if (this.sentMessages !== this.receivedMessages && now - start < SETTLE_TIMEOUT) return
                clearInterval(interval)
                resolve()
            }, 100)
        })
    }

The child process fires all of its test run messages to the parent in quick succession, but because of the 5sec timeout, never has a chance to get a response from the parent which means no test results in the console. Raising the timeout to 30sec didn't help. Screenshot of a test run with no output. image

Removing the timeout completely does solve the issue, but doesn't address the underlying problem that the parent process takes a very long time to respond to the messages. image

Debugging this a little further, we noticed that this line returns false when firing messages to the parent. https://github.com/webdriverio/wdio-mocha-framework/blob/master/lib/adapter.js#L239

Node docs indicate this happens when the IPC backlog exceeds a threshold, or parent has exited. Since messages are processed given enough time, points to the IPC backlog being full.

For the moment we're simply going to remove the timeout from local code, but a long term solution is needed.

P.S For reference, I found this after writing the issue. I understand the timeout was explicit, but in that case it means the parent shouldn't exit until all received messages have been handled and displayed. https://github.com/webdriverio/wdio-mocha-framework/commit/e4000cf70c18274811aa7a74b10e0f7bac6b01fe

ckm2k1 avatar Apr 07 '17 14:04 ckm2k1

I never experienced this. Can you help and provide a reproducible example or an environment where this is reproducible?

christian-bromann avatar Aug 16 '17 09:08 christian-bromann