Skip to content

Latest commit

 

History

History
44 lines (25 loc) · 1.68 KB

WRITING_TESTS.md

File metadata and controls

44 lines (25 loc) · 1.68 KB

Writing test code

This plugin makes it very easy to configure your project to use a test file - but you still have to write those tests yourself.

iOS

When you open up Xcode and open the file ionic-screen-shots/ui-snapshots.swift you will see something like this:

    func testSnapshots() {

        //
        // Place your own tests here. This is a starter example to get you going..
        //
        snapshot("app-launch")

        // XCUIApplication().buttons["Your Button Name"].tap()

        // snapshot("after-button-pressed")

    }

In the Xcode UI, select the scheme 'ionic-screen-shots' and click into the method 'testSnapshots()' (after the first snapshot):

Select UI Scheme

You can now click on the 'Record UI Test' (Red Circle Icon):

Record UI Test

This will open the simulator and you can click around in your application. XCode will record, each interaction within the testSnapshots() method.

When you are done, you can save everything and it will save those interactions into the fastlane/cordova_screenshots/ios/ui-snapshots.swift.

You can now add fastlane snapshot("decription") where you like.

This whole operation only needs to be done once (or if you want to add more screenshots later).

The UI Test files can be added to your source control and they will be retrofitted into any future generated Ionic projects by the ionic_ios_snapshot action.

Android

TODO