This repository has been archived by the owner on Apr 17, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 111
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Disable Pocket related tests Convert SettingTest (screenshot) to Java for Fastlane compatibility
- Loading branch information
No Jun Park
committed
Apr 24, 2019
1 parent
d2de3fb
commit 549bed4
Showing
9 changed files
with
198 additions
and
89 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
75 changes: 75 additions & 0 deletions
75
app/src/androidTest/java/org/mozilla/tv/firefox/ui/screenshots/SettingsTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
/* -*- Mode: Java; c-basic-offset: 4; tab-width: 20; indent-tabs-mode: nil; -*- | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
package org.mozilla.tv.firefox.ui.screenshots; | ||
|
||
import androidx.test.platform.app.InstrumentationRegistry; | ||
import androidx.test.rule.ActivityTestRule; | ||
import androidx.test.uiautomator.UiDevice; | ||
|
||
import org.junit.After; | ||
import org.junit.ClassRule; | ||
import org.junit.Rule; | ||
import org.junit.Test; | ||
import org.mozilla.tv.firefox.MainActivity; | ||
import org.mozilla.tv.firefox.R; | ||
import org.mozilla.tv.firefox.helpers.MainActivityTestRule; | ||
|
||
import tools.fastlane.screengrab.Screengrab; | ||
import tools.fastlane.screengrab.locale.LocaleTestRule; | ||
|
||
import static androidx.test.espresso.Espresso.onView; | ||
import static androidx.test.espresso.action.ViewActions.click; | ||
import static androidx.test.espresso.assertion.ViewAssertions.matches; | ||
import static androidx.test.espresso.matcher.ViewMatchers.isDisplayed; | ||
import static androidx.test.espresso.matcher.ViewMatchers.withId; | ||
|
||
|
||
public class SettingsTest extends ScreenshotTest { | ||
|
||
private UiDevice mDevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation()); | ||
|
||
@ClassRule | ||
public static final LocaleTestRule localeTestRule = new LocaleTestRule(); | ||
|
||
@Rule | ||
public ActivityTestRule<MainActivity> mActivityTestRule = new MainActivityTestRule(); | ||
|
||
@After | ||
public void tearDown() { | ||
mActivityTestRule.getActivity().finishAndRemoveTask(); | ||
} | ||
|
||
@Test | ||
public void showSettingsViews() throws InterruptedException { | ||
onView(withId(R.id.navUrlInput)).check(matches(isDisplayed())); | ||
|
||
// current settings list view | ||
onView(withId(R.id.container_web_render)).check(matches(isDisplayed())); | ||
|
||
// This will need to change if the button layout changes. However, such layout | ||
// changes are infrequent, and updating this will be easy. | ||
device.pressDPadDown(); | ||
device.pressDPadDown(); | ||
device.pressDPadDown(); | ||
device.pressDPadDown(); | ||
|
||
onView(withId(R.id.settings_tile_telemetry)).check(matches(isDisplayed())); | ||
|
||
// capture a screenshot of the default settings list | ||
Screengrab.screenshot("settings"); | ||
|
||
onView(withId(R.id.settings_tile_telemetry)).perform(click()); | ||
takeScreenshotsAfterWait("send-usage-data", 5000); | ||
mDevice.pressBack(); | ||
|
||
onView(withId(R.id.settings_tile_cleardata)).perform(click()); | ||
takeScreenshotsAfterWait("clear-all-data", 5000); | ||
mDevice.pressBack(); | ||
onView(withId(R.id.settings_tile_about)).perform(click()); | ||
takeScreenshotsAfterWait("about-screen", 5000); | ||
mDevice.pressBack(); | ||
} | ||
} |
64 changes: 0 additions & 64 deletions
64
app/src/androidTest/java/org/mozilla/tv/firefox/ui/screenshots/SettingsTest.kt
This file was deleted.
Oops, something went wrong.
95 changes: 95 additions & 0 deletions
95
app/src/androidTest/java/org/mozilla/tv/firefox/ui/screenshots/TooltipCaptureTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
/* -*- Mode: Java; c-basic-offset: 4; tab-width: 20; indent-tabs-mode: nil; -*- | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
package org.mozilla.tv.firefox.ui.screenshots; | ||
|
||
import androidx.test.espresso.contrib.RecyclerViewActions; | ||
import androidx.test.rule.ActivityTestRule; | ||
import androidx.test.uiautomator.By; | ||
import androidx.test.uiautomator.Until; | ||
|
||
import org.junit.After; | ||
import org.junit.ClassRule; | ||
import org.junit.Rule; | ||
import org.junit.Test; | ||
import org.mozilla.tv.firefox.MainActivity; | ||
import org.mozilla.tv.firefox.R; | ||
import org.mozilla.tv.firefox.helpers.MainActivityTestRule; | ||
|
||
import tools.fastlane.screengrab.locale.LocaleTestRule; | ||
|
||
import static androidx.test.espresso.Espresso.onView; | ||
import static androidx.test.espresso.action.ViewActions.click; | ||
import static androidx.test.espresso.assertion.ViewAssertions.matches; | ||
import static androidx.test.espresso.matcher.RootMatchers.isPlatformPopup; | ||
import static androidx.test.espresso.matcher.ViewMatchers.hasFocus; | ||
import static androidx.test.espresso.matcher.ViewMatchers.isDisplayed; | ||
import static androidx.test.espresso.matcher.ViewMatchers.withId; | ||
import static org.hamcrest.Matchers.allOf; | ||
|
||
public class TooltipCaptureTest extends ScreenshotTest { | ||
|
||
@ClassRule | ||
public static final LocaleTestRule localeTestRule = new LocaleTestRule(); | ||
|
||
@Rule | ||
public ActivityTestRule<MainActivity> mActivityTestRule = new MainActivityTestRule(); | ||
|
||
@After | ||
public void tearDown() { | ||
mActivityTestRule.getActivity().finishAndRemoveTask(); | ||
} | ||
|
||
@Test | ||
public void showToolTips() throws InterruptedException { | ||
|
||
onView(allOf(withId(R.id.navUrlInput), hasFocus())).check(matches(isDisplayed())); | ||
onView(withId(R.id.tileContainer)).check(matches(isDisplayed())); | ||
|
||
// open two sites to enable back and front button | ||
onView(withId(R.id.tileContainer)).perform(RecyclerViewActions.actionOnItemAtPosition(1, click())); | ||
device.wait(Until.findObject(By.res(Integer.toString(R.id.progressAnimation))), 2000); | ||
device.pressMenu(); | ||
onView(withId(R.id.tileContainer)).perform(RecyclerViewActions.actionOnItemAtPosition(2, click())); | ||
device.wait(Until.findObject(By.res(Integer.toString(R.id.progressAnimation))), 2000); | ||
|
||
device.pressMenu(); | ||
device.pressDPadUp(); | ||
onView(withId(R.id.tooltip)).inRoot(isPlatformPopup()).check(matches(isDisplayed())); | ||
takeScreenshotsAfterWait("tooltip-backbutton", 500); | ||
|
||
onView(withId(R.id.navButtonBack)).perform(click()); | ||
device.wait(Until.findObject(By.res(Integer.toString(R.id.progressAnimation))), 2000); | ||
device.pressMenu(); | ||
device.pressDPadUp(); | ||
device.pressDPadRight(); // In fastlane, back button is still enabled - this might be fastlane issue | ||
|
||
// forward button | ||
onView(withId(R.id.tooltip)).inRoot(isPlatformPopup()).check(matches(isDisplayed())); | ||
takeScreenshotsAfterWait("tooltip-forwardbutton", 500); | ||
device.pressDPadRight(); | ||
onView(withId(R.id.tooltip)).inRoot(isPlatformPopup()).check(matches(isDisplayed())); | ||
takeScreenshotsAfterWait("tooltip-reload", 500); | ||
device.pressDPadRight(); | ||
onView(withId(R.id.tooltip)).inRoot(isPlatformPopup()).check(matches(isDisplayed())); | ||
takeScreenshotsAfterWait("tooltip-pintohs", 500); | ||
device.pressDPadRight(); | ||
onView(withId(R.id.tooltip)).inRoot(isPlatformPopup()).check(matches(isDisplayed())); | ||
takeScreenshotsAfterWait("tooltip-turbomode", 500); | ||
device.pressDPadRight(); | ||
onView(withId(R.id.tooltip)).inRoot(isPlatformPopup()).check(matches(isDisplayed())); | ||
takeScreenshotsAfterWait("tooltip-requestdesktop", 500); | ||
device.pressDPadRight(); | ||
onView(withId(R.id.tooltip)).inRoot(isPlatformPopup()).check(matches(isDisplayed())); | ||
takeScreenshotsAfterWait("tooltip-exit", 500); | ||
device.pressDPadRight(); | ||
onView(withId(R.id.tooltip)).inRoot(isPlatformPopup()).check(matches(isDisplayed())); | ||
takeScreenshotsAfterWait("tooltip-settings", 500); | ||
device.pressDPadLeft(); | ||
device.pressDPadLeft(); | ||
device.pressDPadCenter(); | ||
takeScreenshotsAfterWait("desktoprequested", 500); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters