Closed Alenechka closed 3 years ago
can you please verify if closeBrowser()
called else where in your tests ?
Yes, using VScode search just in one place in
afterSuite(async () => {
await closeBrowser();
});
Any updates on this issue?
It's passing for me with the sample provided on this issue
I noticed that you mentioned that you are using Chrome instead of the Chromium that is bundled with Taiko. While it should work there may be issues with versions. Please check if the tests pass with the version of Chromium that comes bundled with Taiko.
The same issue with Chromium. But when I set headless_chrome = true everything works perfectly fine even with Chrome. That's why I don't have this issue on my linux VM I guess. My Chrome version is 86.0.4240.75.
Ok, things are different in headless mode and non headless mode.
Google pops up an additional modal window in headless mode and this is not accounted for in the tests. The only way to get around this is handling this condition in the test as the site behaves differently. You could pass an environment variable to add additional checks.
I dont have this modal window on my browser, see screenshot in debug mode: But on your first screenshot in last comment I see initial issue with closed browser even after failed test. I am having the same error after passed and failed tests, for example see screenshot:
Thanks for sharing the screenshots
The The Browser instance was closed either via closeBrowser()
error is because something else failed in this case "Element with text fake not found".
Taiko should have reported this correctly without saying it was a problem with closeBrowser. Will check why that is happening and try to fix that.
Thanks a lot, @zabil ! Will wait for the update.
@Alenechka seems the issue does not exists with latest versions of node, gauge, taiko and gauge-js. Can you please verify again updating the versions ?
PS: I have created a PR that addresses closeBrowser warning if browser is closed already instead of erring #1664
@NivedhaSenthil Could you please specify versions that you used? I still have this problem on
node v15.1.0
Gauge version: 1.1.5
Commit Hash: f455126
Plugins
-------
html-report (4.0.12)
java (0.7.10)
js (2.3.14)
screenshot (0.0.1)
spectacle (0.1.4)
xml-report (0.2.3)
taiko 1.0.26
I am on
Gauge version: 1.1.5
Commit Hash: f455126
Plugins
-------
html-report (4.0.12)
java (0.7.13)
js (2.3.13)
screenshot (0.0.1)
taiko 1.0.26
node v14.15.0
Can you please attach the sample project that you are running...I did try replicating from above comments but no luck
There is part of my project which you can run to reproduce issue. Also I didn't delete logs so you can see that I am able to reproduce this issue every time.
Thanks for the sample.. I could now replicate it with a simple taiko script below. Seems to be happening because of waiting for beforeUnload event to happen, only on headful mode and in windows. Trying to debug the cause.
(async () => {
try {
await openBrowser({headless:false});
await beforeunload(async () => await accept());
await goto("google.com");
} catch (error) {
console.error(error);
} finally {
await closeBrowser();
}
})();
After some debugging found that this is happening because of a difference in behavior in Chromium...page.close which is done in closeBrowser closes only the page in other platforms and in windows headless mode. But in headful mode in windows the browser itself is being closed if it is the last page in the browser. Have filled an upstream issue https://bugs.chromium.org/p/chromium/issues/detail?id=1147809, meanwhile will look at handling it in a better way in Taiko.
PS: gauge-js should have not been terminated because of unhandled exception in user code, will take that up as a separate issue
Describe the bug In the end of every test run of single scenario or full spec I am facing the issue: Error: The Browser instance was closed either via
closeBrowser()
call, or it exited for reasons unknown to Taiko. You can try launching a fresh instance usingopenBrowser()
or inspect the logs for details of the possible crash. So I am not able to get any report even if test is passed.To Reproduce
And spec is:
Logs
Expected behavior Test passed or failed but report is generated sucessfully.
Versions:
Additional context What I have tried: runner_connection_timeout = 25000 runner_request_timeout = 25000 waitFor(5000) in the last step waitFor(5000) in afterSuite setTimeout(5000) in afterSuite
Only WA that helps is for example add waitFor without declaration(so i am having am error in afterSuite section in logs and report but everything else works fine). But it's a hack! I am not able to run my test without errors and with a report in the same time.
I am pretty new to gauge and taiko and first 2-3 weeks everything worked fine both on my windows laptop and linux VM, but now this issue reproduces avary time I run my tests locally.
Please assist with this issue.