Use variant headlines when in an Editorial Test - #16577
Conversation
…ng implicitly later in the function
|
Hello 👋! When you're ready to run Chromatic, please apply the You will need to reapply the label each time you want to run Chromatic. |
abeddow91
left a comment
There was a problem hiding this comment.
This looks great and is working as expected! My only request for change is that we drop tests for now on the returned object from enhancedCards. Otherwise it looks good to go.
I've left a few nits but these are non-blocking so I'll leave them up to you.
| // make sure the variant headline isn't undefined and that it is of type string | ||
| if (typeof variantMeta?.meta.headline !== 'string') return defaultHeadline; |
There was a problem hiding this comment.
👍 thanks for tightening this check
There was a problem hiding this comment.
Thanks for being so thorough with this test suite ✨
🚀 Image pushed to AWS ECRImage digest: 🐛 Run the image locallyThe following can be used to run the image locally: # Refer to image using the immutable digest. Find alternatives below.
IMAGE_IDENTIFIER="@sha256:aba8eee311bd31dc3ed27bd6ac14bb6b51650b51019fc68eca749ec6c6ce9a3f"
# Refer to image using branch tag
# IMAGE_IDENTIFIER=":branch-ei-use-variant-headlines-in-test"
# Refer to image using build tag
# IMAGE_IDENTIFIER=":build-30316"
# Refer to image via the GitHub commit SHA tag
# IMAGE_IDENTIFIER=":sha-274bee90dcdc341c7387ac2f7e663f85a5bb552f"
# Set environment variables for the AWS CLI
AWS_PROFILE="<A_PROFILE_FROM_JANUS>"
AWS_DEFAULT_REGION="eu-west-1"
IMAGE_ACCOUNT_ID=$(aws ssm get-parameter --name /organisation/accounts/deployTools --query "Parameter.Value" --output text)
REGISTRY="${IMAGE_ACCOUNT_ID}.dkr.ecr.${AWS_DEFAULT_REGION}.amazonaws.com"
IMAGE="${REGISTRY}/guardian/dotcom-rendering${IMAGE_IDENTIFIER}"
# Login to AWS ECR https://docs.aws.amazon.com/AmazonECR/latest/userguide/registry_auth.html
aws ecr get-login-password | docker login --username AWS --password-stdin $REGISTRY
# Pull the image
docker pull $IMAGE
# Run the image. You'll likely need to set additional flags. See https://docs.docker.com/reference/cli/docker/container/run.
docker run $IMAGE |
What does this change?
Uses test variant headlines on a card when the following conditions are met:
frontsThisTestCanRunOnproperty on the editorial test definitionvariantMetafor the test variant is defined, and the headline variant is a stringIn order to make these checks,
serverSideABTestsandpageIdneed to be passed in to the enhancer code.Why?
This is part of the rendering layer implementation of fronts A/B testing, for the editorial A/B testing mission. This follows up on the model changes made here: #16486
How has this change been tested?
This has been tested locally end to end. Unit tests have also been added to make sure the
decideHeadlinelogic is producing the expected behaviour in different scenarios with different combinations of conditions.