Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions .github/workflows/screenshots.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,15 @@ jobs:
run: |
# Unsplash photos via picsum.photos, free to use. They're dated today, so they
# sit at the top of the timeline above the demo account's server photos.
# Optional: if picsum.photos is down, the timeline just shows server photos.
mkdir -p phone-photos
for id in 1018 1043 1050; do
curl -sfL -o "phone-photos/phone-$id.jpg" "https://picsum.photos/id/$id/1600/1200.jpg"
curl -sfL --retry 3 -m 30 -o "phone-photos/phone-$id.jpg" "https://picsum.photos/id/$id/1600/1200.jpg" \
|| echo "Couldn't download photo $id"
done
xcrun simctl addmedia "$DEVICE_ID" phone-photos/*.jpg
if ls phone-photos/*.jpg >/dev/null 2>&1; then
xcrun simctl addmedia "$DEVICE_ID" phone-photos/*.jpg
fi
# Signed ad hoc ("Sign to Run Locally") rather than unsigned: the simulator only
# grants Keychain access to a signed app.
- name: Capture
Expand Down
3 changes: 3 additions & 0 deletions config/project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@ targets:
platform: iOS
sources:
- path: ../tests/CloudrollScreenshots
excludes: ["*.storekit"]
- path: ../tests/CloudrollScreenshots/Tips.storekit
buildPhase: resources
dependencies:
- target: Cloudroll
settings:
Expand Down
20 changes: 20 additions & 0 deletions tests/CloudrollScreenshots/ScreenshotTests.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import StoreKitTest
import XCTest

/// Captures the App Store screenshots against the App Review demo account.
Expand All @@ -14,6 +15,9 @@ final class ScreenshotTests: XCTestCase {
private let springboard = XCUIApplication(bundleIdentifier: "com.apple.springboard")
private var outputDir: URL!
private var problems: [String] = []
/// Serves the three tips from Tips.storekit, so the tip jar shows its prices
/// (the App Review screenshot for the in-app purchases).
private var storeKit: SKTestSession?

override func setUpWithError() throws {
continueAfterFailure = true
Expand All @@ -30,6 +34,14 @@ final class ScreenshotTests: XCTestCase {
}

func testCaptureScreenshots() throws {
do {
let session = try SKTestSession(configurationFileNamed: "Tips")
session.resetToDefaultState()
session.disableDialogs = true
storeKit = session
} catch {
problems.append("StoreKit test session: \(error)")
}
app.launch()
guard waitForTimeline() else {
save("00-not-loaded")
Expand Down Expand Up @@ -86,6 +98,14 @@ final class ScreenshotTests: XCTestCase {
if tap(app.buttons.matching(NSPredicate(format: "label CONTAINS %@", "App Icon")).firstMatch, "App Icon") {
pause(3)
save("05-app-icons")
app.navigationBars.buttons.firstMatch.tap()
pause(1)
}
if tap(app.buttons.matching(NSPredicate(format: "label CONTAINS %@", "Support Cloudroll")).firstMatch, "Support Cloudroll") {
pause(6) // products load
save("06-tip-jar")
app.navigationBars.buttons.firstMatch.tap()
pause(1)
}
// The viewer logs why a Live Photo's motion didn't load.
if liveFailed {
Expand Down
63 changes: 63 additions & 0 deletions tests/CloudrollScreenshots/Tips.storekit
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
{
"identifier" : "6E1B5A7C",
"nonRenewingSubscriptions" : [

],
"products" : [
{
"displayPrice" : "1.99",
"familyShareable" : false,
"internalID" : "6834540159",
"localizations" : [
{
"description" : "A tip for Cloudroll. It doesn't unlock anything.",
"displayName" : "Small tip",
"locale" : "en_US"
}
],
"productID" : "io.github.keasbeexd.cloudroll.tip.small",
"referenceName" : "Small tip",
"type" : "Consumable"
},
{
"displayPrice" : "4.99",
"familyShareable" : false,
"internalID" : "6834540708",
"localizations" : [
{
"description" : "A tip for Cloudroll. It doesn't unlock anything.",
"displayName" : "Medium tip",
"locale" : "en_US"
}
],
"productID" : "io.github.keasbeexd.cloudroll.tip.medium",
"referenceName" : "Medium tip",
"type" : "Consumable"
},
{
"displayPrice" : "9.99",
"familyShareable" : false,
"internalID" : "6834541367",
"localizations" : [
{
"description" : "A tip for Cloudroll. It doesn't unlock anything.",
"displayName" : "Large tip",
"locale" : "en_US"
}
],
"productID" : "io.github.keasbeexd.cloudroll.tip.large",
"referenceName" : "Large tip",
"type" : "Consumable"
}
],
"settings" : {
"_storefront" : "USA"
},
"subscriptionGroups" : [

],
"version" : {
"major" : 3,
"minor" : 0
}
}
Loading