Skip to content

Instantly share code, notes, and snippets.

<?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];
- (void)testOpenGalleryAndCancel {
[[app_ buttons][[SHAStrings galleryButtonTitleString]] tap];
[[[[[app_ navigationBars][@"Photos"] childrenMatchingType:XCUIElementTypeButton]
matchingIdentifier:@"Cancel"] elementBoundByIndex:0] tap];
// Should be at Home Page.
[self verifyHomePageButtons];
}
- (void)testOpenInspireView {
[[app_ buttons][[SHAStrings inspireButtonTitleString]] tap];
// Verify page load by checking the title.
XCUIElement *title = [app_ otherElements][@"Show and Hide"];
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"exists == 1"];
[self expectationForPredicate:predicate evaluatedWithObject:title handler:nil];
[self waitForExpectationsWithTimeout:2.0 handler:nil];
// Go back.