0

I have built an automation framework for testing our web app that runs as after each new deploy to our staging environment, as a regression pack. Now the issue is the tests fail whenever there's a new experiment that touches that specific part of the tests, e.g., the home page validation tests fail if there is a new home page experiment. I'd like to know how I can make my tests robust enough to resolve the issue maybe by ignoring experiments altogether or always ensuring the page loads in the current non-experiment group?

I thought maybe a possible solution would be for the web team to write a new cookie than controls the experiments, and then just set that cookie in a hook prior to my tests? Would that work or is there maybe a better way?

Daniel Widdis
  • 8,424
  • 13
  • 41
  • 63
Fashinated
  • 55
  • 1
  • 8

1 Answers1

4

The solution with the cookie that controls your A/B experiments will work well with TestCafe. TestCafe allows you to work with cookies using the ClientFunctions mechanism or Client Scripts.

Alex Kamaev
  • 6,198
  • 1
  • 14
  • 29
  • Since [1.19.0 version](https://testcafe.io/403938/release-notes/framework/2022-05-26-testcafe-v1-19-0-released#cookie-management) TestCafe ships with a dedicated cross-browser cookie management API that allows one to manipulate browser cookies even if the `HttpOnly` flag is specified. ```js await t.setCookies({ name: 'apiCookie1', value: 'value1' }); const cookies = await t.getCookies('apiCookie1'); ``` – Helen Dikareva Jun 15 '22 at 09:31