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 flaky VRT tests #9101

Open
3 tasks
techanvil opened this issue Jul 31, 2024 · 5 comments
Open
3 tasks

Fix flaky VRT tests #9101

techanvil opened this issue Jul 31, 2024 · 5 comments
Labels
P0 High priority Team S Issues for Squad 1 Type: Infrastructure Engineering infrastructure & tooling

Comments

@techanvil
Copy link
Collaborator

techanvil commented Jul 31, 2024

Feature Description

The VRT test Modules/Analytics4/Widgets/DashboardOverallPageMetricsWidgetGA4/LoadedEntityURL is sporadically failing in CI, as can be seen in some recent VRT workflow failures:

Visual diff:
image

Additionally, the test Components/SelectionPanel/Default has been seen failing in this test run:

Visual diff:

image


Do not alter or remove anything below. The following sections will be managed by moderators only.

Acceptance criteria

  • The following VRT tests should pass consistently:
    • Modules/Analytics4/Widgets/DashboardOverallPageMetricsWidgetGA4/LoadedEntityURL
    • Components/SelectionPanel/Default

Implementation Brief

Modules/Analytics4/Widgets/DashboardOverallPageMetricsWidgetGA4/LoadedEntityURL

Components/SelectionPanel/Default

This appears to be the difference in the focussed or unfoccuses state of the first checkbox.

Test Coverage

  • Confirm over several VRT runs that this issue is no longer occuring.

QA Brief

  • No QA needed; VRT tests in CI should be more stable after the change.

Changelog entry

  • N/A
@techanvil techanvil added P1 Medium priority Type: Infrastructure Engineering infrastructure & tooling labels Jul 31, 2024
@binnieshah binnieshah added Next Up Issues to prioritize for definition Team S Issues for Squad 1 labels Aug 2, 2024
@techanvil techanvil self-assigned this Aug 16, 2024
@techanvil techanvil changed the title Fix flaky VRT test Fix flaky VRT tests Aug 16, 2024
@techanvil techanvil removed their assignment Aug 16, 2024
@aaemnnosttv aaemnnosttv added P0 High priority and removed P1 Medium priority labels Aug 23, 2024
@aaemnnosttv
Copy link
Collaborator

FWIW the instability around the LoadedEntityURL (the only current unstable scenario) seems to be due to the changes introduced in #9029 and the responsive font-sizing.

@benbowler
Copy link
Collaborator

I've added a couple of ideas here to keep these stories consistent. I noticed the AC/descriptions suggested the second failure was in SetupMainPAX but the linked VRT run failed in Components/SelectionPanel/Default so I updated this in the ticket and addressed this in the IB.

I've added a larger estimate as without executing on the ticket I cannot confirm this has the desired effect on multiple GitHub actions runs. I could reduce the estimate if we aim to bounce this back to IB/create a new ticket if the suggested implementation fails to make these tests consistent or other instabilities appear in other tests that we want to address.

@benbowler benbowler removed their assignment Sep 5, 2024
@aaemnnosttv aaemnnosttv self-assigned this Sep 6, 2024
@aaemnnosttv
Copy link
Collaborator

  • Update assets/js/components/DataBlockGroup.js, add this new block to prevent the rescaling loop to run in the storybook context, add a clear comment to explain this addition:

@benbowler It's important to differentiate VRT from Storybook since these are separate, it's just that VRT uses Storybook. We do have the ability to conditionally alter the way Storybook is run in a VRT context however. See

previewHead: ( head ) => {
if ( process.env.VRT === '1' ) {

This is done to add additional CSS to disable animations for the same reason.

With that said, I'd prefer we don't change the behavior of the component to work differently in VRT as that undermines the purpose of the VRT (we may as well just remove that scenario). Animations can't be tested by VRT however, and the above essentially just freezes that from causing issues during screenshotting. As an external/environmental change, it's not a contradiction to the previous statement.

I think part of the problem is that the responsive adaptation only happens in response to resize or mount, when the text content (metrics) can change in between. There's a number of issues with the implementation which should probably be addressed in a separate issue, but I think the simplest fix here is probably to fix the data to use values that won't result in downscaling. That way we can keep the scenario while avoiding changes to production code.

@aaemnnosttv aaemnnosttv assigned benbowler and unassigned aaemnnosttv Sep 6, 2024
@benbowler
Copy link
Collaborator

Hey @aaemnnosttv makes sense, I've updated the IB, finding a URL that creates a faker seed that returns 0.27% for the engagement rate which prevents resizing at 420px.

Do you want me to create the ticket to refactor the DataBlockGroup component?

@benbowler benbowler assigned aaemnnosttv and unassigned benbowler Sep 9, 2024
@aaemnnosttv
Copy link
Collaborator

Thanks @benbowler – while this a little bit hacky, it seems like a fine solution here so long as we document that very clearly as to why that specific URL is important.

Do you want me to create the ticket to refactor the DataBlockGroup component?

Yes, let's get an issue opened to do that and start a conversation about what should be done there.

Thanks!

IB ✅

@aaemnnosttv aaemnnosttv removed their assignment Sep 12, 2024
@binnieshah binnieshah removed the Next Up Issues to prioritize for definition label Sep 26, 2024
@tofumatt tofumatt self-assigned this Oct 2, 2024
@tofumatt tofumatt mentioned this issue Oct 3, 2024
19 tasks
@tofumatt tofumatt removed their assignment Oct 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P0 High priority Team S Issues for Squad 1 Type: Infrastructure Engineering infrastructure & tooling
Projects
None yet
Development

No branches or pull requests

5 participants