stylesync icon indicating copy to clipboard operation
stylesync copied to clipboard

Generate before and after screenshots

Open dylanslewis opened this issue 8 years ago • 1 comments

To aid the testing of the generated pull request, stylesync should get before and after screenshots of the key screens. This will require a special UI test, written by the user, which traverses the app and takes screenshots using XCAttachment, e.g.:

let screenshot = self.screen.screenshot()
let attachment = XCTAttachment(screenshot: screenshot)
attachment.lifetime = .keepAlways

To avoid generating hundreds of screenshots, the Xcode project should not take automatic screenshots, since this tends to generate lots of duplicates.

stylesync would first run this test on a 'beforeBranch' and then again on an afterBranch. The screenshots would all be saved in Derived Data and would need to be uploaded to GitHub. Unfortunately you can't programatically upload images to an issue, so it may need to upload to a dedicated repository, the same way that fastlane handles storing your certificates.

The config would need to following attributes:

  • Test suite
  • Test case
  • Test name
  • Derived data location
  • Repository name? (could automate this)

Similar to #16 this should be done as a separate Swift Package, since it solves a general problem so should be well separated (e.g. you could use this for translation update screenshots).

dylanslewis avatar Nov 26 '17 14:11 dylanslewis

Work has already started on this in ScreenshotManager.swift, but this should all be extracted to a separate repository, and then added as a dependancy to Package.swift.

dylanslewis avatar Nov 26 '17 14:11 dylanslewis