diff --git a/frontend/cypress/oss/feature/feature.spec.ts b/frontend/cypress/oss/feature/feature.spec.ts index b2996b13f89f..f7190bb4fbae 100644 --- a/frontend/cypress/oss/feature/feature.spec.ts +++ b/frontend/cypress/oss/feature/feature.spec.ts @@ -19,6 +19,7 @@ describe('feature', () => { it('can create a feature flag', () => { cy.createFeature_UI(featureToggleName, true, 'default', true); + cy.contains('a', featureToggleName).click(); cy.url().should('include', featureToggleName); }); }); diff --git a/frontend/cypress/support/UI.ts b/frontend/cypress/support/UI.ts index 64ba45d62b2a..c8489287d79c 100644 --- a/frontend/cypress/support/UI.ts +++ b/frontend/cypress/support/UI.ts @@ -57,6 +57,7 @@ export const createFeature_UI = ( const projectName = project || 'default'; const uiOpts = forceInteractions ? { force: true } : undefined; cy.visit(`/projects/${projectName}`); + cy.get('[data-testid=NAVIGATE_TO_CREATE_FEATURE').click(uiOpts); cy.intercept('POST', `/api/admin/projects/${projectName}/features`).as( diff --git a/frontend/src/component/project/Project/PaginatedProjectFeatureToggles/ProjectFeatureTogglesHeader/ProjectFeatureTogglesHeader.tsx b/frontend/src/component/project/Project/PaginatedProjectFeatureToggles/ProjectFeatureTogglesHeader/ProjectFeatureTogglesHeader.tsx index 844faed9eb72..dbd83a38cea4 100644 --- a/frontend/src/component/project/Project/PaginatedProjectFeatureToggles/ProjectFeatureTogglesHeader/ProjectFeatureTogglesHeader.tsx +++ b/frontend/src/component/project/Project/PaginatedProjectFeatureToggles/ProjectFeatureTogglesHeader/ProjectFeatureTogglesHeader.tsx @@ -28,6 +28,7 @@ import { CreateFeatureDialog } from './CreateFeatureDialog'; import IosShare from '@mui/icons-material/IosShare'; import type { OverridableStringUnion } from '@mui/types'; import type { ButtonPropsVariantOverrides } from '@mui/material/Button/Button'; +import { NAVIGATE_TO_CREATE_FEATURE } from 'utils/testIds'; interface IProjectFeatureTogglesHeaderProps { isLoading?: boolean; @@ -46,6 +47,7 @@ interface IFlagCreationButtonProps { ButtonPropsVariantOverrides >; skipNavigationOnComplete?: boolean; + isLoading?: boolean; onSuccess?: () => void; } @@ -57,6 +59,7 @@ export const FlagCreationButton = ({ variant, text = 'New feature flag', skipNavigationOnComplete, + isLoading, onSuccess, }: IFlagCreationButtonProps) => { const { loading } = useUiConfig(); @@ -72,10 +75,12 @@ export const FlagCreationButton = ({ maxWidth='960px' Icon={Add} projectId={projectId} - disabled={loading} + disabled={loading || isLoading} variant={variant} permission={CREATE_FEATURE} - data-testid='NAVIGATE_TO_CREATE_FEATURE' + data-testid={ + loading || isLoading ? '' : NAVIGATE_TO_CREATE_FEATURE + } > {text} @@ -207,7 +212,7 @@ export const ProjectFeatureTogglesHeader: FC< } /> - + } >