mirror of
https://github.com/Unleash/unleash.git
synced 2025-02-09 00:18:00 +01:00
fix: force languages in cypress browser for tests (#8049)
To fix this we had to create a free trial account on cypress and enable
the recording of the test. That way we found out the issue was with a
locale:
![image
(38)](https://github.com/user-attachments/assets/db2fad23-6fec-47c0-8c6f-a93f3e4e4c4c)
Probably, this works well locally because our local machines do have a
default locale, but probably we don't have one when running in CI, and
millify library is causing the tests to fail specifically at this line:
363911c4a1/frontend/src/component/common/AvatarGroup/AvatarGroup.tsx (L89)
(validated
[here](https://github.com/Unleash/unleash/pull/8040/files#diff-afc857890da2221bd34feed0ff45dd7745ff32fb0b27055214cbe69896d5311dL89)).
Unfortunately, upgrading millify didn't help, but downgrading to v5
(which doesn't support locales), solve the issue at the cost of not
having the up-to-date library:
https://github.com/Unleash/unleash/pull/8048
I believe the issue is related to this locale `c` reported here:
https://github.com/cypress-io/cypress/issues/7890#issuecomment-2105991364
because only after overriding the languages this worked
This commit is contained in:
parent
6a51a0b14a
commit
acecffd93f
1
.github/workflows/build_frontend_prs.yml
vendored
1
.github/workflows/build_frontend_prs.yml
vendored
@ -4,6 +4,7 @@ on:
|
|||||||
pull_request:
|
pull_request:
|
||||||
paths:
|
paths:
|
||||||
- frontend/**
|
- frontend/**
|
||||||
|
- .github/workflows/**frontend**
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
|
2
frontend/cypress/global.d.ts
vendored
2
frontend/cypress/global.d.ts
vendored
@ -55,7 +55,7 @@ declare namespace Cypress {
|
|||||||
// STRATEGY
|
// STRATEGY
|
||||||
addUserIdStrategyToFeature_UI(
|
addUserIdStrategyToFeature_UI(
|
||||||
featureName: string,
|
featureName: string,
|
||||||
projectName?: string,
|
projectName: string,
|
||||||
): Chainable;
|
): Chainable;
|
||||||
addFlexibleRolloutStrategyToFeature_UI(
|
addFlexibleRolloutStrategyToFeature_UI(
|
||||||
options: AddFlexibleRolloutStrategyOptions,
|
options: AddFlexibleRolloutStrategyOptions,
|
||||||
|
@ -60,17 +60,10 @@ describe('feature', () => {
|
|||||||
cy.addFlexibleRolloutStrategyToFeature_UI({
|
cy.addFlexibleRolloutStrategyToFeature_UI({
|
||||||
featureToggleName,
|
featureToggleName,
|
||||||
project: projectName,
|
project: projectName,
|
||||||
}).then(() => {
|
});
|
||||||
cy.updateFlexibleRolloutStrategy_UI(
|
|
||||||
featureToggleName,
|
cy.updateFlexibleRolloutStrategy_UI(featureToggleName, projectName);
|
||||||
projectName,
|
|
||||||
).then(() =>
|
cy.deleteFeatureStrategy_UI(featureToggleName, false, projectName);
|
||||||
cy.deleteFeatureStrategy_UI(
|
|
||||||
featureToggleName,
|
|
||||||
false,
|
|
||||||
projectName,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -26,6 +26,10 @@ import {
|
|||||||
//@ts-ignore
|
//@ts-ignore
|
||||||
} from './API';
|
} from './API';
|
||||||
|
|
||||||
|
Cypress.on('window:before:load', (window) => {
|
||||||
|
Object.defineProperty(window.navigator, 'language', { value: 'en' });
|
||||||
|
Object.defineProperty(window.navigator, 'languages', { value: ['en'] });
|
||||||
|
});
|
||||||
Cypress.Commands.add('runBefore', runBefore);
|
Cypress.Commands.add('runBefore', runBefore);
|
||||||
Cypress.Commands.add('login_UI', login_UI);
|
Cypress.Commands.add('login_UI', login_UI);
|
||||||
Cypress.Commands.add('createSegment_UI', createSegment_UI);
|
Cypress.Commands.add('createSegment_UI', createSegment_UI);
|
||||||
|
Loading…
Reference in New Issue
Block a user