Fixed flaky Portal test (#20286)

no issue

- the signup flow tests check whether the benefits of the available
tiers are rendering correctly. The test is based on a text match, which
sometimes fails because of duplicate benefit descriptions
- this fix makes the benefit descriptions less likely to be the same, by
using a timestamp in the randomisation function
This commit is contained in:
Sag 2024-05-30 06:25:50 +02:00 committed by GitHub
parent 65b929d1d8
commit 46f0efe463
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -261,13 +261,14 @@ export function getFreeProduct({
}
export function getBenefits({numOfBenefits}) {
const timestamp = Date.now();
const random = Math.floor(Math.random() * 100);
const beenfits = [
getBenefitData({name: `Limited early adopter pricing #${random}`}),
getBenefitData({name: `Latest gear reviews #${random}`}),
getBenefitData({name: `Weekly email newsletter #${random}`}),
getBenefitData({name: `Listen to my podcast #${random}`})
getBenefitData({name: `Limited early adopter pricing #${random}-${timestamp}`}),
getBenefitData({name: `Latest gear reviews #${random}-${timestamp}`}),
getBenefitData({name: `Weekly email newsletter #${random}-${timestamp}`}),
getBenefitData({name: `Listen to my podcast #$${random}-${timestamp}`})
];
return beenfits.slice(0, numOfBenefits);
}