@@ -136,6 +138,7 @@ const TypeMapping = ({ types, typeMappings, onChange, label }: Props) => {
onChange={e =>
setNewMap({ ...newMap, custom_name: e.target.value })
}
+ name={`${label}-rhs`}
// onBlur={() => {
// onAddItem(newMap);
// }}
diff --git a/frontend/libs/console/legacy-ce/src/lib/features/RemoteSchema/components/Create/Create.stories.tsx b/frontend/libs/console/legacy-ce/src/lib/features/RemoteSchema/components/Create/Create.stories.tsx
index 2fc1b287d2d..f3f78fabfe0 100644
--- a/frontend/libs/console/legacy-ce/src/lib/features/RemoteSchema/components/Create/Create.stories.tsx
+++ b/frontend/libs/console/legacy-ce/src/lib/features/RemoteSchema/components/Create/Create.stories.tsx
@@ -1,9 +1,9 @@
-import React, { useReducer } from 'react';
+import React from 'react';
import { ReactQueryDecorator } from '../../../../storybook/decorators/react-query';
import { ComponentMeta, Story } from '@storybook/react';
import { RemoteSchema } from '../..';
import { ReduxDecorator } from '../../../../storybook/decorators/redux-decorator';
-import { within, userEvent } from '@storybook/testing-library';
+import { within, userEvent, waitFor } from '@storybook/testing-library';
import { expect } from '@storybook/jest';
import { handlers } from './mocks/handlers.mock';
@@ -17,11 +17,16 @@ export default {
} as ComponentMeta
;
export const Playground: Story = () => {
- const [formSuccess, toggle] = useReducer(s => !s, false);
+ const [showSuccessText, setShowSuccessText] = React.useState(false);
+ const onSuccess = () => {
+ setShowSuccessText(true);
+ };
return (
<>
- toggle()} />
- {formSuccess ? 'Form saved succesfully!' : null}
+ ;
+
+ {showSuccessText ? 'Form saved successfully!' : null}
+
>
);
};
@@ -84,7 +89,12 @@ Playground.play = async ({ canvasElement }) => {
userEvent.click(await canvas.findByTestId('submit'));
- expect(
- await canvas.findByText('Form saved succesfully!')
- ).toBeInTheDocument();
+ waitFor(
+ async () => {
+ await expect(await canvas.findByTestId('@onSuccess')).toHaveTextContent(
+ 'Form saved successfully!'
+ );
+ },
+ { timeout: 5000 }
+ );
};
diff --git a/frontend/libs/console/legacy-ce/src/lib/new-components/RequestHeadersSelector/components/KeyValueHeader.tsx b/frontend/libs/console/legacy-ce/src/lib/new-components/RequestHeadersSelector/components/KeyValueHeader.tsx
index 303395583bf..5b2845d7cd0 100644
--- a/frontend/libs/console/legacy-ce/src/lib/new-components/RequestHeadersSelector/components/KeyValueHeader.tsx
+++ b/frontend/libs/console/legacy-ce/src/lib/new-components/RequestHeadersSelector/components/KeyValueHeader.tsx
@@ -29,6 +29,7 @@ export const KeyValueHeader = (props: Props) => {
placeholder="Key..."
{...register(keyLabel)}
aria-label={keyLabel}
+ data-test={`header-test${rowIndex}-key`}
/>
{typeSelect ? (
@@ -44,6 +45,7 @@ export const KeyValueHeader = (props: Props) => {
{
removeRow(rowIndex);
}}
className="cursor-pointer"
+ data-test={`delete-header-${rowIndex}`}
/>