1

エスプレッソUIテストに添付されているスクリーンショットのように、com.google.android.gms:id/cancel(テキスト "上記のテキストなし")のGoogleダイアログのクリックを処理するにはどうすればよいですか? [\Sign in screenshot]GoogleポップアップエスプレッソAndroidスタジオ2.2

+0

下の例を参照してくださいには、このダイアログを開いて、クリックすることが必要ですか?もしエスプレッソが意図を捕らえ、スタッブされた答えを提供できなければ。 https://google.github.io/android-testing-support-library/docs/espresso/intents/ – nenick

答えて

0

あなたは、私がGitHubで例を作っwithText

onView(withText("None of the above")).perform(click()); 

を使用することができ、 あなたはより多くの明確化が必要な場合は、私に教えてください。

+0

これはエスプレッソライブラリとは動作しません:onView(withId(android.R.id.cancel))。perform(クリック()); –

+0

[withText](https://developer.android.com/reference/android/support/test/espresso/matcher/ViewMatchers.html#withText(org.hamcrest.Matcher%3Cjava.lang.String%3E))を使用できます。 ) – Cabezas

0

この場合、このフレームワークの制限により、Espressoが正しく動作しないことがあります。 uiautomatorというGoogleの標準的な計測ツールを使用してそれを達成してください。それはEspressoと一緒に素晴らしい作品です。

チェック:http://qathread.blogspot.com/2015/05/espresso-uiautomator-perfect-tandem.html

あなたはまた、EspressoとともにRobotiumと呼ばれるオープンソースのUI自動化ツールを使用しようとすることができます。

チェック:あなたは通知を確認することができませんので、あなたは、テスト・コンテキストの下にアプリ内でのみ動作するために許可されているだけEspresso使用https://github.com/codepath/android_guides/wiki/UI-Testing-with-Robotium

、ポップアップダイアログの大部分またはexisitngから別のアプリを実行しているとの両方をcheking。

は、それが

1

これらのアカウントチューダイアログがテストアプリケーションの範囲外であるのに役立ちます願っています。エスプレッソはこれらのUI要素を処理できません。

uiautomatorEspressoの一部として使用することができます。

@RunWith(AndroidJUnit4.class) 
public class SocialLoginTest { 
private UiDevice mUiDevice; 

@Before 
public void before() throws Exception { 
    mUiDevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation()); 
} 

@Test 
public void someTest() throws Exception { 
    //Launch activity 
    //Simulate a Click on the button in your activity that triggers account chooser dialog. 

    UiObject mText = mUiDevice.findObject(new UiSelector().text("NONE OF THE ABOVE")); 
    mText.click(); 
    //Assertions for results handled in your application 
} 
+0

ありがとうございました!私はそれを試し、その結果を返信します。 –

関連する問題