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: IATR-M1.0 Debug Spec component update #25263

Merged
merged 22 commits into from
Dec 31, 2022

Conversation

amehta265
Copy link
Contributor

User facing changelog

This PR aims at updating the Debug Spec component and the Debug Failed component. It accomplishes the following:
It refurbishes the header section of the component to include a text icon and adds a specsMetadata section which provides more information about the spec duration, number of groups, browsers, operating systems, and testing types for the tests within the given spec.
In addition, the failed component section is now created to support multiple groupings for a given test and hover states for each test instance.

Additional details

The most important thing to understand is the data schema passed into debugSpec (the "parent" UI component for this PR). The debugSpec component receives the schema below from debugMapping.ts:

type CloudDebugSpec = {
  spec: DebugSpecListSpecFragment
  tests: { [thumbprint: string]: DebugSpecListTestsFragment[] }
  groups: { [groupId: string]: DebugSpecListGroupsFragment }
  testingType: TestingTypeEnum
  matchesCurrentTestingType: boolean
  foundLocally: boolean
}
  • The spec is the current current spec that will be rendered by the debug Spec component.

  • The tests are a mapping of thumbprints to the test represented by the thumbprint: A thumbprint is a unique hash associated with each test. If the same test is run for two different groups (e.g. Staging and Production) both tests will share the same thumbprint but will each have unique groupId pointing to the specific group each test is associated with e.g. {'unique1': [{...Test, grpId: '123'}, {...Test, grpId: '456'}] }. This is an example of two tests sharing the same thumbprint but each have unique instances as the test was run for different groups. On the other hand a test with a single group would look this: {'Unique1': [{Test}]}

  • The groups are a mapping of groupID to their corresponding group e.g. ('123': {Staging}, '456': {Production}).

  • Each test will have at least 1 group associated with it. In this case we render the single group UI. On the other hand if there is more than 1 group then we show the multiple groups UI.

  • StatsMetadata.vue is a reusable component that helps render a list of items separated by "." It is used in the spec component header section as well as the grouped failed test section.

  • LayeredBrowserIcons.vue is a component used to render multiple browsers in the header section of the component.

  • GroupedDebugFailedTest.vue is a reusable component that is rendered every time there are multiple groups associated with the same test.

  • DebugArtifacts.vue is a the component in charge of showing the hovered state icons

  • For a better understanding refer to the images below:

Steps to test

This issue has 7 component tests: DebugArtifacts, DebugContainer, DebugFailedTest, DebugSpec, GroupedDebugFailedTest, LayeredBrowserIcons, StatsMetadata. Checkout to this branch to run the tests from the packages/app/ folder. To run these tests:

  1. Change directory to packages/app
  2. Run yarn dev
    Navigate to Component Testing and run the above tests

How has the user experience changed?

I have labeled different sections of the picture with file names to provide better understanding of which component is responsible for what UI.

Single Groups UI:
Screenshot 2022-12-23 at 12 26 41 PM

Multiple Groups UI:
Screenshot 2022-12-23 at 12 27 05 PM

PR Tasks

  • Have tests been added/updated?
  • Has the original issue (or this PR, if no issue exists) been tagged with a release in ZenHub? (user-facing changes only)
  • [na] Has a PR for user-facing changes been opened in cypress-documentation?
  • [na] Have API changes been updated in the type definitions?

@cypress-bot
Copy link
Contributor

cypress-bot bot commented Dec 23, 2022

Thanks for taking the time to open a PR!

@amehta265 amehta265 changed the base branch from develop to feature/IATR-M0 December 23, 2022 17:45
@amehta265 amehta265 requested a review from a team December 23, 2022 17:48
@amehta265 amehta265 changed the title feat: Debug Spec component update feat: IATR-M1.0 Debug Spec component update Dec 23, 2022
@cypress
Copy link

cypress bot commented Dec 23, 2022



Test summary

26488 0 1180 0Flakiness 27


Run details

Project cypress
Status Passed
Commit c68fbcb
Started Dec 30, 2022 9:31 PM
Ended Dec 30, 2022 9:48 PM
Duration 17:43 💡
OS Linux Debian -
Browser Multiple

View run in Cypress Dashboard ➡️


Flakiness

create-from-component.cy.ts Flakiness
1 ... > runs generated spec
commands/net_stubbing.cy.ts Flakiness
1 network stubbing > intercepting request > can delay and throttle a StaticResponse
2 network stubbing > intercepting request > can delay and throttle a StaticResponse
3 network stubbing > intercepting request > can delay and throttle a StaticResponse
4 network stubbing > intercepting request > can delay and throttle a StaticResponse
This comment includes only the first 5 flaky tests. See all 27 flaky tests in the Cypress Dashboard.

This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. You can manage this integration in this project's settings in the Cypress Dashboard

@lmiller1990 lmiller1990 requested review from slumericanB and removed request for slumericanB December 26, 2022 01:22
Copy link
Contributor

@lmiller1990 lmiller1990 left a comment

Choose a reason for hiding this comment

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

Various comments, mainly

  1. we can be more type safe, we can pair if you want to go over any of my comments
  2. I think we should avoid ! - better to have a null check and be defensive. More verbose, but unless we are 100000% sure the property cannot be null/undefined, it's not worth the risk in production.

packages/app/src/debug/DebugContainer.cy.tsx Outdated Show resolved Hide resolved
packages/app/src/debug/DebugContainer.cy.tsx Outdated Show resolved Hide resolved
packages/app/src/debug/DebugContainer.cy.tsx Show resolved Hide resolved
packages/app/src/debug/DebugFailedTest.vue Outdated Show resolved Hide resolved
packages/app/src/debug/DebugFailedTest.vue Outdated Show resolved Hide resolved
packages/app/src/debug/LayeredBrowserIcons.vue Outdated Show resolved Hide resolved
packages/app/src/debug/StatsMetadata.vue Show resolved Hide resolved
packages/app/src/debug/StatsMetadata.vue Outdated Show resolved Hide resolved
packages/app/src/debug/StatsMetadata.vue Outdated Show resolved Hide resolved
packages/app/src/debug/StatsMetadata.vue Outdated Show resolved Hide resolved
Copy link
Contributor

@warrensplayer warrensplayer left a comment

Choose a reason for hiding this comment

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

Still working through other parts of the code, but wanted to share these comments.

The DebugSpecList component is missing some items needed to be passed down to the child components. The DebugSpecListSpec fragment is missing the specDuration field. In the specs computed value, all the information needed to be mapped in the return value for the spec portion are not there. I think you may be able to just spread the entire specItem.spec now and then override or add any other fields needed. Still looking at what might work.

packages/app/src/debug/DebugSpec.vue Outdated Show resolved Hide resolved
packages/app/src/debug/GroupedDebugFailedTest.vue Outdated Show resolved Hide resolved
packages/app/src/debug/DebugArtifacts.vue Outdated Show resolved Hide resolved
packages/app/src/debug/DebugSpec.vue Outdated Show resolved Hide resolved
packages/app/src/debug/DebugArtifacts.cy.tsx Outdated Show resolved Hide resolved
packages/app/src/debug/DebugFailedTest.cy.tsx Show resolved Hide resolved
packages/app/src/debug/DebugFailedTest.cy.tsx Show resolved Hide resolved
packages/app/src/debug/DebugFailedTest.vue Show resolved Hide resolved
packages/graphql/test/stubCloudTypes.ts Outdated Show resolved Hide resolved
packages/frontend-shared/src/components/ResultCounts.vue Outdated Show resolved Hide resolved
packages/frontend-shared/src/components/ResultCounts.vue Outdated Show resolved Hide resolved
packages/frontend-shared/src/components/ResultCounts.vue Outdated Show resolved Hide resolved
packages/frontend-shared/src/components/ResultCounts.vue Outdated Show resolved Hide resolved
packages/app/src/debug/DebugSpec.vue Show resolved Hide resolved

it('mounts correctly for all icons together and has correct URLs', () => {
cy.mount(() => (
<div class="flex flex-grow space-x-4.5 pt-24px justify-center" data-cy='debug-artifacts-all'>
Copy link
Contributor

Choose a reason for hiding this comment

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

Noticed an opportunity here, we could grab the very similar looking code here and here to make a DebugArtifactLinkList component or something. We seem to have the idea of this component 3 places if you include this test, and the presence in the test tells me we want to see the artifact links grouped on their own like this.

Copy link
Contributor

@warrensplayer warrensplayer left a comment

Choose a reason for hiding this comment

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

A few small things

packages/app/src/debug/DebugFailedTest.vue Outdated Show resolved Hide resolved
packages/app/src/debug/GroupedDebugFailedTest.vue Outdated Show resolved Hide resolved
packages/app/src/debug/DebugFailedTest.cy.tsx Show resolved Hide resolved
packages/app/src/debug/StatsMetadata.vue Outdated Show resolved Hide resolved
packages/app/src/debug/StatsMetadata.vue Outdated Show resolved Hide resolved

const debugArtifacts = computed(() => {
return props.failedTests.reduce<{[groupID: string]: {icon: string, text: string, url: string | null | undefined }[] }>((acc, curr) => {
//TODO Update logic to not rely on defaulting to empty strings
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this TODO a style preference or is does it functionally make a difference to something? If you don't plan to make this change, we can remove the TODO and maybe leave a comment explaining. If it's an important change, we should make an issue and put the issue number in the TODO.

Copy link
Contributor

@warrensplayer warrensplayer Dec 30, 2022

Choose a reason for hiding this comment

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

@amehta265 I just realized that this is rendering all three buttons every time, but it should only render if the corresponding boolean value in the result is true and the url is present. I filed a separate issue to resolve this: #25319

Copy link
Contributor

@marktnoonan marktnoonan left a comment

Choose a reason for hiding this comment

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

Going to approve as there are only small comments & we are going into a feature branch, I'll leave it up to you about which you implement.

In a general sense I think we can do more to label different content clearly for accessibility purposes and also to make the tests a bit easier to read . But I want to maybe come at that in a separate pass looking at this page as a whole a little further down the line.

Copy link
Contributor

@warrensplayer warrensplayer left a comment

Choose a reason for hiding this comment

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

Looks super!

@warrensplayer warrensplayer merged commit 0a3ee16 into feature/IATR-M0 Dec 31, 2022
@warrensplayer warrensplayer deleted the ankit/IATR-M1.0-spec-component-update branch December 31, 2022 15:03
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.

[IATR](M1.0) Failed Test Component Enhancements
5 participants