Open felixarntz opened 3 years ago
Thoughts on this one @aaemnnosttv @tofumatt @eugene-manuilov? Let's prioritize this for the new year to find a good approach.
I added some info to the issue/ACs based on our discussion awhile back. Un-assigning myself for now, but please assign me again if you want more input 🙂
@aaemnnosttv @tofumatt @eugene-manuilov Updated ACs for your review. If y'all agree, let's move it to IB.
LGTM 👍
Hi @tofumatt notice this has been picked up a little while ago. Are you still planning on working on this IB? If not might be good to un-assign yourself and let someone else pick up. Let me know what you think, Thanks!
@FlicHollis I had a look through what would be required here as a hackathon exploration, so I'll leave it assigned for now. 🙂
I've updated the ACs here to omit the section around WordPress versions before 5.2, since 5.2 is now our minimum supported WordPress version. (See: #5874)
Hi @tofumatt when you are back online please could you add an estimate here. Thanks!
@felixarntz does this make sense to prioritize right now seeing as we no longer have a planned integration in the block editor?
@aaemnnosttv Good question, it's still a good thing to work on, but not a P0 anymore. I'll update to a P1 ("Infrastructure" already has some notion of that this is not as important as e.g. a P1 bug or enhancement).
Marking this as a 19 estimate just because this involves E2E tests.
Thanks @tofumatt, this IB is looking good. I have a few questions:
activatePlugin
function from @wordpress/e2e-test-utils
? If so, it could be worth linking an example of our use of it, to help illustrate the point. If not, it could use a bit of clarification.Indeed, I meant using activatePlugin
to test with and without the latest Gutenberg plugin enabled. If possible we'd want to download the latest version of the plugin, or setup a system where we routinely include the latest version in our E2E plugins if that's not possible. I added a note about the helper usage though with an example 👍🏻
In terms of options to link to—nothing really as most of my exploration with anything more complex/complicated (eg. a dedicated set of Gutenberg E2E separate from the rest of the tests with a dedicated runner, etc.) all proven complicated/cumbersome to run and unsatisfactory. The summary I think I posted to the Hackathon slides was basically that our original ideas of creating a "dedicated" set of E2E tests for Gutenberg environments would be at best ergonomically awkward and more work to maintain, but I couldn't even get it working well compared to just adding tests that would run as part of the existing E2E suite which was straightforward. Given our minimum WP version always supports Gutenberg that's now easy to do so it's what I suggest. Sorry there's not much to show, but it'd mostly just be half-baked failing branches that never got off the ground 😅
Converting the existing integration is largely around being able to use more idiomatic APIs. I actually don't think that's a huge change given the APIs we'd use would be useSelect
so straightforward to add… and the only other thing we'd need to do is a React.render()
call for the div we use for that Idea Hub integration. It's not strictly required as part of this issue, fair enough, and I suppose we could add the test for that "component" without migrating it and then migrate it later—even benefitting from the E2E test being there if you like. I figured it was a relatively small part of this issue, but if you still think it's best to separate out let me know and I'll file a follow-up issue for that.
Hey @tofumatt, thanks for clarifying, and making that addition to the IB.
With regard to the Idea Hub notice, I have had a more fundamental realisation - we are in fact removing Idea Hub, via https://github.com/google/site-kit-wp/issues/6235, so for one thing it's clearly not worth the effort of converting the integration when its about to be removed.
It does also bring into question the viability of this Gutenberg testing framework if we don't have any tests for it, unless there are some on the horizon. Do you know if there's anything planned that would make use of it? I am a bit wary about adding code that's not being used at all...
I was thinking the same thing shortly after updating this IB.
I think it's worth adding this infrastructure once we need it, and not before. So we agree 🙂
I think for now I'll remove the bit about Idea Hub and move this to the stalled column. I think the existing ACs/IB will serve as a good base for the future, but there's no sense in doing this now without a real test.
We could "mock up" an integration but I don't think that's a great idea.
Moving to "Stalled" for now 👍🏻
Thanks @tofumatt, SGTM!
Thank you @techanvil and @tofumatt I will remove from the sprint too.
Based on #4107, this issue is focused on setting up the necessary infrastructure to test Gutenberg integrations as reliably as possible.
Some particular challenges to work around here include:
We need a testing infrastructure that caters for this. While it is impossible to cover all possible combinations of versions, we should have a good set to rely on. Potentially, we should introduce a subset of our e2e test suite specifically for Gutenberg-based e2e tests, where we would run for a few more scenarios (e.g. one pre-5.0 with Gutenberg plugin, one with 5.0, one with 5.3, one with latest). In addition to e2e tests (which will be the most reliable automatic way to test the integrations), a good additional measure could be to always use the exact versions used in WordPress 5.0 for all the Gutenberg dependencies that Site Kit is using even in Jest tests (at least this part will technically rely on #4107 to be completed first) - to ensure we don't use APIs/functions that were only supported at a later point.
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
In this issues, "Gutenberg plugin" refers to the WP Gutenberg plugin that can be used to get the "latest" Gutenberg features/version, as referenced above.
tests/e2e/gutenberg
or similar) that are used for testing Gutenberg integrations (for now this is only the Idea Hub notice)Implementation Brief
To reduce the complexity of the test run code locally and improve local test speed, I think it's best to only run the various WordPress version tests (eg.
5.2
andlatest
) on GitHub Actions/CI. We should run the tests locally on one specific version, but this can be changed locally using existing tools. Testing mostly onlatest
is fine, and the CI tests will cover any APIs not available in5.2
. After exploring options during the Hackathon, I think this is the least complex and also much-faster-to-run approach.In terms of testing with/without the Gutenberg plugin installed: I think this is best done by using our existing "enable plugin" approach, eg using
activatePlugin
(see an example of that helper function usage here: https://github.com/google/site-kit-wp/blob/6fb1e91b6b72f5aa029b28e47da00b13a70fba19/tests/e2e/specs/admin-tracking.test.js#L49). We should have a dedicated "Gutenberg test function" or utility that we can wrap a group of tests in that will run them both with and without the Gutenberg plugin. This will ensure the APIs used work in both the oldest, latest, and future versions of Gutenberg.This means we won't need to create any dedicated E2E folders or configs for Gutenberg tests. This is contrary to the ACs, but I think is a simpler approach that means Gutenberg tests can be part of the existing tests. Otherwise, we essentially need extra environments, complex scripts, and multiple locations for E2E tests.
it
and/ordescribe
blocks in anit.each
that runs tests both with and without the latest Gutenberg plugin enabledTest Coverage
QA Brief
Changelog entry