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

Screenshots are all the same - only the 1st screenshot is kept for each test #507

Open
eric-grab opened this issue Dec 20, 2017 · 6 comments

Comments

@eric-grab
Copy link
Contributor

eric-grab commented Dec 20, 2017

I've already look at #384 but it's not helpful.

screen shot 2017-12-20 at 5 14 53 pm

My code:

@Test
    public void testInProgressTab() {
        Activity activity = activityTestRule.getActivity();
        Spoon.screenshot(activity, "InProgres-one");
        onView(withText(R.string.menu_incentives)).check(matches(isDisplayed()));
        onView(withText(R.string.in_progress)).check(matches(isDisplayed()));
        onView(withText(R.string.ended)).check(matches(isDisplayed()));
        onView(withText(R.string.active_now)).check(matches(isDisplayed()));
        onView(allOf(withId(R.id.rv_scorecards), isDisplayed())).perform(RecyclerViewActions.scrollToPosition(12));
        Spoon.screenshot(activity, "InProgres-two");// this one is not kept!
        onView(withText(R.string.everything_else)).check(matches(isDisplayed()));
    }

When I comment out the first Spoon.screenshot() then I got the 2nd screenshot correctly.

I'm using:

  • Android Gradle plugin 3.0.1
  • Spoon 1.7.1
  • com.jaredsburrows:gradle-spoon-plugin:1.2.0
@jaredsburrows
Copy link
Contributor

See this previous issue here: #498. Also, you need to use "single instrumentation" to get Spoon to generate the reports correctly: stanfy/spoon-gradle-plugin#161 (comment).

@eric-grab
Copy link
Contributor Author

Thanks for replying @jaredsburrows , I've already used singleInstrumentationCall = true. That solved 1 problem (only 1 test got screenshots ==> all tests got screenshots)
However, within 1 test like my example above, all the screenshots are the same as the first one!

@jaredsburrows
Copy link
Contributor

@eric-grab Yeah, sadly I think spoon 2 has problems. Ideally, you probably only need the screenshots of the tests that have failed right?

@eric-grab
Copy link
Contributor Author

hi @jaredsburrows

you probably only need the screenshots of the tests that have failed right?

serves the purpose of the debugging, yes

However, I need all the screenshots for all the steps to

  • Prove that my component (a few user flows involving a few screens) sanity tests actually cover what it's supposed to cover
  • Visualise the screens to help me write tests faster compared to imagining them in my mind
  • Provide screenshots to product managers, marketing team etc. for as presentation materials

@jaredsburrows
Copy link
Contributor

@eric-grab Makes a lot of since. I am not sure about the screenshot work around. We might have to find another solution or wait for Spoon 2 to be released. I was looking into this recently:

Repo: https://github.com/medisafe/run-android-tests

See: https://medium.com/medisafe-tech-blog/running-android-ui-tests-part-2-15ef08056d94 and https://github.com/medisafe/run-android-tests/issues/1#issuecomment-321196601 and

@MFrat

This comment has been minimized.

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

No branches or pull requests

3 participants