Closed sepa-joe closed 6 years ago
Hi @sepa-joe
Sorry for my late reaction. When do you experience this problem? Is this random, or in specific cases? Can you also share some code you use and your dependencies including the versions (like nodejs, protractor, jasmine / mocha and so on)?
Tnx in advance
@wswebcreation I can get this to occur on a fairly regular basis (on the application I am testing) - however it makes no sense. The code I am using is:
'use strict';
var path = require('path');
var navFile = path.normalize('../functions/navigation/navigation.js');
var navi = require(navFile);
const protractorImageComparison = require('protractor-image-comparison');
const screenshotPath = path.resolve(__dirname, `actual\\`);
const differencePath = path.resolve(__dirname, `diff\\`);
const helpers = require('../helpers');
const exampleFullPage = 'question_3_baseline';
var startBtn = '/html[1]/body[1]/section[1]/app-root[1]/app-pay-only[1]/div[2]/div[1]/div[1]/div[1]/div[1]/button[1]';
var noRadio = '/html[1]/body[1]/section[1]/app-root[1]/app-pay-only[1]/div[2]/div[1]/div[1]/div[1]/label[2]/input[1]';
var yesRadio = '/html[1]/body[1]/section[1]/app-root[1]/app-pay-only[1]/div[2]/div[1]/div[1]/div[1]/label[1]/input[1]';
var nextBtn = '/html[1]/body[1]/section[1]/app-root[1]/app-pay-only[1]/div[2]/div[1]/div[1]/button[1]';
describe('Question 03 screenshot', function() {
beforeEach(function() {
browser.waitForAngularEnabled(false);
browser.protractorImageComparison = new protractorImageComparison({
baselineFolder: './data/baseline/imageTests/',
screenshotPath: './data/screenshots/imageTests/'
});
browser.get(browser.baseUrl)
.then(() => browser.sleep(0));
browser.driver.manage().window().maximize();
});
it('should save question 3 - selected "no" ', () => {
navi.gotoQuestion3();
var fileName = exampleFullPage + '_selected_no';
// click no
element(by.xpath(noRadio)).click();
expect(browser.protractorImageComparison.checkFullPageScreen(fileName)).toEqual(0);
});
});
The confusing thing is I use the exact same code for other parts and this works. And when I watch the application I can see pages being loaded as expected. I have made the navigation code into its own function - this is used in several other tests and again this works.
Node version: v8.9.1 protractor: 5.2.0 jasmine should be v2
Hi @sepa-joe
Tnx for the info, is this always on the same testcase or on a random bases? Based om the log it looks like the screenshot array has not been filled. Can you provide a example repo in which I can debug it?
I ran into the same issue. Here is some information I can provide:
checkFullPageScreen
creates this error
Seems it doesn't matter which test I take the screenshot, that page fails every time. There's nothing special with that page
Same as @sepa-joe, exact same code for other parts and it works. Those pages are 2 screens in height.
The page it breaks on is a page that is 1 screen. If I fake it and make it 2 screens, it does pass
I can't help with a code example at this time. I'll try and help otherwise if I can. Is there something in imageOutput.getImage()
I can look into to help?
@mikedidomizio
Hmm, that's useful info. I hope to check it the coming days but I'm pretty busy. I'll post the results here
Sorry I've not been of any help on this - due to a chance in direction I've had to stop using protractor (and so haven't been able to reply.)
I'm going to try and make time to help if I can
I just created a pull request that fixed this issue for me. #54
I've released version 1.6.1m see https://github.com/wswebcreation/protractor-image-comparison/pull/54 tnx to @JochenDiekenbrock
Will close this for now. If there are still problem please let me know
Thanks @wswebcreation
Not sure this is entirely something to do with the image comparison, but am raising it here for first consideration.
I have some code which looks to do a screenshot comparison. I use the same code on multiple tests. On a number of these, the test fails with "argument should be a buffer"
I can't see why this is causing an issue, visually the code is executing and navigating with no issues (the navigation code works fine for other tests) - anyone see anything in the stacktrace to help?