[wp-trac] [WordPress Trac] #48977: Add a new test case for E2E test
WordPress Trac
noreply at wordpress.org
Mon Mar 8 05:56:53 UTC 2021
#48977: Add a new test case for E2E test
------------------------------+------------------------------
Reporter: hideokamoto | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Build/Test Tools | Version:
Severity: normal | Resolution:
Keywords: | Focuses: javascript
------------------------------+------------------------------
Comment (by isabel_brison):
Hi @hideokamoto , thanks for your contribution!
The aim of having e2e tests in Core is to comprehensively check user
flows, to help relieve the burden of manually testing every single flow
after a change. They are particularly useful in catching regressions of
the kind where a change in one place causes an unexpected effect in a
different part of the code.
To that effect, the most useful approach is to test all the possible
actions on a page, as opposed to checking that the page itself renders. A
great example of that approach is the Gutenberg e2e tests for the block
editor: [https://github.com/WordPress/gutenberg/tree/trunk/packages/e2e-
tests/specs/editor]
There's also this draft: [https://github.com/WordPress/wordpress-
develop/pull/200] for adding tests for the Posts page, which proposes a
similar approach for Core.
Looking at your patch, you are checking that the default post/pages are
rendering on the front end. This can be problematic because e2e tests can
sometimes delete all content from the testing environment before running a
test, and that means the default content won't always be found in the
environment. We also can't assume the tests are going to be run in a
certain order.
I'm on the fence as to whether we should be testing front end pages at
all, as imo these tests should focus on the admin itself, but perhaps if
e.g we're testing a flow where a post is published, it might make sense to
check that the post exists after publishing.
With that in mind, would you be open to writing some new tests that follow
the above guidelines?
--
Ticket URL: <https://core.trac.wordpress.org/ticket/48977#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list