Skip to content

Instantly share code, notes, and snippets.

@Test
public void testLaunchActivity() {
onView(withId(R.id.home_camera_button)).check(matches(withText("Camera")));
onView(withId(R.id.home_gallery_button)).check(matches(withText("Gallery")));
onView(withId(R.id.home_inspire_button)).check(matches(withText("Inspire")));
}
imageView.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View view, MotionEvent event) {
originalImageView.setVisibility(event.getAction() == MotionEvent.ACTION_DOWN ?
View.VISIBLE : View.GONE);
return true;
}
});
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/processed_image_background">
<ImageView
android:id="@+id/processed_image"
android:layout_width="match_parent"
android:layout_height="match_parent"
@catehstn
catehstn / ProcessImageTest.m
Created November 26, 2015 18:17
KIF tests for V1 UI
#import "ProcessImageTest.h"
#import "SHAStrings.h"
@interface ProcessImageTest ()
// Dismiss the gallery once it has been opened.
- (void)cancelGallery;
// Sequence that results in two pictures in the results view.
- (void)choosePictureAndProcessSequence;
// Sequence that results in a picture in the edit view.
- (void)testShare {
[[app_ buttons][[SHAStrings galleryButtonTitleString]] tap];
[[[app_ tables] buttons][@"Moments"] tap];
[[[app_ collectionViews] cells][@"Photo, Landscape, August 08, 2012, 7:52 PM"] tap];
[self verifyEditPageButtonsVisible];
XCUIElement *editNavigationBar = app_.navigationBars[@"Edit"];
[editNavigationBar.buttons[@"share"] tap];
[[[app_ sheets] buttons][@"Cancel"] tap];
- (void)testSwipe {
[[app_ buttons][[SHAStrings galleryButtonTitleString]] tap];
[[[app_ tables] buttons][@"Moments"] tap];
[[[app_ collectionViews] cells][@"Photo, Landscape, August 08, 2012, 7:52 PM"] tap];
[self verifyEditPageButtonsVisible];
XCUIElement *element = [[[app_ scrollViews] childrenMatchingType:XCUIElementTypeOther] element];
XCUIElement *imageButton = [[[element childrenMatchingType:XCUIElementTypeOther]
elementBoundByIndex:0] buttons][[SHAStrings processedImageA11yLabel]];
[imageButton pressForDuration:1];
- (void)testChangeImageFromEditPage {
[[app_ buttons][[SHAStrings galleryButtonTitleString]] tap];
[[[app_ tables] buttons][@"Moments"] tap];
[[[app_ collectionViews] cells][@"Photo, Landscape, August 08, 2012, 7:52 PM"] tap];
[self verifyEditPageButtonsVisible];
XCUIElement *navBar = [app_ navigationBars][[SHAStrings imageEditingViewControllerTitle]];
[[navBar buttons][[SHAStrings galleryButtonA11yLabel]] tap];
[[[app_ tables] buttons][@"Camera Roll"] tap];
[[[app_ collectionViews] cells][@"Photo, Landscape, March 12, 2011, 4:17 PM"] tap];
- (void)testChangeAccuracySlider {
[[app_ buttons][[SHAStrings galleryButtonTitleString]] tap];
[[[app_ tables] buttons][@"Moments"] tap];
[[[app_ collectionViews] cells][@"Photo, Landscape, August 08, 2012, 7:52 PM"] tap];
XCUIElement *slider = [app_ sliders][[SHAStrings accuracySliderA11yLabel]];
[slider tap];
// Go back to Home Page.
[[[[[app_ navigationBars][@"Edit"] childrenMatchingType:XCUIElementTypeButton]
- (void)testChooseImageAndRotate {
XCUIDevice *device = [XCUIDevice sharedDevice];
[[app_ buttons][[SHAStrings galleryButtonTitleString]] tap];
[[[app_ tables] buttons][@"Moments"] tap];
[[[app_ collectionViews] cells][@"Photo, Landscape, August 08, 2012, 7:52 PM"] tap];
[self verifyEditPageButtonsVisible];
[device setOrientation:UIDeviceOrientationLandscapeRight];
- (void)testChooseImageAndGoBack {
[[app_ buttons][[SHAStrings galleryButtonTitleString]] tap];
[[[app_ tables] buttons][@"Moments"] tap];
[[[app_ collectionViews] cells][@"Photo, Landscape, August 08, 2012, 7:52 PM"] tap];
[self verifyEditPageButtonsVisible];
// Go back to Home Page.
[[[[[app_ navigationBars][@"Edit"] childrenMatchingType:XCUIElementTypeButton]
matchingIdentifier:@"Back"] elementBoundByIndex:0] tap];
[self verifyHomePageButtons];