[wp-trac] [WordPress Trac] #48978: Add a new test case for E2E test (Show admin bar if user logged in)
WordPress Trac
noreply at wordpress.org
Wed Oct 13 14:51:36 UTC 2021
#48978: Add a new test case for E2E test (Show admin bar if user logged in)
------------------------------+------------------------------
Reporter: hideokamoto | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Build/Test Tools | Version:
Severity: normal | Resolution:
Keywords: needs-patch | Focuses: javascript
------------------------------+------------------------------
Comment (by justinahinon):
Hello @hideokamoto,
Thanks for opening the ticket and the work you did on it.
I have updated your last patch 48978-2.patch​ and make a couple of
updates/additions on it in
https://core.trac.wordpress.org/attachment/ticket/48978/48978-4.patch.
- For the first test (checking if the admin bar is present), you don't
need to use these two lines to log in as an admin and access the
dashboard.
{{{
#!javascript
await loginUser();
await page.goto( createURL( '/' ) );
}}}
You can simply use `await visitAdminPage( '/' );` (see
https://github.com/WordPress/gutenberg/blob/trunk/packages/e2e-test-
utils/src/visit-admin-page.js) that will visit the admin dashboard and log
in as an admin if it is not the case.
- I then removed the `loginUser()` utility function as it was not used
anymore
- I added another test that checks that the admin bar is not present when
not logged in.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/48978#comment:8>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list