Java Code Examples for tools.fastlane.screengrab.Screengrab#screenshot()
The following examples show how to use
tools.fastlane.screengrab.Screengrab#screenshot() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BrowserScreenScreenshots.java From focus-android with Mozilla Public License 2.0 | 6 votes |
private void takeScreenshotOfFindDialog() throws Exception { UiObject findinpageMenuItem = device.findObject(new UiSelector() .resourceId(TestHelper.getAppName() + ":id/find_in_page") .enabled(true)); UiObject findinpageCloseBtn = device.findObject(new UiSelector() .resourceId(TestHelper.getAppName() + ":id/close_find_in_page") .enabled(true)); TestHelper.menuButton.perform(click()); findinpageMenuItem.waitForExists(waitingTime); findinpageMenuItem.click(); findinpageCloseBtn.waitForExists(waitingTime); Screengrab.screenshot("Find_In_Page_Dialog"); findinpageCloseBtn.click(); }
Example 2
Source File: TVScreenshots.java From firefox-echo-show with Mozilla Public License 2.0 | 5 votes |
@Test public void firstLaunchScreen() throws InterruptedException, UiObjectNotFoundException { mActivityTestRule.launchActivity(intent); // onView(withId(R.id.enable_turbo_mode)) // .check(matches(isDisplayed())); // onView(withId(R.id.turbo_mode_title)) // .check(matches(isDisplayed())); // onView(withId(R.id.disable_turbo_mode)) // .check(matches(isDisplayed())); Screengrab.screenshot("first-launch"); }
Example 3
Source File: NotificationScreenshots.java From focus-android with Mozilla Public License 2.0 | 5 votes |
@Test public void takeScreenshotOfNotification() throws Exception { onView(withId(R.id.urlView)) .check(matches(isDisplayed())) .check(matches(hasFocus())) .perform(click(), replaceText(webServer.url("/").toString()), pressImeActionButton()); onView(withId(R.id.display_url)) .check(matches(isDisplayed())) .check(matches(withText(containsString(webServer.getHostName())))); final UiObject openAction = device.findObject(new UiSelector() .descriptionContains(getString(R.string.notification_action_open)) .resourceId("android:id/action0") .enabled(true)); device.openNotification(); try { if (!openAction.waitForExists(waitingTime)) { // The notification is not expanded. Let's expand it now. device.findObject(new UiSelector() .text(getString(R.string.app_name))) .swipeDown(20); assertTrue(openAction.waitForExists(waitingTime)); } Screengrab.screenshot("DeleteHistory_NotificationBar"); } finally { // Close notification tray again device.pressBack(); } }
Example 4
Source File: FirstRunScreenshots.java From focus-android with Mozilla Public License 2.0 | 5 votes |
@Test public void takeScreenshotsOfFirstrun() throws UiObjectNotFoundException { onView(withText(R.string.firstrun_defaultbrowser_title)) .check(matches(isDisplayed())); device.waitForIdle(); SystemClock.sleep(5000); Screengrab.screenshot("Onboarding_1_View"); TestHelper.nextBtn.click(); assertTrue(device.findObject(new UiSelector() .text(getString(R.string.firstrun_search_title)) .enabled(true) ).waitForExists(waitingTime)); Screengrab.screenshot("Onboarding_2_View"); TestHelper.nextBtn.click(); assertTrue(device.findObject(new UiSelector() .text(getString(R.string.firstrun_shortcut_title)) .enabled(true) ).waitForExists(waitingTime)); Screengrab.screenshot("Onboarding_3_View"); TestHelper.nextBtn.click(); assertTrue(device.findObject(new UiSelector() .text(getString(R.string.firstrun_privacy_title)) .enabled(true) ).waitForExists(waitingTime)); Screengrab.screenshot("Onboarding_last_View"); }
Example 5
Source File: BrowserScreenScreenshots.java From focus-android with Mozilla Public License 2.0 | 5 votes |
private void takeScreenshotofSecureCon() throws Exception { // take the security info of google.com for https connection onView(withId(R.id.urlView)) .check(matches(isDisplayed())) .check(matches(hasFocus())) .perform(click(), replaceText("www.google.com"), pressImeActionButton()); TestHelper.waitForWebContent(); TestHelper.progressBar.waitUntilGone(waitingTime); TestHelper.securityInfoIcon.click(); TestHelper.identityState.waitForExists(waitingTime); Screengrab.screenshot("secure_connection"); device.pressBack(); }
Example 6
Source File: BrowserScreenScreenshots.java From focus-android with Mozilla Public License 2.0 | 5 votes |
private void takeScreenshotofInsecureCon() throws Exception { TestHelper.securityInfoIcon.click(); TestHelper.identityState.waitForExists(waitingTime); Screengrab.screenshot("insecure_connection"); device.pressBack(); }
Example 7
Source File: BrowserScreenScreenshots.java From focus-android with Mozilla Public License 2.0 | 5 votes |
private void takeAddToHomeScreenScreenshot() throws UiObjectNotFoundException { TestHelper.menuButton.perform(click()); TestHelper.AddtoHSmenuItem.waitForExists(waitingTime); TestHelper.AddtoHSmenuItem.click(); TestHelper.AddtoHSCancelBtn.waitForExists(waitingTime); Screengrab.screenshot("AddtoHSDialog"); TestHelper.AddtoHSCancelBtn.click(); }
Example 8
Source File: BrowserScreenScreenshots.java From focus-android with Mozilla Public License 2.0 | 5 votes |
private void takeScreenshotsOfOpenWithAndShare() throws Exception { /* Open_With View */ TestHelper.menuButton.perform(click()); UiObject openWithBtn = device.findObject(new UiSelector() .resourceId(TestHelper.getAppName() + ":id/open_select_browser") .enabled(true)); assertTrue(openWithBtn.waitForExists(waitingTime)); openWithBtn.click(); UiObject shareList = device.findObject(new UiSelector() .resourceId(TestHelper.getAppName() + ":id/apps") .enabled(true)); assertTrue(shareList.waitForExists(waitingTime)); Screengrab.screenshot("OpenWith_Dialog"); /* Share View */ UiObject shareBtn = device.findObject(new UiSelector() .resourceId(TestHelper.getAppName() + ":id/share") .enabled(true)); device.pressBack(); TestHelper.menuButton.perform(click()); assertTrue(shareBtn.waitForExists(waitingTime)); shareBtn.click(); TestHelper.shareAppList.waitForExists(waitingTime); Screengrab.screenshot("Share_Dialog"); device.pressBack(); }
Example 9
Source File: HomeScreenScreenshots.java From focus-android with Mozilla Public License 2.0 | 5 votes |
@Test public void takeScreenshotOfMenu() { TestHelper.menuButton.perform(click()); onView(withText(R.string.menu_whats_new)) .check(matches(isDisplayed())); Screengrab.screenshot("MainViewMenu"); }
Example 10
Source File: TVScreenshots.java From firefox-echo-show with Mozilla Public License 2.0 | 5 votes |
@Test public void unpinTileFromOverlay() throws InterruptedException, UiObjectNotFoundException { /* default home-screen in the main activity should be displayed */ mActivityTestRule.launchActivity(intent); // onView(allOf(withId(R.id.urlInputView), isDisplayed(), hasFocus())) // .perform(typeTextIntoFocusedView("example.com")) // .perform(pressImeActionButton()); onView(withId(R.id.webview)) .check(matches(isDisplayed())); mDevice.pressMenu(); // onView(withId(R.id.pinButton)) // .check(matches(isDisplayed())) // .perform(click()); onView(withText(R.string.notification_unpinned_site)) .inRoot(withDecorView(not(is(mActivityTestRule.getActivity().getWindow().getDecorView())))) .check(matches(isDisplayed())); Screengrab.screenshot("overlay-unpinned-tile"); mDevice.pressBack(); mDevice.pressBack(); }
Example 11
Source File: TVScreenshots.java From firefox-echo-show with Mozilla Public License 2.0 | 5 votes |
@Test public void pinTileFromOverlay() throws InterruptedException, UiObjectNotFoundException { /* default home-screen in the main activity should be displayed */ mActivityTestRule.launchActivity(intent); // onView(allOf(withId(R.id.urlInputView), isDisplayed(), hasFocus())) // .perform(typeTextIntoFocusedView("example.com")) // .perform(pressImeActionButton()); onView(withId(R.id.webview)) .check(matches(isDisplayed())); mDevice.pressMenu(); // onView(withId(R.id.pinButton)) // .check(matches(isDisplayed())) // .perform(click()); onView(withText(R.string.notification_pinned_site)) .inRoot(withDecorView(not(is(mActivityTestRule.getActivity().getWindow().getDecorView())))) .check(matches(isDisplayed())); Screengrab.screenshot("overlay-pinned-tile"); mDevice.pressBack(); mDevice.pressBack(); }
Example 12
Source File: HomeScreenScreenshots.java From focus-android with Mozilla Public License 2.0 | 5 votes |
@Test public void takeScreenshotOfTips() { for (TipTypes tip: TipTypes.values()) { onView(withId(R.id.urlView)) .check(matches(isDisplayed())) .check(matches(hasFocus())) .perform(click(), replaceText("l10n:tip:" + tip.value), pressImeActionButton()); onView(withId(R.id.homeViewTipsLabel)) .check(matches(isDisplayed())); Screengrab.screenshot("MainViewTip_" + tip.name()); } }
Example 13
Source File: HomeScreenScreenshots.java From focus-android with Mozilla Public License 2.0 | 5 votes |
@Test public void takeScreenshotOfHomeScreen() { onView(withId(R.id.urlView)) .check(matches(isDisplayed())) .check(matches(hasFocus())); SystemClock.sleep(5000); Screengrab.screenshot("Home_View"); }
Example 14
Source File: BaseScreenshotTest.java From hash-checker with Apache License 2.0 | 5 votes |
public void makeScreenshot( @NonNull String screenshotName ) { Screengrab.screenshot( screenshotName ); }
Example 15
Source File: ScreenshotTest.java From Anecdote with Apache License 2.0 | 4 votes |
@Test public void websiteChooserScreenshots() throws InterruptedException { Screengrab.screenshot("websiteChooserFragment1"); //progress dialog is now shown Thread.sleep(1500); onView(withId(R.id.recyclerView)).perform( RecyclerViewActions.actionOnItemAtPosition( 0, AnecdoteRecyclerViewAction.clickChildViewWithId(R.id.checkBox))); onView(withId(R.id.recyclerView)).perform( RecyclerViewActions.actionOnItemAtPosition( 1, AnecdoteRecyclerViewAction.clickChildViewWithId(R.id.checkBox))); onView(withId(R.id.recyclerView)).perform( RecyclerViewActions.actionOnItemAtPosition( 2, AnecdoteRecyclerViewAction.clickChildViewWithId(R.id.checkBox))); onView(withId(R.id.recyclerView)).perform( RecyclerViewActions.actionOnItemAtPosition( 4, AnecdoteRecyclerViewAction.clickChildViewWithId(R.id.checkBox))); Thread.sleep(300); Screengrab.screenshot("websiteChooserFragment2"); onView(withId(R.id.saveButton)).perform(click()); Thread.sleep(2000); Screengrab.screenshot("anecdote1"); // onView(allOf(withId(R.id.recyclerView), withClassName(endsWith("TextView")))).perform( // RecyclerViewActions.actionOnItemAtPosition( // 0, AnecdoteRecyclerViewAction.clickAnecdoteTextViewWithId(R.id.contentTextView))); onView(allOf(withId(R.id.recyclerView))).perform( RecyclerViewActions.actionOnItemAtPosition( 0, AnecdoteRecyclerViewAction.clickAnecdoteTextViewWithId(R.id.contentTextView))); Thread.sleep(500); Screengrab.screenshot("anecdoteCliked"); // Dump check Assert.assertEquals(1, 1); }
Example 16
Source File: JUnit4StyleTests.java From itracing2 with GNU General Public License v2.0 | 4 votes |
@Test public void testTakeScreenShot() { Screengrab.screenshot("hello"); }
Example 17
Source File: BrowserScreenScreenshots.java From focus-android with Mozilla Public License 2.0 | 4 votes |
private void takeScreenshotOfTabsTrayAndErase() throws Exception { final UiObject mozillaImage = device.findObject(new UiSelector() .resourceId("download") .enabled(true)); UiObject imageMenuTitle = device.findObject(new UiSelector() .resourceId(TestHelper.getAppName() + ":id/topPanel") .enabled(true)); UiObject openNewTabTitle = device.findObject(new UiSelector() .resourceId(TestHelper.getAppName() + ":id/design_menu_item_text") .text(getString(R.string.contextmenu_open_in_new_tab)) .enabled(true)); UiObject multiTabBtn = device.findObject(new UiSelector() .resourceId(TestHelper.getAppName() + ":id/tabs") .enabled(true)); UiObject eraseHistoryBtn = device.findObject(new UiSelector() .text(getString(R.string.tabs_tray_action_erase)) .enabled(true)); assertTrue(mozillaImage.waitForExists(waitingTime)); mozillaImage.dragTo(mozillaImage, 7); assertTrue(imageMenuTitle.waitForExists(waitingTime)); assertTrue(imageMenuTitle.exists()); Screengrab.screenshot("Image_Context_Menu"); //Open a new tab openNewTabTitle.click(); TestHelper.mDevice.wait(Until.findObject( By.res(TestHelper.getAppName(), "snackbar_text")), 5000); Screengrab.screenshot("New_Tab_Popup"); TestHelper.mDevice.wait(Until.gone( By.res(TestHelper.getAppName(), "snackbar_text")), 5000); assertTrue(multiTabBtn.waitForExists(waitingTime)); multiTabBtn.click(); assertTrue(eraseHistoryBtn.waitForExists(waitingTime)); Screengrab.screenshot("Multi_Tab_Menu"); eraseHistoryBtn.click(); device.wait(Until.findObject( By.res(TestHelper.getAppName(), "snackbar_text")), waitingTime); Screengrab.screenshot("YourBrowsingHistoryHasBeenErased"); }
Example 18
Source File: TVScreenshots.java From firefox-echo-show with Mozilla Public License 2.0 | 4 votes |
@Test public void settingsView() throws InterruptedException, UiObjectNotFoundException { /* default home-screen in the main activity should be displayed */ mActivityTestRule.launchActivity(intent); // onView(allOf(withId(R.id.urlInputView), isDisplayed(), hasFocus())); // // /* visit settings */ // onView(allOf(withId(R.id.settingsButton), isDisplayed())) // .perform(click()); // // /* current settings list view */ // onView(allOf(withId(R.id.container), isDisplayed())); // // ViewInteraction clearButton = onView( // allOf(withId(R.id.deleteButton), isDisplayed())); /* capture a screenshot of the default settings list */ Screengrab.screenshot("settings"); /* capture a screenshot of the clear data dialog */ // clearButton.perform(click()); // ViewInteraction confirmClear = onView( // allOf(withText(R.string.settings_cookies_dialog_content), isDisplayed())) // .inRoot(isDialog()); // // Screengrab.screenshot("clear-all-data"); // // confirmClear.perform(pressBack()); /* capture a screenshot of the privacy notice */ // onView(allOf(withId(R.id.privacyNoticeButton), isDisplayed())) // .perform(click()); onView(allOf(withId(R.id.webview), isDisplayed())); Screengrab.screenshot("privacy-notice"); mDevice.pressBack(); // onView(allOf(withId(R.id.aboutButton), isDisplayed())) // .perform(click()); onView(allOf(withId(R.id.webview), isDisplayed())); Screengrab.screenshot("about-screen"); mDevice.pressBack(); }
Example 19
Source File: ScreenshotTest.java From focus-android with Mozilla Public License 2.0 | 4 votes |
@Override protected void failed(Throwable e, Description description) { // On error take a screenshot so that we can debug it easily Screengrab.screenshot("FAILURE-" + getScreenshotName(description)); }
Example 20
Source File: AllowListScreenshots.java From focus-android with Mozilla Public License 2.0 | 4 votes |
@Test public void takeScreenshotsOfMenuandAllowlist() throws UiObjectNotFoundException { SystemClock.sleep(5000); onView(withId(R.id.urlView)) .check(matches(isDisplayed())) .check(matches(hasFocus())) .perform(click(), replaceText(webServer.url("/").toString())); onView(withId(R.id.urlView)) .check(matches(isDisplayed())) .check(matches(hasFocus())) .perform(pressImeActionButton()); device.findObject(new UiSelector() .resourceId(TestHelper.getAppName() + ":id/webview") .enabled(true)) .waitForExists(waitingTime); TestHelper.menuButton.perform(click()); Screengrab.screenshot("BrowserViewMenu"); onView(withId(R.id.blocking_switch)).perform(click()); // Open setting onView(withId(R.id.menuView)) .check(matches(isDisplayed())) .perform(click()); onView(withId(R.id.settings)) .check(matches(isDisplayed())) .perform(click()); onView(withText(R.string.preference_privacy_and_security_header)).perform(click()); UiScrollable settingsView = new UiScrollable(new UiSelector().scrollable(true)); if (settingsView.exists()) { // On tablet, this will not be found settingsView.scrollToEnd(5); onView(withText(R.string.preference_exceptions)).perform(click()); } onView(withId(R.id.removeAllExceptions)) .check(matches(isDisplayed())); Screengrab.screenshot("ExceptionsDialog"); onView(withId(R.id.removeAllExceptions)) .perform(click()); }