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

PipelineList tests, fix clearing error banner #50

Merged
merged 11 commits into from
Nov 6, 2018

Conversation

yebrahim
Copy link
Contributor

@yebrahim yebrahim commented Nov 5, 2018

  • For all Page components: added an explicit refresh method that can be called to only reload the relevant parts to the page, in order to avoid duplicate resource load requests.
  • Page now has setStateSafe, which makes sure the component is mounted before calling setState on it. This should be used across all Page extenders, but is not the case yet (only PipelineList).
  • Added an extensive test suite for PipelineList.
  • Added a TestUtils file containing some utilities to make testing page components easier.
  • Cleans up timeout mocking API server not ready, since that's not really used by current test suite.

This change is Reviewable

@yebrahim
Copy link
Contributor Author

yebrahim commented Nov 5, 2018

/test mlpipeline-presubmit-e2e-test

@vicaire vicaire removed the request for review from paveldournov November 5, 2018 23:07
Copy link
Contributor

@rileyjbauer rileyjbauer left a comment

Choose a reason for hiding this comment

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

Exciting to have these pieces in place!

@@ -173,7 +173,11 @@ class Compare extends Page<{}, CompareState> {
</div>);
}

public async load() {
public async refresh() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Are you sure you want to do this?

This will mean that any errors banners with a refresh button will be nonfunctional.
Maybe there should be some additional logic governing whether or not that refresh button shows up?

Ditto in a number of other files below.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Error banners also call this new refresh function instead of load.
I did think about showing the refresh button automatically if the Page component implements the refresh function, but I thought that was too much magic, and also I think we should be moving in the direction of auto-refresh.

Copy link
Contributor

Choose a reason for hiding this comment

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

Right, but in this case (and some others) the refresh doesn't do anything, correct?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah I see. Thanks for catching that.
I missed those pages because they didn't have a Refresh button in the toolbar. We desperately need those tests!

frontend/src/pages/Page.tsx Outdated Show resolved Hide resolved
frontend/src/pages/PipelineList.test.tsx Outdated Show resolved Hide resolved
message: 'Error: failed to retrieve list of pipelines. Click Details for more information.',
mode: 'error',
}));
tree.unmount();
Copy link
Contributor

Choose a reason for hiding this comment

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

Any harm with calling this when there's nothing to unmount? Seems like it should just be in afterEach()

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree. But then we'll have to maintain a global tree reference that we set and mount in each test, I'm not sure which I like more.
Also, forgetting to unmount isn't going to cause any issues, since these are pretty small footprint.

frontend/src/pages/PipelineList.test.tsx Show resolved Hide resolved
frontend/src/pages/PipelineList.test.tsx Outdated Show resolved Hide resolved
frontend/src/pages/PipelineList.test.tsx Outdated Show resolved Hide resolved
frontend/src/pages/PipelineList.test.tsx Show resolved Hide resolved
@@ -45,11 +45,11 @@ export abstract class Page<P, S> extends React.Component<P & PageProps, S> {
public abstract refresh(): Promise<void>;
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's defer this for now, but it seems like there's probably a way to ensure clearBanner() is always called on refresh(), like maybe Page has a function _refresh() or something which calls clearBanner() and refresh() and is bound in showPageError() ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's doable, although I've two points here:

  • Ideally, the error should only be cleared when the operation succeeds, so the user shouldn't have to see it flicker. The current fix in this PR doesn't take care of this either.
  • We should really prioritize auto-refresh. It's easy and will take care of so many UX issues.

@rileyjbauer
Copy link
Contributor

/lgtm

@rileyjbauer
Copy link
Contributor

/approve

1 similar comment
@yebrahim
Copy link
Contributor Author

yebrahim commented Nov 6, 2018

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: rileyjbauer, yebrahim

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot merged commit e6dbfac into master Nov 6, 2018
@yebrahim yebrahim deleted the yebrahim/page-tests branch November 6, 2018 05:04
Linchin pushed a commit to Linchin/pipelines that referenced this pull request Apr 11, 2023
HumairAK referenced this pull request in red-hat-data-services/data-science-pipelines Mar 11, 2024
HumairAK referenced this pull request in red-hat-data-services/data-science-pipelines Mar 11, 2024
Fix: Fixing typo in repository URL
HumairAK added a commit to HumairAK/data-science-pipelines that referenced this pull request Jun 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants