Skip to content

E2E: Fix tracking specs against GB v14.8.x#71572

Merged
fullofcaffeine merged 18 commits intotrunkfrom
fix/e2e-tracking-specs
Jan 18, 2023
Merged

E2E: Fix tracking specs against GB v14.8.x#71572
fullofcaffeine merged 18 commits intotrunkfrom
fix/e2e-tracking-specs

Conversation

@WunderBart
Copy link
Copy Markdown
Contributor

@WunderBart WunderBart commented Dec 29, 2022

Warning
Do not merge before Gutenberg v14.8 is in production.

Context:

  • p4TIVU-am0-p2
  • p4TIVU-amj-p2

Proposed Changes

Fix tracking specs against the GB v14.8.x upgrade:

  • specs/editor-tracking/editor-tracking__block-inserted-event.ts
  • specs/editor-tracking/editor-tracking__other-block-events.ts
  • specs/editor-tracking/editor-tracking__toolbar-events.ts
  • specs/editor-tracking/editor-tracking__global-styles-events.ts
  • specs/editor-tracking/editor-tracking__fse-template-events.ts
  • specs/editor-tracking/editor-tracking__document-actions-events.ts
  • specs/editor-tracking/editor-tracking__pattern-events.ts

Testing Instructions

The above suites should be passing against edge sites in the CI.

@WunderBart WunderBart self-assigned this Dec 29, 2022
@github-actions
Copy link
Copy Markdown

github-actions bot commented Dec 29, 2022

@matticbot
Copy link
Copy Markdown
Contributor

This PR does not affect the size of JS and CSS bundles shipped to the user's browser.

Generated by performance advisor bot at iscalypsofastyet.com.

@WunderBart
Copy link
Copy Markdown
Contributor Author

WunderBart commented Jan 2, 2023

@dpasque @Addison-Stavlo

@noahtallen noticed (p1672270550575539/1672268819.313079-slack-CBTN58FTJ) that the tracking specs are failing for the Gutenberg v14.8 upgrade, but I suspect they've been broken for a while now. Failures from this PR seem to have been piling up since the last few upgrades. For example, the Details feature was (re)moved in v14.5, which would mean those specs should be failing since ~Nov 18th.

What's the policy on running tracking specs? Are they considered blocking/required for the Gutenberg upgrade? I wasn't sure about that, so we've postponed the v14.8 upgrade (p4TIVU-amj-p2) mostly because of those failures.

/cc @worldomonation @fullofcaffeine

@WunderBart
Copy link
Copy Markdown
Contributor Author

There's still one failure that I didn't know how to address because it seems to actually point to a missing event:

Could you take a look @Addison-Stavlo / @dpasque? 🙏

@matticbot matticbot added the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label Jan 2, 2023
@WunderBart WunderBart added Tests Bug When a feature is broken and / or not performing as intended labels Jan 2, 2023
@WunderBart WunderBart marked this pull request as ready for review January 2, 2023 14:28
@WunderBart WunderBart requested review from a team and worldomonation as code owners January 2, 2023 14:28
@WunderBart
Copy link
Copy Markdown
Contributor Author

WunderBart commented Jan 2, 2023

The specs/editor/editor__schedule.ts: Editor: Schedule: Schedule: future spec is failing, but it's unrelated to this PR. I will address it in a separate one.

@dpasque
Copy link
Copy Markdown

dpasque commented Jan 2, 2023

@WunderBart -- thank you so much for working on these! 🙇

What's the policy on running tracking specs? Are they considered blocking/required for the Gutenberg upgrade? I wasn't sure about that, so we've postponed the v14.8 upgrade (p4TIVU-amj-p2) mostly because of those failures.

I can help weigh in here!

Two helpful threads that I think should give a lot of context:
p1654549794215299-slack-C1A1EKDGQ
pdqkMK-mx-p2

It's been hard for a while to dial in the right relevant priority for these Tracks metric! They're valuable, but still require a decent amount of maintenance, and placing that among the many other priorities we have on dotcom is hard! I know @Addison-Stavlo's team has done a lot of work keeping up on the changes, but there will likely continue to be breakages over time.

As discussed in the Slack thread, we opted to move them to their own build and make them non-blocking for Gutenberg upgrades. Since they usually only point to failures that don't affect the user experience, we didn't want to hold up those releases. The idea was that Gutenberg could still be deployed with a failing test, and then we would ping Cylon/KitKat to notify of the failure and we would go back and make updates. However, looking at the volume of what needed to be fixed here, I'm wondering if that will be sustainable. 😬

I've been thinking a lot about Eric's comment here: pdqkMK-mx-p2#comment-382. @Addison-Stavlo -- do you think it would make sense to pare down the E2E tests to only the Tracks metrics that are actively being used? Is that too dramatic? I'm just trying to consider other ways to minimize the maintenance here!

Copy link
Copy Markdown

@dpasque dpasque left a comment

Choose a reason for hiding this comment

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

Code changes look good btw! 👍 One question for you about the page closures.

Comment on lines 46 to 49
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Question: Do we need this here? Aren't all the pages closed up by our custom jest environment? AFAIK, we usually don't need to close up pages manually during tests.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

And actually, I think that may mess with capturing screenshots and videos, because we iterate through open pages on teardown and grab the screenshots and videos. But if the page is already closed, the teardown logic won't find it!

Copy link
Copy Markdown
Contributor Author

@WunderBart WunderBart Jan 3, 2023

Choose a reason for hiding this comment

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

Perfect catch! I've just realized that the after hook is fired even if the block fails, making it the wrong spot to put the page closing at because it indeed would prevent the artifacts from being created. 💥 In the case of suites like these, though, where there are multiple describe blocks, I'd still close the page at the end of every block (only in a dedicated step instead of the after hook). Otherwise, the recordings will not be stopped even for successful blocks and will be uploaded along with failed ones. For example, this will upload three sets of artifacts, of which only the last one is relevant:

// foo.spec.js

describe({
  // opens page #1, succeeds
})
describe({
  // page #1 is open
  // opens page #2, succeeds
})
describe({
  // page #1 is open
  // page #2 is open
  // opens page #3, fails
})

// Artifacts for page #1, #2 and #3 are uploaded.

This is true for our current env setup, so alternatively, maybe we could make some changes not to create artifacts for successful blocks? Let me know what you think, @dpasque!


Accidentally, while testing if what I've described above is true, I've uncovered a bug in our env setup that causes each artifact (trace/recording/image/etc.) to overwrite the previous one. It happens because we're creating the artifact name outside of the context→page iteration blocks, which causes each context & page have the 0 index. I'll make a fix in another PR!

Copy link
Copy Markdown
Contributor Author

@WunderBart WunderBart Jan 3, 2023

Choose a reason for hiding this comment

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

PR here: #71623

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This is true for our current env setup, so alternatively, maybe we could make some changes not to create artifacts for successful blocks? Let me know what you think, @dpasque!

Yes for sure, I've long wanted to do this, but never just set aside to knock it out! I think that would be a nice improvement over our current setup 👍

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

comment: A counterpoint is that we may have a situation where the previous top-level describe blocks may have passed but it inadvertently put the webapp in a condition that leads to an immediate failure in the next top-level describe block.

In the hypothetical spec with three describe blocks above, it is possible that an overlay appears between the last step of the second block and the beginning of the third block on the same page.

Granted, it is little bit of a cherry-picked scenario, I will admit that!

@dpasque
Copy link
Copy Markdown

dpasque commented Jan 2, 2023

There's still one failure that I didn't know how to address because it seems to actually point to a missing event:
https://teamcity.a8c.com/buildConfiguration/calypso_WPComTests_editor_tracking_simple_edge_desktop/9236189?buildTab=tests&status=failed&expandedTest=build%3A%28id%3A9236189%29%2Cid%3A1119.
Could you take a look @Addison-Stavlo / @dpasque? 🙏

I fixed this in 7d4b937 -- it looks like we are now tracking the page list item block as part of the event now. 👍

Also, it looks like the new sidebar design didn't play well with our pattern for deleting template parts, and we weren't deleting more than the first template part! I fixed that in d90d6ca.

With that, it looks like the CI Edge build is green! 🙌

cc @WunderBart and @Addison-Stavlo (fyi that this no longer needs investigation! 👍 )

@WunderBart
Copy link
Copy Markdown
Contributor Author

WunderBart commented Jan 3, 2023

Thank you for all the context and fixing that last bit, @dpasque – much appreciated! 🙌
TBH, I suspected that these might not be required, but the fact that there were so many failures made me think that we need to take a closer look regardless before we continue upgrading. Having said that, I'll move on with the upgrade now that it's all clear and green. Thanks again! 🙇

Copy link
Copy Markdown

@dpasque dpasque left a comment

Choose a reason for hiding this comment

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

Approving pending the removal of the afterAll hooks! 👍 🚀

@WunderBart
Copy link
Copy Markdown
Contributor Author

WunderBart commented Jan 18, 2023

@dpasque, I need some more help with this one if you have a spare cycle! 🙏 Looks like the Template Modal has been refactored with one of the recent upgrades, and some specs started failing because of it. I'm having a hard time figuring out the right fix for this. Would you be able to take a look?

@fullofcaffeine fullofcaffeine merged commit 62bb2d0 into trunk Jan 18, 2023
@fullofcaffeine fullofcaffeine deleted the fix/e2e-tracking-specs branch January 18, 2023 18:38
@github-actions github-actions bot removed the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label Jan 18, 2023
danielbachhuber pushed a commit that referenced this pull request Jan 18, 2023
* Fix tracking specs against GB v14.8.x

* Fix editor-tracking__other-block-events.ts

* Fix specs/editor-tracking/editor-tracking__global-styles-events.ts

* Remove accidental skip

* More global styles tracking fixes

* Remove "Details" popover test & related actions
The "Details" popover doesn't exist since v14.5. See WordPress/gutenberg#44788

* Fix editor-tracking__toolbar-events.ts

* Fix editor-tracking__document-actions-events.ts

* Fix editor-tracking__fse-template-events.ts

* Fix editor-tracking__pattern-events.ts

* Fix padding setting in editor-tracking__global-styles-events.ts

* Remove accidental page.close

* Update block names for template conversion

* Update template part deletion for new site editor

* Move page closing to a dedicated step
As per #71572 (comment)

* Update test to match current theme (twenty-twenty-two)

* Skip the whole block since currently tracking is not tested there

* Redesign spec around 2022 theme

Co-authored-by: dpasque <dan.speckhard.pasque@automattic.com>
@WunderBart
Copy link
Copy Markdown
Contributor Author

Thanks for taking this one over the finish line @dpasque @fullofcaffeine! 🙇

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug When a feature is broken and / or not performing as intended Tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants