sebaslogen / CleanGUITestArchitecture

Sample project of Android GUI test automation using Espresso, Cucumber and the Page Object Pattern
MIT License
137 stars 31 forks source link

Screenshots are no longer working #12

Closed nohe427 closed 7 years ago

nohe427 commented 7 years ago

I am trying to take a screenshot and get a failure error:

Feature Login in the application > Scenario User can login with valid user name and password[Pixel XL - 7.1.2] FAILED 
        java.lang.IllegalStateException: Got a context of class class android.app.ContextImpl and I don't know how to get the Activity from it
        at com.neoranga55.cleanguitestarchitecture.util.SpoonScreenshotAction.getActivity(SpoonScreenshotAction.java:82)
:app:connectedDebugAndroidTest FAILED
sebaslogen commented 7 years ago

Thanks for reporting. The problem seems that Context from views is no longer a reliable way to access the View's container Activity which is needed by screenshot library, Spoon.

I'll try to find a solution.

sebaslogen commented 7 years ago

I fixed the problem of getting the activity for screenshots and also new problems granting permissions to write images to the storage of the device.

All fixes should be working from commit: https://github.com/sebaslogen/CleanGUITestArchitecture/commit/9080ef6f4e6c4ec7941fb7fc9f4a10562eb23ba4