percy / cli

The Percy CLI is used to interact with, and upload snapshots to, percy.io via the command line.
https://docs.percy.io/docs/cli-overview
70 stars 43 forks source link

"enableJavaScript: true" disables discovery.cookies #1146

Closed philipp-winterle closed 1 year ago

philipp-winterle commented 1 year ago

The problem

If using enableJavaScript: true the discovery.cookies settings are ignored.

module.exports = {
  version: 2,
  snapshot: {
    widths: [1920],
    enableJavaScript: false,
  },
  discovery: {
    cookies: [
      {
        name: "MSCC",
        value: "cid=hqr4tmpjqgd1zyhujbr7etuc-c1=2-c2=2-c3=2",
      },
    ],
  }
};
- name: Dev To Cookie Test
  url: https://microsoft.com
  waitForTimeout: 3000

Environment

Details

Iam trying to scan our pages. To get the full page screen I need to get rid of our cookie consent overlay. I can use cookies for that to simulate a already visited user. If I set enableJavaScript to false I get the full page screen without the cookie banner. If I set it to true the same snapshot test will result in a page with cookie banner as if there are no cookies set.

Code to reproduce issue

Given the above settings just run

npx percy snapshot snapshot.yml

philipp-winterle commented 1 year ago

Found out the cookie seems to be set and not at the same time.

I found things on the snapshot that only exists if cookie is set. Same time I find things on the snapshot that only exists if cookie is NOT set. Strange

Seems like snapshots from local differ from online