Implement a fix to clear out the old queue so users can catch errors
Fixes #279 : Not sure if this is necessarily the best way to fix this, but it fixed my problem & also the test I added.
The goal here is to allow chromeless.screenshot() (and other commands) to run after a failed command.
Example use case is in the test.
Note: When I ran npm:test on my machine nothing passed either before or after the edits, might want to add some additional docs, not sure exactly what's going on there. Running the tests using npm run watch:test worked all right, though one of the tests didn't pass because I wasn't running chrome headless.
Why there is no any feedback from maintainers? Looks like an important issue.
This is a pretty huge roadblock. Unless I'm missing something, this issue makes this impossible:
const { Chromeless } = require("chromeless");
test(
"check APM flow",
async done => {
const chromeless = new Chromeless({ waitTimeout: 10000 });
try {
const errors = await chromeless
.clearCookies()
.goto(URL)
.wait("BAD SELECTOR")
.evaluate(() => []);
expect(errors.length).toBe(0);
} catch (e) {
console.log(e);
await browser.end(); // this never happens
}
await browser.end(); // this also doesn't happen
done();
},
);
Running this through jest causes the test to hang and the Chrome process never terminates (end is never run).
Pretty important!