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

fix(invalid_test): show error popup if test data is invalid #516

Merged
merged 2 commits into from
Oct 26, 2020

Conversation

anusha5695
Copy link
Contributor

@anusha5695 anusha5695 commented Oct 23, 2020

Issue:
Invalid test data created thro API when rendered on UI crashes

Fix:
IMPORTANT: Error handling done for both "EDIT" and "CLONE"
Show error pop up if test data is invalid

Question Answer
Bug fix
New feature
Breaking change.
Deprecations
Documentation
Tests added

Related issues: #498
image

Have extracted constants for error messages, titles, etc
Created isValidTest function that reuses existing "createStateForEditTest" function. [Creating new function would require refactoring existing flows, which we may do separately]
Created ActionErrorComponent for showing error that can be used for showing any error in Test Actions

@anusha5695
Copy link
Contributor Author

Hello @enudler , could you check this PR?

@enudler enudler requested a review from manorlh October 23, 2020 12:59
@enudler
Copy link
Collaborator

enudler commented Oct 23, 2020

Hi @anusha5695
@manorlh will review it

@anusha5695
Copy link
Contributor Author

Sure thanks @enudler and @manorlh

@anusha5695
Copy link
Contributor Author

@manorlh would you review this too please?

@@ -271,6 +309,7 @@ class getTests extends React.Component {
autoHideDuration={4000}
onRequestClose={this.handleSnackbarClose}
/>}
{this.state.testActionError.isError && <ActionErrorPopup onClose={this.resetTestActionError} message={this.state.testActionError.errorMessage} />}
{error && <ErrorDialog closeDialog={this.onCloseErrorDialog} showMessage={error} />}
Copy link
Collaborator

Choose a reason for hiding this comment

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

as you can see we already have a component for error.
also you can use the variable error that already exist.
example:
const error = your error || errorOnDeleteTest ;

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@manorlh make sense. done!

testActionError: {
isError: false,
errorMessage: EMPTY_STRING,
},
Copy link
Collaborator

Choose a reason for hiding this comment

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

it will be nicer to use one variable for that - something like renderTestError
and its value would be the error text if error accrued and undefined/null if it didn't.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done!

@@ -118,13 +128,36 @@ class getTests extends React.Component {
this.setState({ openViewTest: data });
};

updateTestActionError = ({ isError, errorMessage }) => {
this.setState({
...this.state,
Copy link
Collaborator

Choose a reason for hiding this comment

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

this.setState update only the keys that you send, so you don't need "...this.state "

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done again!

@manorlh
Copy link
Collaborator

manorlh commented Oct 24, 2020

thank you for your contribution! it's awesome:)

Copy link
Contributor Author

@anusha5695 anusha5695 left a comment

Choose a reason for hiding this comment

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

Fixed all feedback 👍

@manorlh
Copy link
Collaborator

manorlh commented Oct 24, 2020

thanks. 🙏 I will review it again tomorrow

@enudler enudler linked an issue Oct 26, 2020 that may be closed by this pull request
@enudler enudler merged commit fa93612 into Zooz:master Oct 26, 2020
@anusha5695 anusha5695 deleted the ISSUE-498 branch October 29, 2020 13:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Predator UI crashes when test is corrupted
3 participants