Skip to content
This repository was archived by the owner on Feb 4, 2025. It is now read-only.

Conversation

@malinajirka
Copy link
Contributor

This PR adds a clean up phase to testAutoSaveScheduledPost test. This tests schedules a post which needs to be trashed when the test finishes so it doesn't affect other tests => see an example how it can affect other tests below.

1. The ReleaseStack_PostTestWPCom#testAutoSaveScheduledPost test creates a post with future status
https://github.com/wordpress-mobile/WordPress-FluxC-Android/blob/69bd2a93ba1fe7f9f5024211497a4a39a99d9866/example/src/androidTest/java/org/wordpress/android/fluxc/release/ReleaseStack_PostTestWPCom.java#L673-L681
2. The post isn’t cleaned up at the end of the test
3. Once the tests run enough times, the first 20 posts fetched from the test site are all future status
4. A few comment tests rely on mFirstPost, which is the first published post
https://github.com/wordpress-mobile/WordPress-FluxC-Android/blob/69bd2a93ba1fe7f9f5024211497a4a39a99d9866/example/src/androidTest/java/org/wordpress/android/fluxc/release/ReleaseStack_CommentTestWPCom.java
5. The tests just fetch the post list once, in a batch of 20
6. At this point all 20 posts are future, none are publish, so mFirstPost is null, and the tests fail

To test:
Verify the post gets trashed.

@malinajirka malinajirka requested a review from aforcier October 21, 2019 12:33
@aforcier aforcier self-assigned this Oct 21, 2019
@aforcier
Copy link
Contributor

Confirmed scheduled posts on test site didn't increase after running all the ReleaseStack_PostTestWPCom tests.

:shipit:!

@aforcier aforcier merged commit e12e549 into develop Oct 21, 2019
@aforcier aforcier deleted the autosave-scheduled-post-cleanup branch October 21, 2019 14:33
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants