Skip to content

Testing instructions for critical flows

Sudip Dadhaniya edited this page Jul 27, 2024 · 12 revisions

Plugin Activation

Ensure the seamless installation and activation of the Block Catalog plugin.

Test Steps

  • Install the Block Catalog plugin from the WordPress repository.
  • Activate the plugin.
  • Verify that there are no activation errors or conflicts with other plugins

Expected Result:

No activation errors or conflicts with other plugins should be displayed.


Block Catalog

Ensure that the blocks catalog option is visible in 'Tools' and you can index post type.

Test Steps

  • Go to the Tools -> Block Catalog
  • Select Post Type(s)
  • Click on Index

Expected Result:

  • Selected post type should be indexed.
  • 'View Block Catalog' link should be appeared with the number of post indexed on Success message banner.

Block Catalog List

Ensure that block catalog list should be appeared when you index the posts.

Test Steps

  • Go to the Tools -> Block Catalog
  • Select Post Type(s)
  • Click on Index
  • Go to Posts -> Block Catalog

Expected Result:

  • Ensure that indexed posts' blocks are listed in the block catalog.
  • Make sure the block name, block slug, and count appeared correctly on the block catalog listing.

Add New Block Catalog

Ensure that you can add new block catalog.

Test Steps

  • Go to Posts -> Block Catalog
  • Add Name, Slug, Parent Category
  • Click on "Add New Block Catalog"

Expected Result:

Block catalog should be added in the list.


Delete index

Make sure indexed post type should be delete when you click on 'Delete Index' Button.

Test Steps

  • Go to the Tools -> Block Catalog
  • Select Post Type(s)
  • Click on Index
  • Click on Delete Index button

Expected Result:

  • Indexed post type should be deleted.
  • Make sure there is no block catalog available in block catalog list.

Check block catalog in post type list view

Verify that you can see the block catalog in any post type list view (Ex. Post, Page)

Test Steps

  • Go to the Tools -> Block Catalog
  • Select Post Type(s)
  • Click on Index
  • Go to Posts > Click on All Posts

Expected Result:

  • Each article row in the article list displays the block catalog.

Filter the listing posts with specific blocks

You should be able to filter by used block on the listing page for post types

Test Steps

  • Go to the Tools -> Block Catalog
  • Select Post Type(s)
  • Click on Index
  • Go to Posts > Click on All Posts
  • Go to Filter and Select block by click on "All block" dropdown
  • Click on filter

Expected Result:

  • As a result, you will see a list of posts that have used a block that you have filtered

WP CLI commands

Make sure you can perform iterations through all posts to catalog them one at a time by following command

[--reset] Deletes the previous index before starting.

[--only=] Limits the command to the specified comma delimited post ids.

[--network=] Indexes the entire network. Accepts a comma delimited list of child site ids.

[--dry-run] Runs catalog without saving changes to the DB.

Test Steps

  • Go to plugin directory and open console
  • Run wp block-catalog index [--only=] [--dry-run]

Expected Result:

  • Based on the ran command, you should get the results (Ex. If you run [--dry-run] then Runs catalog without saving changes to the DB)

WP CLI commands

Ensure you can run the following command and you will see the results as described below.

  • wp block-catalog find <blocks>... [--index] [--fields] [--format] [--post_type] [--posts_per_page] [--post_status] [--count=<count>] [--operator=<operator>] Finds the list of posts having the specified block(s)

    • <blocks>... The block names to search for, eg:- core/embed

    • [--index] Whether to re-index before searching.

    • [--fields=<fields>] List of post fields to display.

    • [--format=<format>] Output format, default table.

    • [--post_type=<post_type>] Limit search to specified post types.

    • [--posts_per_page=<posts_per_page>] Number of posts to find per page, default 20

    • [--post_status=<post_status>] Post status of posts to search, default 'publish'

    • [--count=<count>] Prints total found posts, default true. When combined with --network prints an aggregate across the multisite.

    • [--operator=<operator>] The query operator to be used in the search clause. Default IN.

    • [--network=<network>] Searches across the entire network if on multisite. Accepts a comma delimited list of child site ids.

  • wp block-catalog delete-index Resets the Block Catalog by removing all catalog terms.

    • [--network=<network>] Deletes the indexes across the entire network. Accepts a comma delimited list of child site ids.
  • wp block-catalog post-blocks <post-id> [--index] Prints the list of blocks in the specified post.

    • <post-id> The post id to lookup blocks for.
  • wp block-catalog export [--output=<output>] [--post_type=<types>] [--posts_per_block=<number>] [--ignore_parent=<ignore_parent>] Exports the posts associated with the 'block_catalog' taxonomy to a CSV file.

    • [--output=<output>] Path to the CSV file. Defaults to /tmp/block-catalog.csv.

    • [--post_type=<types>] Comma-delimited list of post types. Optional.

    • [--posts_per_block=<number>] Number of posts per block, default to -1 (all). Optional.

    • [--ignore_parent=<ignore_parent>] Ignore top level blocks. Optional. Default true.

Test Steps

  • Go to plugin directory and open console
  • Run wp block-catalog {Command}

Expected Result:

  • Based on the ran command, you should get the results (Ex. If you run [--index] Whether to re-index before searching.)