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

Firefox - Cookie unit tests fail for asserts on non-standard properties (eg sameParty) #6976

Closed
juliandescottes opened this issue Mar 11, 2021 · 5 comments
Assignees

Comments

@juliandescottes
Copy link
Contributor

Puppeteer recently started to assert new cookie properties in unit tests:

They seem non-standard. At least for sameParty I could find a reference clearly stating that Firefox would not support it: https://www.chromestatus.com/feature/5280634094223360
For sourcePort & sourceScheme I didn't find any resource.

Firefox currently has no way of supporting such properties, so all the tests asserting those values will fail on Firefox when we update Puppeteer:

I realize that in puppeteer those tests were already running as itFailsFirefox before, so the regression was not detected. But they were actually passing and we are running them successfully in the Firefox CI today

Firefox will probably never be able to pass the assert for those properties, but it would be great to be able to still run the tests, maybe we could check the non-standard properties only when running in Chrome?

(corresponding Bugzilla reference: https://bugzilla.mozilla.org/show_bug.cgi?id=1694506)

@whimboo
Copy link
Collaborator

whimboo commented Mar 11, 2021

@jschfflr and @mathiasbynens could we get those extra checks put behind an if condition for Chrome?

@juliandescottes
Copy link
Contributor Author

juliandescottes commented Mar 12, 2021

FWIW, I tried a simple modification to skip sourcePort, sourceScheme and sameParty from the asserts on cookies when isChrome is false and this fixes the tests for Firefox, so it's really just about those three properties (changeset, ci job).

Mostly extracted the logic to a small helper to assert cookies.

export const expectCookieEquals = (cookies, expectedCookies) => {
  const { isChrome } = getTestState();
  if (!isChrome) {
    for (const expectedCookie of expectedCookies) {
      // Remove non-standard properties when testing another browser than Chrome.
      delete expectedCookie.sameParty;
      delete expectedCookie.sourcePort;
      delete expectedCookie.sourceScheme;
    }
  }

  expect(cookies).toEqual(expectedCookies);
};

@jschfflr
Copy link
Contributor

Sounds good to me! Feel free to upload your change as a pull request here and I'm happy to accept it!

@juliandescottes
Copy link
Contributor Author

Thanks! opened #6994

@juliandescottes
Copy link
Contributor Author

This can be closed as #6994 was merged

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

3 participants