0

I am currently trying to automate the process of capturing screenshots of my app. The problem I am facing is, that Snapshot just creates some blank 2x2px Images like this one: iPhone 6 Screenshot

Yes, I have configured Snapshot in the setUp Method:

override func setUp() {
    super.setUp()
    app = XCUIApplication()
    setupSnapshot(app)
    app.launch()
}

My UITest method::

    func testExample() {
    //Screenshot
    snapshot("01Screen")

    let tablesQuery = app.tables
    tablesQuery.cells.element(boundBy: 0).tap()
    //Screenshot
    snapshot("02Screen")

    tablesQuery.cells.element(boundBy: 1).tap()
    //Screenshot
    snapshot("03Screen")
    app.navigationBars.buttons.element(boundBy: 0).tap()
    app.navigationBars.buttons.element(boundBy: 0).tap()


    tablesQuery.cells.element(boundBy: 2).tap()
    tablesQuery.cells.element(boundBy: 0).tap()
    //Screenshot
    snapshot("04Screen")
    app.navigationBars.buttons.element(boundBy: 0).tap()
    app.navigationBars.buttons.element(boundBy: 0).tap()
    app.navigationBars.buttons.element(boundBy: 0).tap()
}

Has anyone of you experienced the same problem? The UITest can be completed successfully on simulator and physical device.

Best regards schuetzii

EDIT:

I have found out, that this problem may associate with the fact, that I have included some pods. I have no idea how to solve this.

I did

fastlane init

and also

snapshot init

and copied the SnapshotHelper.swift to the UITest-Class. Have I missed anything? New screenshot from the web page, which generates fastlane by itself: Web page

schuetzi
  • 35
  • 5

1 Answers1

0

Okay I have solved this ridiculous problem by myself. It is currently not possible to use Cocoapods and Snapshot at the same time. If I use both I get 2x2px images. Now I have added the SDK's (Firebase and GoogleSignIn) by hand and everything runs smooth. There are no hints about how to use Snapshot with Pods, hopefully it will work one time.

schuetzi
  • 35
  • 5
  • 1
    I got a similar problem where my screenshot show up 3px x 3px but I doubt that it has anything to do with cocoapods since I use that extensively in my app. I took screenshot for iPhone SE, iPhone 8, iPhone 8+ and iPhone X and only the screenshots of iPhone X has this problem. I did some investigation and I actually can see fastlane captured the correct screenshot of iPhone X in the snapshot temp directory, but somehow in the process of copying to the destination it change to a 3x3 px image.. I am still investigating why. – Thomas Ling Mar 08 '18 at 20:13
  • Any updates to this? Just starting to prep for my first screenshots and was just searching to see if there was an "fastlane snapshot init swift" version like there is for fastlane init, and encountered this thread. – drew.. Dec 24 '18 at 20:32
  • 1
    A few months later, I made a similar project and I didn‘t have this problem. So I guess my issue got fixed, because I reported it to fastlane. Yes, this also works fine with Swift! :) Happy programming and a merry christmas – schuetzi Dec 24 '18 at 20:36
  • I can run fastlane snapshot and get proper screenshots but as yet no combination of efforts results in screenshots from a lane run. Every example i see on the web thus far stop after the fastlane snapshot effort. Frustrating! I see my Snapfile being accessed properly, and every param in the summary matches. Just nothing get done. Checking debug is showing the no image was found in the temp folders. Puzzled. – drew.. Dec 27 '18 at 01:34