Skip to content

Add/enhanced screenshots#9368

Merged
jkmassel merged 9 commits intodevelopfrom
add/enhanced-screenshots
Apr 9, 2019
Merged

Add/enhanced screenshots#9368
jkmassel merged 9 commits intodevelopfrom
add/enhanced-screenshots

Conversation

@jkmassel
Copy link
Copy Markdown
Contributor

@jkmassel jkmassel commented Mar 5, 2019

No description provided.

@peril-wordpress-mobile
Copy link
Copy Markdown

peril-wordpress-mobile bot commented Mar 5, 2019

Warnings
⚠️ PR has more than 500 lines of code changing. Consider splitting into smaller PRs if possible.

Generated by 🚫 dangerJS

@jkmassel jkmassel force-pushed the add/enhanced-screenshots branch 3 times, most recently from 362a254 to 8168ca0 Compare March 19, 2019 04:01
@jkmassel jkmassel requested review from JavonDavis and jtreanor and removed request for JavonDavis March 19, 2019 04:01
Use the new emulators and delete the old registry management code
@jkmassel jkmassel assigned jkmassel and unassigned jkmassel Mar 20, 2019
@jkmassel jkmassel added this to the 12.1 milestone Mar 20, 2019
@jkmassel jkmassel force-pushed the add/enhanced-screenshots branch 3 times, most recently from 735f244 to 4dc1138 Compare March 21, 2019 22:06
Gemfile.lock Outdated
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This is just for the purposes of reviewing this PR. Assuming we're happy with it, I can submit a new PR to adjust this for the tag, or can tag a new release in https://github.com/wordpress-mobile/release-toolkit

@jkmassel jkmassel force-pushed the add/enhanced-screenshots branch from 4dc1138 to d245068 Compare March 21, 2019 22:10
Fix a merge issue

Use the new screenshot filenames

Ignore tmp folder

Implement compositing adjustments

Remove unused imports
@jkmassel jkmassel force-pushed the add/enhanced-screenshots branch 3 times, most recently from 01a02e9 to 193b572 Compare March 21, 2019 22:41
@jkmassel jkmassel force-pushed the add/enhanced-screenshots branch from 6f60f27 to d10d321 Compare March 22, 2019 20:53
@jkmassel jkmassel marked this pull request as ready for review March 22, 2019 21:25
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm getting a compile error here, did you mean

Suggested change
this.__wpLogout();
this.wpLogout();

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ah – good catch! My bad.

That's fixed now, but the reason I brought in the old login / logout methods was because the new ones were failing for screenshots – in particular in other languages (Thai and Japanese seemed especially problematic). I spent some time with it and couldn't sort out why. I figured that could be something for a future PR?

WDYT?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Oh I meant to ask that, I'm not sure why they'd be failing, I actually didn't test on other languages so I'm not quite aware about what's happening, I'll look into it though thanks for pointing that out 👍🏽

@jkmassel jkmassel force-pushed the add/enhanced-screenshots branch from d10d321 to 173d132 Compare March 26, 2019 20:57
Copy link
Copy Markdown
Contributor

@JavonDavis JavonDavis left a comment

Choose a reason for hiding this comment

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

@jkmassel this looks good to go to me! I left a few comments around the login steps. I did give it a run myself and got the following error though

[18:23:36]: fastlane finished with errors

[!] Tests failed for locale de-DE on device emulator-5554

I'm thinking this might be something I'm missing with my emulators though right?

@@ -59,65 +55,112 @@ public void wPScreenshotTest() {
Screengrab.setDefaultScreenshotStrategy(new UiAutomatorScreenshotStrategy());

wpLogin();
Copy link
Copy Markdown
Contributor

@JavonDavis JavonDavis Mar 27, 2019

Choose a reason for hiding this comment

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

Small issue but this method doesn't check if the emulator isn't logged in already, is it worth doing that check here as well?

}

waitForRecyclerViewToStopReloading();
private void tmpWpLogout() {
Copy link
Copy Markdown
Contributor

@JavonDavis JavonDavis Mar 27, 2019

Choose a reason for hiding this comment

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

I think this will have a problem if the app was already signed in with a self-hosted account. I had to handle that differently

private void logout() {
boolean isSelfHosted = new MePage().go().isSelfHosted();
if (isSelfHosted) { // Logged in from self hosted connected
new MySitesPage().go().removeSite(E2E_SELF_HOSTED_USER_SITE_ADDRESS);
} else {
wpLogout();
}
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

For sure – as part of the screenshot generation, the device is wiped each time, so we don't need to worry about folks being signed in for this particular use case.

That said, probably a good case to handle for the general-purpose logout method.

Copy link
Copy Markdown
Contributor

@JavonDavis JavonDavis Mar 28, 2019

Choose a reason for hiding this comment

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

Cool! That also makes my previous note void as well 🙂

Copy link
Copy Markdown
Contributor

@JavonDavis JavonDavis left a comment

Choose a reason for hiding this comment

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

🚢

// a different thread than the UI, the UI sometimes reports completion of an operation before repainting the
// screen to reflect the change. Delaying by one frame ensures we're not taking a screenshot of a stale UI.
public static void waitOneFrame() {
idleFor(17);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Maybe give this some indentation? 😄

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done!


// Click in the post title editor and ensure the caret is at the end of the title editor
focusEditPostTitle();
// focusEditPostTitle();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why is this commented out? If its not needed anymore it would be nice to remove 👍

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good call – removed.

##### To adjust device parameters:

Edit the device in Android Studio, and adjust to the specifications you'd like to use. Once you save the device, it'll make a new hardware profile with the settings you just provided. Right-click on that hardware profile, and choose "export". When merging, it can be useful to use the diff view to ensure that only the fields you meant to change are actually being changed – as a for-instance, Android Studio loves to try to overwrite your `sdcard.size`, and that change can almost always be discarded.
Emulators can be entirely defined within their `.ini` file. Copying the `.ini` file into the correct directory (along with _another_ `.ini` file to point to it) is all that's needed – if it exists, the Android SDK will happily build a fresh new virtual device based on it.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It seems like the rebuild_screenshot_devices lane still exists for generating the devices. Is there more we can document about that here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Sure can (and sure have) – let me know if there's anything else you have questions about, and I'm happy to write it up!

@jtreanor jtreanor modified the milestones: 12.1 ❄️, 12.2 Apr 8, 2019
@jkmassel jkmassel merged commit 1f0e873 into develop Apr 9, 2019
@jkmassel jkmassel deleted the add/enhanced-screenshots branch April 9, 2019 20:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants