mirror of
https://github.com/Unleash/unleash.git
synced 2025-02-23 00:22:19 +01:00
fix: add regression tests for feature toggle validation (#695)
This commit is contained in:
parent
c2842c81e6
commit
76db12db2b
@ -94,6 +94,40 @@ describe('feature toggle', () => {
|
||||
cy.url().should('include', featureToggleName);
|
||||
});
|
||||
|
||||
it('Gives an error if a toggle exists with the same name', () => {
|
||||
cy.get('[data-test=NAVIGATE_TO_CREATE_FEATURE').click();
|
||||
|
||||
cy.intercept('POST', '/api/admin/projects/default/features').as(
|
||||
'createFeature'
|
||||
);
|
||||
|
||||
cy.get("[data-test='CF_NAME_ID'").type(featureToggleName);
|
||||
cy.get("[data-test='CF_DESC_ID'").type('hellowrdada');
|
||||
|
||||
cy.get("[data-test='CF_CREATE_BTN_ID']").click();
|
||||
|
||||
cy.get("[data-test='INPUT_ERROR_TEXT']").contains(
|
||||
'A feature with this name already exists'
|
||||
);
|
||||
});
|
||||
|
||||
it('Gives an error if a toggle name is url unsafe', () => {
|
||||
cy.get('[data-test=NAVIGATE_TO_CREATE_FEATURE').click();
|
||||
|
||||
cy.intercept('POST', '/api/admin/projects/default/features').as(
|
||||
'createFeature'
|
||||
);
|
||||
|
||||
cy.get("[data-test='CF_NAME_ID'").type('featureToggleUnsafe####$#//');
|
||||
cy.get("[data-test='CF_DESC_ID'").type('hellowrdada');
|
||||
|
||||
cy.get("[data-test='CF_CREATE_BTN_ID']").click();
|
||||
|
||||
cy.get("[data-test='INPUT_ERROR_TEXT']").contains(
|
||||
`"name" must be URL friendly`
|
||||
);
|
||||
});
|
||||
|
||||
it('Can add a gradual rollout strategy to the development environment', () => {
|
||||
cy.wait(500);
|
||||
cy.visit(`/projects/default/features/${featureToggleName}/strategies`);
|
||||
|
@ -1,4 +1,5 @@
|
||||
import { TextField } from '@material-ui/core';
|
||||
import { INPUT_ERROR_TEXT } from '../../../testIds';
|
||||
import { useStyles } from './Input.styles.ts';
|
||||
|
||||
interface IInputProps extends React.InputHTMLAttributes<HTMLInputElement> {
|
||||
@ -41,6 +42,7 @@ const Input = ({
|
||||
value={value}
|
||||
onChange={onChange}
|
||||
FormHelperTextProps={{
|
||||
['data-test']: INPUT_ERROR_TEXT,
|
||||
classes: {
|
||||
root: styles.helperText,
|
||||
},
|
||||
|
@ -39,3 +39,6 @@ export const ADD_TO_STRATEGY_INPUT_LIST = 'ADD_TO_STRATEGY_INPUT_LIST';
|
||||
|
||||
/* SPLASH */
|
||||
export const CLOSE_SPLASH = 'CLOSE_SPLASH';
|
||||
|
||||
/* GENERAL */
|
||||
export const INPUT_ERROR_TEXT = 'INPUT_ERROR_TEXT';
|
||||
|
Loading…
Reference in New Issue
Block a user