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

feat: Test Run / Navigator polling updates for collection jobs #1125

Merged
merged 9 commits into from
Jun 24, 2024

Conversation

gnarf
Copy link
Contributor

@gnarf gnarf commented Jun 6, 2024

The following improvements should be made to the test run page.

  • As the test is being run please automatically update the following:
  • The left hand progress timeline should be updated as each run in being run. We should have a color for already run with success (green) , in progress (blue with green circle around), not run yet (blue) - Update UI in real time to receive the "per-test” status updates: "started" and "error". #820 has design for the icon choices.
  • On the right there is a box that reads for example: 15 of 15 responses collected. Please ensure this is updated automatically.

@gnarf gnarf requested a review from stalgiag June 6, 2024 17:29
Copy link
Contributor

@stalgiag stalgiag left a comment

Choose a reason for hiding this comment

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

Looks good to me! Few comments inline but no blockers. Thanks!

client/components/TestRun/TestRun.css Show resolved Hide resolved
client/components/TestRun/index.jsx Outdated Show resolved Hide resolved
client/components/TestRun/index.jsx Outdated Show resolved Hide resolved
@gnarf
Copy link
Contributor Author

gnarf commented Jun 12, 2024

Decided at the meeting today to continue on with splitting up this page such that only the updating parts care about updates so it does less "whole page refresh" feeling tasks

@howard-e howard-e self-requested a review June 20, 2024 13:22
@stalgiag stalgiag self-requested a review June 20, 2024 19:36
Copy link
Contributor

@howard-e howard-e left a comment

Choose a reason for hiding this comment

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

@gnarf changes look good to me in the best case scenarios (admin, tester, vendors, etc). But I have a consistent crash when viewing anything in the test queue as an anonymous user. That seems to be because of a valid assumption here that a testPlanRun variable would always be populated. But the anon user operates on `testPlanReport.

I've long since thought this file should be severely refactored (with myself being the culprit from some time back) and there's certainly room for breaking more things out here that shouldn't be included

client/components/TestRun/index.jsx Outdated Show resolved Hide resolved
client/components/TestRun/index.jsx Show resolved Hide resolved
@gnarf gnarf force-pushed the test-report-updates branch from 8e11517 to 255a245 Compare June 20, 2024 20:59
Copy link
Contributor

@howard-e howard-e left a comment

Choose a reason for hiding this comment

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

The fix and tests look good to me! (although there is a merge conflict to resolve here now since #1123 just got merged). Should be good to go afterwards

@howard-e howard-e self-requested a review June 20, 2024 21:42
actions: {}
});

export const Provider = ({ children, testPlanRun }) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

I like this way of sharing the polling across multiple components!

} else {
stopPolling();
}
setProviderValue({ state: { collectionJob }, actions: {} });
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
setProviderValue({ state: { collectionJob }, actions: {} });
setProviderValue({ state: { collectionJob }, actions: {} });
return () => {
stopPolling();
}

Could be good to return a cleanup function in the event of a component unmount

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure what this means exactly. Would this to be to enable the page to stop polling when the components on the page don't need it anymore? Seems like this case wouldn't be necessary, a minor save for what is unlikely to be a permanent situation (most up to date CollectionJob info for the current TestPlanRun is what this provider is providing) The useContext mechanism should automatically unmount/disconnect from the updates when it does.

Copy link
Contributor

Choose a reason for hiding this comment

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

This is just a cleanup function to ensure that the polling is stopped even if the context is unmounted at an unexpected time. My understanding is that this is best practice for any useEffect with an async side effect.

Copy link
Contributor

@stalgiag stalgiag left a comment

Choose a reason for hiding this comment

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

Tested this and the rendering is so much smoother now. Major improvement! At some point it might be cool to try and abstract that Context even further to make a general polling provider. I can imagine that could be useful elsewhere in the future. Thanks for going the extra mile on this one!

@gnarf gnarf force-pushed the test-report-updates branch from 255a245 to 08d9e3c Compare June 21, 2024 03:21
@gnarf
Copy link
Contributor Author

gnarf commented Jun 21, 2024

At some point it might be cool to try and abstract that Context even further to make a general polling provider

I feel like if we end up needing it again, I could pretty easily do a <PollingContext.Provider query={gql}> - but given how much the abstraction layers are hurting us right now, I think waiting until we need to write it twice, we should keep this one purpose built.

@@ -111,7 +111,33 @@ describe('smoke test', () => {
const h1Handle = await page.waitForSelector('h1');
const h1Text = await h1Handle.evaluate(h1 => h1.innerText);
expect(h1Text).toBe('Data Management');
})
}),
getPage(
Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for updating the tests to account for this

@gnarf gnarf merged commit 29456fc into development Jun 24, 2024
2 checks passed
@gnarf gnarf deleted the test-report-updates branch June 24, 2024 15:18
howard-e added a commit that referenced this pull request Jul 22, 2024
Includes the following changes:

**Features and Fixes**
* #1125 
* #1135
* #1144
* #1146
* #1150
* #1152
* #1153
* #1160

**Infrastructure changes**
* #969
* #1151
* #1148

---------

Co-authored-by: alflennik <[email protected]>
Co-authored-by: Mx Corey Frang <[email protected]>
Co-authored-by: cypress evelyn masso <[email protected]>
Co-authored-by: Stalgia Grigg <[email protected]>
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.

3 participants