-
Notifications
You must be signed in to change notification settings - Fork 800
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pinterest Block: Add an e2e test. #14096
Conversation
Thank you for the great PR description! When this PR is ready for review, please apply the Scheduled Jetpack release: December 3, 2019. |
I couldn't see why the WordAds block was failing, and had enough of debugging on Travis. It'd be nice if #12842 landed, to make these things a bit easier. |
@@ -54,8 +54,8 @@ export async function waitForSelector( page, selector, options = {} ) { | |||
* @param {Object} options Custom options to modify function behavior. | |||
*/ | |||
export async function waitAndClick( page, selector, options = { visible: true } ) { | |||
await waitForSelector( page, selector, options ); | |||
return await page.click( selector, options ); | |||
const element = await waitForSelector( page, selector, options ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed this to use the element returned by waitForSelector()
, as I'd originally modified waitForSelector()
to accept an XPath selector, too (9f62cb1). That's since been reverted, I have no strong feelings either way about this change.
@@ -6,7 +6,7 @@ import { waitAndClick, waitForSelector } from '../page-helper'; | |||
|
|||
export default class PostFrontendPage extends Page { | |||
constructor( page ) { | |||
const expectedSelector = '#main article.post'; | |||
const expectedSelector = '.post'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I reviewed all of the Core default themes, there was no consistent selector with the level of specificity of #main article.post
: sometimes #main
existed, sometimes it didn't. Sometimes it was a <div>
, sometimes a <main>
, sometimes it had role="main"
defined. Sometimes it used <article>
sometimes a <div>
. However, they all use the .post
class, given how long this class has been defined, I would expect it to continue into the future.
I don't think the lower specificity is a problem, since it's always loading a single post page: if there's no post, the .post
class won't be used anywhere.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
const blockIconSelector = `.editor-inserter__menu button[aria-label*='${ blockName }']`; | ||
async insertBlock( blockName, blockTitle ) { | ||
await searchForBlock( blockTitle ); | ||
const blockIconSelector = `.editor-block-list-item-jetpack-${ blockName }`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gutenberg removed the aria-label
property, and changed their equivalent selector in tests to an XPath selector. I found this to be unreliable, and felt fragile when applied to beta blocks, which have the "Beta" term in their displayed title. It's much more reliable to use the unique name that block defines.
For some reason the WordAds block looks like it isn't properly focussing after it's inserted, going by the e2e test failure report. I wasn't able to reproduce this behaviour locally, I tried forcing it to focus (2805b85), but that didn't help. |
Follow up to #13905.
This PR adds an e2e test, ensuring that the Pinterest block remains usable in the future.
It also tidies up some bugs in the existing block e2e tests, which were getting in the way of a clean test run.
Changes proposed in this Pull Request:
Adds an e2e test.
Is this a new feature or does it add/remove features to an existing part of Jetpack?
Testing improvement.
Testing instructions:
N/A, since e2e tests only run on Travis.
Proposed changelog entry for your changes:
N/A