[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
Thu Feb 20 07:10:44 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
------------------------------+------------------------------
Comment (by talldanwp):
Hi @hideokamoto,
Thanks for updating the patch. I see what's happening. It looks like the
reason checking the length is not working is due to the selector using the
`page.$` function, which is the equivalent of `document.querySelector` and
only returns the first element it encounters.
If you use `page.$$` (`document.querySelectorAll`) instead the test seems
to work well:
{{{
it( 'Should show admin bar when user logged in' , async () => {
await loginUser();
await page.goto( createURL( '/' ) );
const nodes = await page.$$( '#wpadminbar' );
expect( nodes.length ).toBe( 1 );
} );
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/48978#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list