I wanted to record my tests with snapshots every 500 millis and then to moving gifs.
one of the tests got stuck.
this test passes fine when I am not taking screenshots.
this is also the only test that ignore sync with angular.
also no screenshots are taken.
I was able to reproduce this with the following:
a test:
browser.ignoreSynchronization = true;
require('url').parse(browser.baseUrl);
browser.get('http://www.google.com');
browser.sleep(5000);
with ignore - I don't see screenshots, but the test passes.
without ignore - i see screenshots, but test is obviously stuck.
and this is my beforeEach that records every 500 millis
var recordingSet = false;
beforeEach(function() {
if (process.env.RECORD && !recordingSet) {
var folderPath = '/tmp/protractor';
recordingSet = true;
var fs = require('fs-extra');
fs.emptyDirSync(folderPath);
setInterval(function () {
try {
browser.takeScreenshot().then(function (png) {
var stream = fs.createWriteStream(folderPath + '/screenshot-' + new Date().getTime() + '.png');
stream.write(new Buffer(png, 'base64'));
stream.end();
});
} catch (e) {
}
}, 500);
}
});
I think its known (?) to be bad to invoke control-flow manipulating functions (browser.takeScreenshot registers promises with the control flow) directly from the event loop (i.e., via setInternal). I think you're really likely to confuse the control flow.
Anyway, another solution to taking screenshots every 500ms and then gluing them together is to just record a movie of the desktop. We use avconv -f x11grab (plus a bunch of options to scale the window and tweak the format and include a timestamp in the movie). On the plus side, you don't have to interact with JavaScript/Protractor to get it to work.
I think that is the issue as well but it's such a good bug report I decided it's worth checking out anyway
Agreed with @tullmann - you're probably seriously confusing the control flow. With the changes in the next selenium-webdriver version, this may change anyway, so I think the best solution is to record a movie. Thanks!
FYI - this might be relevant for headless browsers. I know HeadlessChrome can't record.
Just ran into this stack overflow question while researching, and suddenly this ticket popped back to me.
Do you might have any solution for recording?
The only stable solutions I can think of right now (assuming frame by frame does not work) is using a regular chrome and record using the native system recorder or a service like browser-stack or saucelab.
I think videos are crucial.
Using protractor for 4 years and loving any moment. Thank you for this awesomeness.