Skip to content
This repository has been archived by the owner on Jun 20, 2023. It is now read-only.

Improve screenshots testing(DEV) #2461

Merged
merged 7 commits into from
Feb 26, 2021

Conversation

mtwalli
Copy link
Contributor

@mtwalli mtwalli commented Feb 25, 2021

It looks like Screenshots is becoming an important feature for our project.
A question was raised by @LukasLechnerDev here

on how to test that without adding firebase_screenshots to the flow?

I thought 馃挱 that might we need a solution that we can use during the implementation phase before even pushing to GitHub.
Here it is:

  • Added a flag so you can you execute the test locally from Android Studio or command line

How?

1- From Android Studio edit the configuration and your test parameters:
Screenshot 2021-02-25 at 15 22 28

2- From the command line:

$ adb shell am instrument -w -m -e androidStudioMode true -e annotation testhelper.Screenshot   -e debug false -e class 'de.rki.coronawarnapp.ui.main.MainActivityTest' de.rki.coronawarnapp.test.test/testhelpers.TestApplicationUIRunner

@mtwalli mtwalli requested a review from a team February 25, 2021 08:47
@LukasLechnerDev LukasLechnerDev self-assigned this Feb 25, 2021
@harambasicluka harambasicluka added the maintainers Tag pull requests created by maintainers label Feb 25, 2021
@harambasicluka harambasicluka added this to the 1.14.0 milestone Feb 25, 2021
@LukasLechnerDev
Copy link
Contributor

Hi! Thanks for this! This is really helpful when extending / adapting our screenshots.

I have an idea how we could further improve this so that we don't need to change actual code during development:
We could add an instrumentation param like "testMode" in the Run Configuration of a test or TestClass in Android Studio whenever we want to store a screenshot on the sdcard:

image

Then, in our function that takes the screenshot, we could have something like this:

image

So without this Instrumentation param, our screenshots are taken as usual, but when a developer sets the param, they are stored on the sdcard.

What do you think?

@mtwalli
Copy link
Contributor Author

mtwalli commented Feb 25, 2021

Hi! Thanks for this! This is really helpful when extending / adapting our screenshots.

I have an idea how we could further improve this so that we don't need to change actual code during development:
We could add an instrumentation param like "testMode" in the Run Configuration of a test or TestClass in Android Studio whenever we want to store a screenshot on the sdcard:

image

Then, in our function that takes the screenshot, we could have something like this:

image

So without this Instrumentation param, our screenshots are taken as usual, but when a developer sets the param, they are stored on the sdcard.

What do you think?

This was my first thought, if you like this way, I can simplify this even further. Wait for my commit below 猬囷笍

@LukasLechnerDev
Copy link
Contributor

Yes, I like it very much 馃憤 ! We also have to write it in our Wiki so the other Devs know this "trick" too 馃槈

@mtwalli
Copy link
Contributor Author

mtwalli commented Feb 25, 2021

Yes, I like it very much 馃憤 ! We also have to write it in our Wiki so the other Devs know this "trick" too 馃槈

Done: https://teams.microsoft.com/l/entity/com.microsoft.teamspace.tab.wiki/tab::32332847-46cb-4995-a3eb-e183b8c68f28?context=%7B%22subEntityId%22%3A%22%7B%5C%22pageId%5C%22%3A6%2C%5C%22sectionId%5C%22%3A66%2C%5C%22origin%5C%22%3A2%7D%22%2C%22channelId%22%3A%2219%3Ac51bf302889a44e28119b0efc59b8f7d%40thread.tacv2%22%7D&tenantId=42f7676c-f455-423c-82f6-dc2d99791af7

Copy link
Contributor

@LukasLechnerDev LukasLechnerDev left a comment

Choose a reason for hiding this comment

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

LGTM! Tested it for the screenshot adaptions for the contact diary extension and works really nice. Great PR :)

@ralfgehrer ralfgehrer added the prio PRs to review first. label Feb 26, 2021
@sonarcloud
Copy link

sonarcloud bot commented Feb 26, 2021

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@ralfgehrer ralfgehrer merged commit e1a3113 into release/1.14.x Feb 26, 2021
@ralfgehrer ralfgehrer deleted the dev/improve-screenshots-testing branch February 26, 2021 09:00
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
maintainers Tag pull requests created by maintainers prio PRs to review first.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants