Description
We would like to hide some features on production and only show them in beta mode.
First, we tried just to add beta=true
URL param to enable beta mode on the page.
But during testing, I've noticed one thing regarding using beta URL param. It's quite uncomfortable during testing, as this URL param disappears after each page navigation. So we have to always remember to set it during testing after each page change and reload the page with this param.
This leads to another drawback, we cannot test how things work without page reloading as we have to reload page each time.
We should improve beta testing mode and use cookie like we do in Connect App https://github.com/appirio-tech/connect-app/blob/dev/src/config/constants.js#L887-L88. Though it's a little bit harder to set a cookie.
-
So to make it easier we should do the next thing. If we request any page of Work Manager with URL param
?beta=true
we should set a cookiebeta-mode
, and by requesting any URL with?beta=false
remove this cookie.- After setting the cookie we should remove
beta
from URL and reload the page automatically. So this URL param should be used only to enable/disable beta mode, but it should disappear from URL after.
- After setting the cookie we should remove
-
We should create a reusable method
isBetaMode()
which we can use everywhere. This method should returntrue
if the cookie is set. -
Also, we should indicate the beta mode to avoid confusion. In beta mode we should add a
red
word "beta" to the app name (not so big like on the screenshot 14-16 font size, red color in the top right corner of "Worm Manager".). -
Replace all the places where now we check
params.get('beta')
withisBetaMode()
.