-
Notifications
You must be signed in to change notification settings - Fork 2
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: display script checks in Validator #133
Conversation
onScriptCheck: (callback: (data: K6Check[]) => void) => { | ||
return createListener('script:check', callback) | ||
}, |
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.
I'm not sure if this is expected or a bug but subgroups are not being sent to this channel script:check
.
export default function () {
...
group('group', function () {
group('subgroup', function () {
resp = http.get('https://test.k6.io');
check(resp, {
"is status 504": (r) => r.status === 504,
});
});
});
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.
bug on the logic, apparently groups can have another groups
subsection that need to be checked 👍
@@ -0,0 +1,51 @@ | |||
import { K6Check } from '@/types' |
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.
Something is going on with syntax highlighting in Github for new files🤔 Any ideas what it could be?
it('should group checks by path', () => { | ||
const check1 = buildCheck({ path: '::check1' }) | ||
const check2 = buildCheck({ path: '::check2' }) | ||
const check3 = buildCheck({ path: '::group1::check3' }) | ||
const check4 = buildCheck({ path: '::group2::check4' }) | ||
const check5 = buildCheck({ path: '::group2::subgroup::check5' }) |
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.
Despite the script:check
event not currently sending subgroups, the front-end is handling them.
src/views/Validator/CheckRow.tsx
Outdated
{hasFailures(check) && ( | ||
<Tooltip | ||
content={`${getPassPercentage(check).toFixed(2)}% success rate`} | ||
> | ||
<Text truncate css={textStyles}> | ||
Passed: {check.passes} | Failed: {check.fails} | ||
</Text> | ||
</Tooltip> | ||
)} |
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.
Not sure if this is the best UX. Alternatively, we could display the percentage in the row and use the number of passes/fails in the tooltip.
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.
IMO showing this info in the row is better - the checks tab doesn't have high information density, so hiding it isn't necessary.
Here's what we do in the plugin
And here's a screenshot from k6 cli (which actually makes me wonder if we need to show 100% success rate at all - there doesn't seem to be any value in that)
|
||
export function getPassPercentage(check: K6Check) { | ||
const total = check.passes + check.fails | ||
return (check.passes / total) * 100 |
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.
Can passes + fails
ever be 0
?
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.
I don't think so but, let me add a safe guard here.
src/views/Validator/Validator.tsx
Outdated
@@ -148,6 +156,7 @@ export function Validator() { | |||
<Tabs.Trigger value="logs"> | |||
Logs ({logs.length}) | |||
</Tabs.Trigger> | |||
<Tabs.Trigger value="checks">Checks</Tabs.Trigger> |
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.
src/views/Validator/CheckRow.tsx
Outdated
{hasFailures(check) && ( | ||
<Tooltip | ||
content={`${getPassPercentage(check).toFixed(2)}% success rate`} | ||
> | ||
<Text truncate css={textStyles}> | ||
Passed: {check.passes} | Failed: {check.fails} | ||
</Text> | ||
</Tooltip> | ||
)} |
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.
IMO showing this info in the row is better - the checks tab doesn't have high information density, so hiding it isn't necessary.
Here's what we do in the plugin
And here's a screenshot from k6 cli (which actually makes me wonder if we need to show 100% success rate at all - there doesn't seem to be any value in that)
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.
Looks great, I agree with uladzimir suggestions!
is there a specific reason why passes/fails are shown for groups except default
? 🤔
@Llandy3d @going-confetti Made changes based on the feedback. I think there's room for improvement especially around the collapsible component and the table header potentially being confusing depending on how many checks are being listed. Let me know what you think. Screen.Recording.2024-09-09.at.10.59.43.AM.mov |
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 ::
separator is a k6 specific thing and I don't think I would use it in the UI as well 🤔
For the other things, I think it looks good, for the time we have to dedicate now it looks better than expected (the alternative being showing the end of test summary in a raw state) so I think that this PR is ready to be merged 🙌
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.
LGTM!
This PR implements a function that listens for the
script:check
event and populates the newCheck
tab on the Validator component. Ticket: https://github.com/grafana/k6-cloud/issues/2822Checks
tab and validate that the checks are being grouped and displayed appropriatelyscript for testing