Skip to content
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

[RNMobile] Update "testAddGalleryBlock" test case to reflect expected content for v1 of Gallery block #18898

Merged

Conversation

SiobhyB
Copy link
Contributor

@SiobhyB SiobhyB commented Jun 16, 2022

Description

After we re-introduced support for v1 of the Gallery block in WordPress/gutenberg#41533, the testAddGalleryBlock test case within iOS' EditorGutenbergTests file began to fail with the following error:

✗ testAddGalleryBlock, XCTAssertEqual failed: ("Content Structure Blocks: 2, Words: 5, Characters: 24") is not equal to ("Content Structure Blocks: 5, Words: 5, Characters: 24") - Unexpected post structure.

The reason for this is that v1 is used by default when no API is mocked. Unlike v2 of the Gallery block, v1 doesn't use additional inner blocks when images are used. As additional blocks aren't added to the editor when images are uploaded to v1 of the block, the number of expected blocks has changed:

  • Gallery block v2: A Paragraph block + a Gallery block + 3 Image blocks = an expected 5 blocks.
  • Gallery block v1: A Paragraph block + a Gallery block = an expected 2 blocks.

This PR updates verifyContentStructure to reflect the fact we currently only expected 2 blocks when testAddGalleryBlock runs.

In the future, we may seek to mock an API request and update the test case to expect v2 of the Gallery block. We're going with this simpler solution for now in order to move forward with others PRs and address the failing test.

Testing

To test: Verify that all tests pass on this PR, with no failures.

Regression Notes

  1. Potential unintended areas of impact

I'm not aware of other areas of the code base that could be impacted by this change, though it's possible that other tests may rely on the testAddGalleryBlock case somehow.

  1. What I did to test those areas of impact (or what existing automated tests I relied on)

Ensured all tests pass for this PR.

  1. What automated tests I added (or what prevented me from doing so)

N/A

PR submission checklist:

  • I have completed the Regression Notes.
  • I have considered adding unit tests for my changes.
  • I have considered adding accessibility improvements for my changes.
  • I have considered if this change warrants user-facing release notes and have added them to RELEASE-NOTES.txt if necessary.

@SiobhyB SiobhyB added the Gutenberg Editing and display of Gutenberg blocks. label Jun 16, 2022
@SiobhyB SiobhyB changed the title Update expected number of blocks for gallery test [RNMobile] Update expected content for gallery tests Jun 16, 2022
@SiobhyB SiobhyB added the Testing Unit and UI Tests and Tooling label Jun 16, 2022
@SiobhyB SiobhyB changed the title [RNMobile] Update expected content for gallery tests [RNMobile] Update "testAddGalleryBlock" test case to reflect expected content for v1 of Gallery block Jun 16, 2022
@peril-wordpress-mobile
Copy link

Fails
🚫 Podfile: reference to a commit hash

Generated by 🚫 dangerJS

@wpmobilebot
Copy link
Contributor

You can test the changes in Jetpack from this Pull Request by:
  • Clicking here or scanning the QR code below to access App Center
  • Then installing the build number pr18898-befdcbe on your iPhone

If you need access to App Center, please ask a maintainer to add you.

@wpmobilebot
Copy link
Contributor

You can test the changes in WordPress from this Pull Request by:
  • Clicking here or scanning the QR code below to access App Center
  • Then installing the build number pr18898-befdcbe on your iPhone

If you need access to App Center, please ask a maintainer to add you.

@SiobhyB SiobhyB marked this pull request as ready for review June 16, 2022 17:36
@SiobhyB SiobhyB requested a review from dcalhoun June 16, 2022 17:36
Copy link
Member

@dcalhoun dcalhoun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The outline problem and solution make sense to me. Thank for addressing this. 🚀

@dcalhoun dcalhoun merged commit ecc9da9 into gutenberg/integrate_release_1.78.1 Jun 16, 2022
@dcalhoun dcalhoun deleted the gutenberg/update_gallery_tests branch June 16, 2022 19:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Gutenberg Editing and display of Gutenberg blocks. Testing Unit and UI Tests and Tooling
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants