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

VideoPress block: Add tests to verify Privacy and Rating settings #5754

Merged
merged 12 commits into from
May 17, 2023

Conversation

SiobhyB
Copy link
Contributor

@SiobhyB SiobhyB commented May 10, 2023

Part of the coverage efforts outlined in #5734

Description

To test:

  • Verify the HTML the changes to the snapshot file matches with the reality of what the block's HTML would look after making the relevant changes.
  • Run the TEST_RN_PLATFORM=ios npm run test src/test/videopress/edit.js and TEST_RN_PLATFORM=android npm run test src/test/videopress/edit.js commands from the terminal to verify the tests pass as expected. Also, verify the tests on this PR pass.

PR submission checklist:

  • I have considered adding unit tests where possible.
  • I have considered if this change warrants user-facing release notes more info and have added them to RELEASE-NOTES.txt if necessary.

@SiobhyB SiobhyB changed the title Add/videopress rating and setting tests VideoPress block: Add tests to verify Privacy and Rating settings May 10, 2023
@SiobhyB SiobhyB self-assigned this May 10, 2023
@SiobhyB SiobhyB added the Testing Anything related to automated tests label May 10, 2023
@SiobhyB SiobhyB changed the base branch from trunk to add/videopress-setting-tests May 10, 2023 14:44
@peril-wordpress-mobile
Copy link

peril-wordpress-mobile bot commented May 10, 2023

Wanna run full suite of Android and iOS UI tests? Click here and 'Approve' CI job!

@SiobhyB SiobhyB marked this pull request as ready for review May 10, 2023 15:15
@SiobhyB SiobhyB requested review from jhnstn and fluiddot May 10, 2023 15:15
src/test/videopress/local-helpers/utils.js Outdated Show resolved Hide resolved
@@ -17,6 +17,10 @@ export const PLAYBACK_SETTINGS = [

export const PLAYBACK_BAR_COLOR_SETTINGS = [ 'Dynamic color' ];

export const RATING_OPTIONS = [ 'G', 'PG-13', 'R' ];

export const PRIVACY_OPTIONS = [ 'Site default (Public)', 'Public', 'Private' ];
Copy link
Contributor

Choose a reason for hiding this comment

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

The first privacy option (Site default (Public)) can also be Site default (Private) if the site is private. I'm wondering if it would be worth adding a test case for this, WDYT? Note that it would require mocking the hook or the fetch request that returns the site privacy value.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think that's a great idea! I looked a bit into what was needed and see that it would involve mocking the useSyncMedia hook in order to get the privateEnabledForSite value, like here. I think that would be easier to get working when that hook has been mocked for testing the syncing, so will make a note to follow up with a different PR after that. :)

src/test/videopress/edit.js Show resolved Hide resolved
Base automatically changed from add/videopress-setting-tests to trunk May 15, 2023 09:55
@SiobhyB
Copy link
Contributor Author

SiobhyB commented May 16, 2023

Closing, as discussed in #5754 (comment). Edit: Wrong PR! 🤦‍♀️

@SiobhyB SiobhyB closed this May 16, 2023
@SiobhyB SiobhyB deleted the add/videopress-rating-and-setting-tests branch May 16, 2023 10:35
@SiobhyB SiobhyB restored the add/videopress-rating-and-setting-tests branch May 16, 2023 10:41
@SiobhyB SiobhyB reopened this May 16, 2023
Copy link
Contributor

@fluiddot fluiddot left a comment

Choose a reason for hiding this comment

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

Awesome work @SiobhyB 🏅 ! LGTM 🎊 !

gutenberg Outdated Show resolved Hide resolved
jetpack Outdated Show resolved Hide resolved
src/test/videopress/edit.js Show resolved Hide resolved
@SiobhyB SiobhyB enabled auto-merge May 17, 2023 10:53
@SiobhyB SiobhyB merged commit 26dfd76 into trunk May 17, 2023
@SiobhyB SiobhyB deleted the add/videopress-rating-and-setting-tests branch May 17, 2023 11:27
@fluiddot fluiddot mentioned this pull request May 26, 2023
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Testing Anything related to automated tests VideoPress block
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants