1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-02-14 00:19:16 +01:00

fix: migrations e2e test (#8965)

Onboarding changed e2e test that should run before migration.
This commit is contained in:
Tymoteusz Czech 2024-12-12 11:19:03 +01:00 committed by GitHub
parent 7a436347cb
commit 828ecf8d63
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 10 additions and 3 deletions

View File

@ -19,6 +19,7 @@ describe('feature', () => {
it('can create a feature flag', () => { it('can create a feature flag', () => {
cy.createFeature_UI(featureToggleName, true, 'default', true); cy.createFeature_UI(featureToggleName, true, 'default', true);
cy.contains('a', featureToggleName).click();
cy.url().should('include', featureToggleName); cy.url().should('include', featureToggleName);
}); });
}); });

View File

@ -57,6 +57,7 @@ export const createFeature_UI = (
const projectName = project || 'default'; const projectName = project || 'default';
const uiOpts = forceInteractions ? { force: true } : undefined; const uiOpts = forceInteractions ? { force: true } : undefined;
cy.visit(`/projects/${projectName}`); cy.visit(`/projects/${projectName}`);
cy.get('[data-testid=NAVIGATE_TO_CREATE_FEATURE').click(uiOpts); cy.get('[data-testid=NAVIGATE_TO_CREATE_FEATURE').click(uiOpts);
cy.intercept('POST', `/api/admin/projects/${projectName}/features`).as( cy.intercept('POST', `/api/admin/projects/${projectName}/features`).as(

View File

@ -28,6 +28,7 @@ import { CreateFeatureDialog } from './CreateFeatureDialog';
import IosShare from '@mui/icons-material/IosShare'; import IosShare from '@mui/icons-material/IosShare';
import type { OverridableStringUnion } from '@mui/types'; import type { OverridableStringUnion } from '@mui/types';
import type { ButtonPropsVariantOverrides } from '@mui/material/Button/Button'; import type { ButtonPropsVariantOverrides } from '@mui/material/Button/Button';
import { NAVIGATE_TO_CREATE_FEATURE } from 'utils/testIds';
interface IProjectFeatureTogglesHeaderProps { interface IProjectFeatureTogglesHeaderProps {
isLoading?: boolean; isLoading?: boolean;
@ -46,6 +47,7 @@ interface IFlagCreationButtonProps {
ButtonPropsVariantOverrides ButtonPropsVariantOverrides
>; >;
skipNavigationOnComplete?: boolean; skipNavigationOnComplete?: boolean;
isLoading?: boolean;
onSuccess?: () => void; onSuccess?: () => void;
} }
@ -57,6 +59,7 @@ export const FlagCreationButton = ({
variant, variant,
text = 'New feature flag', text = 'New feature flag',
skipNavigationOnComplete, skipNavigationOnComplete,
isLoading,
onSuccess, onSuccess,
}: IFlagCreationButtonProps) => { }: IFlagCreationButtonProps) => {
const { loading } = useUiConfig(); const { loading } = useUiConfig();
@ -72,10 +75,12 @@ export const FlagCreationButton = ({
maxWidth='960px' maxWidth='960px'
Icon={Add} Icon={Add}
projectId={projectId} projectId={projectId}
disabled={loading} disabled={loading || isLoading}
variant={variant} variant={variant}
permission={CREATE_FEATURE} permission={CREATE_FEATURE}
data-testid='NAVIGATE_TO_CREATE_FEATURE' data-testid={
loading || isLoading ? '' : NAVIGATE_TO_CREATE_FEATURE
}
> >
{text} {text}
</StyledResponsiveButton> </StyledResponsiveButton>
@ -207,7 +212,7 @@ export const ProjectFeatureTogglesHeader: FC<
</Button> </Button>
} }
/> />
<FlagCreationButton /> <FlagCreationButton isLoading={isLoading} />
</> </>
} }
> >