[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
Fri Feb 14 05:10:01 UTC 2020
#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
------------------------------+------------------------------
Changes (by talldanwp):
* keywords: => needs-patch
Comment:
Hi @hideokamoto, Thanks for adding an end to end test. I thought I'd share
some feedback about the test:
- It'd be great if you could add semi-colons as per the coding standards
(https://make.wordpress.org/core/handbook/best-practices/coding-
standards/javascript/#semicolons)
- Currently there's a separate import for `loginUser`, this should ideally
be part of import on the line above for `e2e-test-utils` so that it looks
like this:
{{{
import { visitAdminPage, createURL, loginUser } from '@wordpress/e2e-test-
utils';
}}}
- `expect( nodes.length ).not.toEqual( 0 );` I know the test above has a
similar expectation, but as far as I'm aware more than one admin bar would
be unexpected. I think it'd be better to change this to `expect(
nodes.length ).toBe( 1 );`, it's also safe to use the stricter `toBe`
matcher for numbers.
- I think it could be worth also testing for absence of the admin bar when
logged out, this would likely be a separate test case.
- What do you think about changing the test description from 'Login User'
to 'Admin Bar'? I think that would better reflect what's being tested.
Thanks!
--
Ticket URL: <https://core.trac.wordpress.org/ticket/48978#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list