Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

screenshot not saving; comparison always fails #82

Open
lvxwrkr777 opened this issue Feb 4, 2022 · 7 comments
Open

screenshot not saving; comparison always fails #82

lvxwrkr777 opened this issue Feb 4, 2022 · 7 comments

Comments

@lvxwrkr777
Copy link

lvxwrkr777 commented Feb 4, 2022

NOTE: Be aware of the fact that this module is only a plugin that provides all functionality from webdriver-image-comparison. So please check if this is an issue with this plugin or with webdriver-image-comparison.

Environment (please complete the following information):

  • Node.js version: v14.18.2
  • NPM version: 6.14.15
  • Browser name and version: Chrome 97
  • Platform name and version: Windows 10
  • WebdriverIO version: 7.16.13
  • wdio-image-comparison-service version: 3.1.0

Config of WebdriverIO + wdio-image-comparison-service

services: [
        ['chromedriver',{}],
        ['image-comparison',
        {
            baselineFolder: join(process.cwd(), './tests/Baseline/'),
            formatImageName: '{tag}-{logName}-{width}x{height}',
            screenshotPath: join(process.cwd(), '.tmp/'),
            savePerInstance: true,
            autoSaveBaseline: true,
            blockOutStatusBar: true,
            blockOutToolBar: true,
        // NOTE: When you are testing a hybrid app please use this setting
            isHybridApp: true,
        // Options for the tabbing image
            tabbableOptions:{
                circle:{
                    size: 18,
                    fontSize: 18,
                // ...
            },
                line:{
                    color: '#ff221a', // hex-code or for example words like `red|black|green`
                    width: 3,
            },
        }
        // ... more options
    }],
    ],

Describe the bug
It seems that no baseline images are ever saved, so the comparison always fails

To Reproduce

    xit('Screenshot of vendors page taken', async () => {
        browser.saveFullPageScreen('fullPage');
    });
    it('Screenshot matches baseline', async () => {
        expect(browser.checkFullPageScreen('fullPage')).toEqual(0);
    });

Expected behavior
I should be able to take/save screenshots, but it doesn't appear to be saving anything to baseline or any tmp folder, so of course the comparison fails.

Log

[chrome 97.0.4692.99 windows #0-0] expect(received).toEqual(expected) // deep equality

Expected: 0
Received: {}

Additional context
My tests are in TS. Yes, I have added the comparison service types to my TS config.

@mayankshukla94
Copy link

wdio-image-comparison-service by default saves the baseline image in ./.tmp/actual.
If you remove baselineFolder: join(process.cwd(), './tests/Baseline/') from wdio.conf.js file and update it block of image comparison as mentioned below

it('Screenshot matches baseline', async () => {
const testOptions = {
    actualFolder: path.join(process.cwd(), './.tmp/checkActual'),
    baselineFolder: join(process.cwd(), './.tmp/actual'),
    diffFolder: path.join(process.cwd(), './.tmp/testDiff'),
    returnAllCompareData: true,
 };

expect(browser.checkFullPageScreen('fullPage', testOptions)).toEqual(0);
});

Then it works

@lvxwrkr777
Copy link
Author

I still got:

`[chrome 97.0.4692.99 windows #0-0] expect(received).toEqual(expected) // deep equality

Expected: 0
Received: {}
[chrome 97.0.4692.99 windows #0-0] Error: expect(received).toEqual(expected) // deep equality
[chrome 97.0.4692.99 windows #0-0]
[chrome 97.0.4692.99 windows #0-0] Expected: 0
[chrome 97.0.4692.99 windows #0-0] Received: {}`

@wswebcreation
Copy link
Member

Hi @lvxwrkr777

I'm currently on vacation and can't verify it, I'll check it when I'm back. I have the feeling this is related to Windows only because on Mac/Linux this just pases

@mayankshukla94
Copy link

@wswebcreation Any update on this?

@rasis2
Copy link

rasis2 commented Aug 22, 2023

Encounter similar issue, I guess there no fix on this?

@christian-bromann
Copy link
Member

Can someone provide a minimal reproducible example as GitHub project I can clone and use to investigate?

@lvxwrkr777
Copy link
Author

Can someone provide a minimal reproducible example as GitHub project I can clone and use to investigate?

I'ma call you 'Christian Brogrammer', if you can't figure this out.

I don't work for the company where I had to operate within that context anymore, but it was an MS-DOS environment with node.js. Weird, I know. I found some port bugs in modules originally written for Linux.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants