NimaSoroush / differencify

Differencify is a library for visual regression testing
MIT License
634 stars 46 forks source link

Possible to compare two different urls? #65

Open AshCoolman opened 6 years ago

AshCoolman commented 6 years ago

I'd like to compare my homepage in my test environment directly against the live environment

Is that possible with the current API?

e.g. something like:

it('ensures TEST vs PROD is expected', () => {
   const testHomepage = await page.goto('http://test.domain.com').screenshot();
   const prodHomepage = await page.goto('http://www.domain.com').screenshot();
    expect(
        await target.toMatchImageSnapshot(testHomepage, prodHomepage)
    ).toEqual(true)
})

Note: I realise this isn't strictly what differencify is designed for i.e. snapshot testing. I'm trying to replicate something like wraith "capture" mode.

NimaSoroush commented 6 years ago

Hi @AshCoolman: Differencify is designed to compare your reference snapshot with development snapshot. To me, your prodHomepage should be your reference snapshot which is already stored on the disk.

I am happy to investigate the feature which you are asking for. Feel free to put a PR and have a chat about it.

Artmann commented 5 years ago

This is the use case that we are using differencify for. What we ended up doing was something like this.

  1. Create an instance of differencify for the first URL.
  2. Use it to take a screenshot and then call toMatchSnapshot with the image. This will create snapshots needed for the comparison
  3. Create a new instance of differencify.
  4. Use the new instance to take a screenshot of the second URL.
  5. Call toMatchSnapshot on the second instance with the second screenshot. This will compare the new screenshot with the snapshots you created from the first URL