Skip to content
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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🦾 525 adding versioning and edit mode for test definitions #575

Merged
merged 5 commits into from
May 26, 2022

Conversation

xoscar
Copy link
Collaborator

@xoscar xoscar commented May 26, 2022

This PR adds versioning to the FE and enables users to draft changes until they are ready to publish or if they want to revert all to the previous state.

Changes

  • New edit mode.
  • Test header now displays the version.
  • Displays a warning if there is a version mismatch.
  • New UX for assertion cards.

Fixes

Checklist

  • tested locally
  • added new dependencies
  • updated the docs
  • added a test

Screen Shot 2022-05-26 at 11 19 19 a m

@xoscar xoscar added this to the MVProduct milestone May 26, 2022
@xoscar xoscar self-assigned this May 26, 2022
@xoscar xoscar linked an issue May 26, 2022 that may be closed by this pull request
@@ -123,4 +125,41 @@ describe('Create Assertion', () => {
cy.get('[data-cy=assertion-card-list]').should('be.visible');
cy.get('[data-cy=assertion-card]').should('have.lengthOf', 2);
});

it('should publish the changes', () => {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

More tests!

@@ -42,10 +46,12 @@ const AssertionCard: React.FC<TAssertionCardProps> = ({
</S.SelectorListText>
<S.SpanCountText>{spanCountText}</S.SpanCountText>
</div>
<div>
<S.ActionsContainer>
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are now showing the draft and deleted tags

@@ -0,0 +1,22 @@
import {Modal} from 'antd';
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are now alerting the user that there is a version mismatch before opening the assertion form

return (
<Context.Provider value={contextValue}>
{children}
<AssertionFormConfirmModal
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding the confirm modal

return (
<S.TestHeader>
<S.Content>
<S.BackIcon data-cy="test-header-back-button" onClick={onBack} />
<S.TestName data-cy="test-details-name">{name}</S.TestName>
<S.TestName data-cy="test-details-name">
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Versions!


const TraceActions: React.FC = () => {
const {definitionList, publish, cancel} = useTestDefinition();
const pendingCount = definitionList.filter(({isDraft}) => isDraft).length;
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New edit actions content.

open({
isEditing: false,
defaultValues: {
selectorList:
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

opening the assertion form with the selected span details

<TestDefinitionProvider testId={testId} runId={runId}>
<AssertionFormProvider testId={testId}>
<TestRunProvider testId={testId} runId={runId}>
<TestRunProvider testId={testId} runId={runId}>
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moving the providers as some of them have dependencies


const update = useCallback(
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clean up, moving things to hooks and adding side effects

const reset = useCallback(() => {
dispatch(resetAction());
}, [dispatch]);

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test Definition Slice proxy actions

export type TCrudResponse = {
definitionList: TTestDefinitionEntry[];
change: TChange;
};

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leaving the async ones here, the rest are moved to the slice


const TestSelectors = () => ({
selectDefinitionList,
selectIsLoading: createSelector(stateSelector, ({isLoading}) => isLoading),
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moar selectors

@@ -6,6 +6,13 @@ export type TRawTestDefinition = TTestSchemas['TestDefinition'];
export type TTestDefinitionEntry = {
selector: string;
assertionList: TAssertion[];
isDraft: boolean;
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added draft and deleted booleans so we can display them on the cards

@xoscar xoscar marked this pull request as ready for review May 26, 2022 17:53
Copy link
Collaborator

@kdhamric kdhamric left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is a lot of code! Skimmed through it - will be great functionality!!

Copy link
Contributor

@cescoferraro cescoferraro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@jorgeepc jorgeepc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔥

}));
};

const counterSlice = createSlice({
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

testDefinitionSlice ?

@cescoferraro cescoferraro merged commit b8da7ee into main May 26, 2022
@xoscar xoscar deleted the 525-create-edit-mode-on-the-test-details-screen branch June 16, 2022 15:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create edit mode on the test details screen
4 participants