New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
馃И 780 implementing new way of creating tests #791
Conversation
@@ -10,14 +10,19 @@ describe('Create test', () => { | |||
it('should create a basic GET test from scratch', () => { | |||
const $form = openCreateTestModal(); | |||
|
|||
$form.get('[data-cy=method-select]').click(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updating the creation test flows to match the new page
@@ -0,0 +1,22 @@ | |||
import * as S from './CreateTestHeader.styled'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
New header component for the create test page
testSuite: string; | ||
} | ||
|
||
const BasicDetails = () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is one of the default steps forms that can be reused for multiple plugins
selectedDemo?: IDemoTestExample; | ||
} | ||
|
||
const BasicDetailsForm = ({form, onSubmit, onSelectDemo, onValidation, selectedDemo}: IProps) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another step form
const SelectPlugin = () => { | ||
const {onUpdatePlugin, pluginName, onNext} = useCreateTest(); | ||
const [selectedPlugin, setSelectedPlugin] = useState(pluginName); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The initial step when creating a test, it shows the list of available plugins
[SupportedPlugins.REST]: Rest, | ||
[SupportedPlugins.Messaging]: {}, | ||
[SupportedPlugins.RPC]: {}, | ||
[SupportedPlugins.Postman]: {}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding the component mapping for our factories 馃彮
const {stepNumber, stepList, onPrev, onCreateTest, isLoading} = useCreateTest(); | ||
|
||
return ( | ||
<S.Footer> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Navigation control for the steps
} | ||
|
||
const CreateTestSteps = ({stepList, selectedKey, pluginName, onGoTo}: IProps) => { | ||
return ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Depending on the selected plugins the steps will be changing
onSelect(plugin: IPlugin): void; | ||
} | ||
|
||
const PluginCard = ({plugin: {title, description, isActive}, plugin, onSelect, isSelected}: IProps) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Basic plugin info
], | ||
}; | ||
|
||
const Rest: IPlugin = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is where we create the plugins by specifying each of the steps, types, active status, and whatnot
|
||
export const useCreateTest = () => useContext(Context); | ||
|
||
const CreateTestProvider = ({children}: IProps) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Provides the draft test, navigation control and creation of the test
pluginName: SupportedPlugins.REST, | ||
}; | ||
|
||
const createTestSlice = createSlice({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Stores everything related to the create test flow
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this could be typed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work @xoscar 馃敟
}, [form, request]); | ||
|
||
useEffect(() => { | ||
onRefreshData(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Curious, why do we need this effect
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The form gets stale if you go back one or multiple steps and if you change something at a prev step it wont reflect the changes.
{title}{' '} | ||
{!isActive && ( | ||
<> | ||
- <a href={GITHUB_ISSUES_URL}>Coming soon!</a> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe a target blank here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code looks good. I would just invest some time typing the new slice definition.
This PR is quite chunky! 馃ゴ We are adding a new way of creating tests by migration from the modal to a new page. We are also introducing plugins and sequences depending on the different steps a plugin might have.
Changes
Fixes
Checklist
https://www.loom.com/share/8f192908584542f1b30cb74267609981