google-optimize-module icon indicating copy to clipboard operation
google-optimize-module copied to clipboard

Forcing the "test" experience

Open t1mwillis opened this issue 3 years ago • 3 comments

Is there any way, for testing purposes, to force viewing the "test" experience, aside from simply setting the weight to 100? I ask because it can be helpful for QA purposes to verify expected functionality between test and control. It seems like manually modifying the cookie is another option, but I would prefer something like ?testName=enabled as a query param. If this is outside of the scope of the module, simply let me know.

t1mwillis avatar Apr 06 '21 23:04 t1mwillis

Why not set the weights accordingly based on the current environment you're in? e.g., using environment variables, etc.

I think this is kind of outside the scope. What do you think @hecktarzuli @pi0 ?

farzadso avatar Apr 07 '21 07:04 farzadso

@farzadso Can you provide some more insight on how I might go about setting those environment variables? Do the experiments receive the context as an argument? Or are you simply talking about referencing process.env.TEST_A_WEIGHT within the experiments. The latter will not work as we build the application once using docker, then inject various environment specific variables.

Passing the context as an argument could be beneficial in that it would allow for different test id's within environments as well.

t1mwillis avatar Apr 07 '21 16:04 t1mwillis

@t1mwillis I meant the latter and since you're using the same built image you can't achieve what I meant.

If your test environments have a specific URL structure, a hacky version would be to set the conditions based on the different URLs.

farzadso avatar Apr 08 '21 07:04 farzadso