Test AMP compatibility of entire site #1183
Pull Request For #1007
This crawls the site, and test for AMP validity by template/content type.
The text was updated successfully, but these errors were encountered:
Define get_post_permalinks(). This gets permalinks for public posts, other than attachments. Another helper function can call AMP_Validation_Manager::validate_url() for each of these permalinks.
validate_queued_posts_on_frontend() uses IDs, which are stored in $posts_pending_frontend_validation. So simply return IDs from the helper function.
I think the “Check Site” button would make sense on the “Invalid AMP Pages” screen. Clicking it should show a spinner and some progress indicator probably.
And as noted on #1184 (comment):
Having a “Check Site Compatibility” button would make a lot of sense on such a Theme Support admin screen. As part of this, we should allow for the
Add a $taxonomy parameter, to only get the terms for a given taxonomy.
A similar change to the one Weston proposed for get_taxonomy_links(). Get permalinks by post types, and allow paging through them. This will allow iteration, in a way similar to that in get_taxonomy_links().
In PHP 5.3, there was: Fatal error: Cannot access self:: when no class scope is active. https://travis-ci.org/Automattic/amp-wp/jobs/386045157. This looks to be because self isn't available inside the function in 5.3. Another option might be to add $self to use(). But this seems simpler, if it works.
This will enable crawling the site in Native AMP. This seems simpler than registering Paired Mode support, and adding template_dir. But it's still an open discussion as to whether it should only be Native AMP. If this already finds theme support, it doesn't change it.
Success: 196 URLs were crawled, and 196 have AMP validation issue(s). Query for the validation error posts. And output the number found.
3 assertions failed, so fix these both in the tested class and the PHPUnit class.
This has a much better display of the activity. On Weston's suggestion. Create a new method to count all of the URLs to be validated. This should only be used for WP-CLI, as it uses 'posts_per_page' => -1
@kienstra Also, this is important for AC2 to be satisfied:
If I'm in Classic mode, currently the result is:
So that needs to be improved so that site validity can be checked for AMP theme support prior to switching it on. To achieve that, I think the following needs to be done:
On Weston's suggestion, as this would not be able to validate any URL without the --force flag.
* Only show admin URL to review results if theme support initially present. * Skip showing table if no results obtained.
… and taxonomy * Hide the admin menu links for invalid URLs and validation errors by default in classic mode. * Invoking `wp amp validate-site` will cause the post type and taxonomy to be populated. * When in classic mode, show links to invalid pages and validation errors with template mode as opposed to in admin menu. * When viewing the admin screens for the post type and taxonomy, show the admin menu links for both.
The last piece here seemed to me to be providing a way for the user to access the validation results for their
Commands Work As Expected
Also, great idea to add links for the invalid URLs and errors in Classic mode:
Also wanted to call out #1273 here - the idea I spelled out there could try to surface errors next to where toggles exist (so that a user is more likely to select modes when they might be afraid to do this). I'm not entirely sure this is necessary or how straightforward implementing it might be, but it's captured in the backlog regardless.
Both that feature (and #1273) are trying to take an approach to accomplish the inverse goals of #1366: Instead of surfacing settings info in the error listings, surface the error listings in the settings.
The key decisions I still think are up for discussion (past