Skip to content

Commit

Permalink
🔧 Update fastlane configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
stoeffn committed Sep 14, 2018
1 parent e40618f commit 296fe9c
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 33 deletions.
8 changes: 4 additions & 4 deletions StudApp/Downloads/DownloadListController.swift
Expand Up @@ -230,7 +230,7 @@ final class DownloadListController: UITableViewController, DataSourceDelegate {
present(previewController, animated: true, completion: nil)
}

override func tableView(_ tableView: UITableView, didDeselectRowAt indexPath: IndexPath) {
override func tableView(_ tableView: UITableView, didDeselectRowAt _: IndexPath) {
guard tableView.isEditing else { return }
updateRemoveButton()
}
Expand Down Expand Up @@ -305,7 +305,7 @@ final class DownloadListController: UITableViewController, DataSourceDelegate {
}

@IBAction
func removeButtonTapped(_ sender: Any) {
func removeButtonTapped(_: Any) {
let controller = UIAlertController(confirmationWithAction: Strings.Actions.remove.localized, barButtonItem: removeButton) { _ in
self.tableView.indexPathsForSelectedRows?
.compactMap { self.viewModel?[rowAt: $0] }
Expand Down Expand Up @@ -379,11 +379,11 @@ extension DownloadListController: UIViewControllerPreviewingDelegate, QLPreviewC
// MARK: - QuickLook Previewing

extension DownloadListController: QLPreviewControllerDataSource {
public func numberOfPreviewItems(in controller: QLPreviewController) -> Int {
public func numberOfPreviewItems(in _: QLPreviewController) -> Int {
return viewModel?.numberOfRows ?? 0
}

public func previewController(_ controller: QLPreviewController, previewItemAt index: Int) -> QLPreviewItem {
public func previewController(_: QLPreviewController, previewItemAt index: Int) -> QLPreviewItem {
return viewModel![rowAt: index]
}
}
21 changes: 6 additions & 15 deletions StudAppSnapshots/SnapshotHelper.swift
Expand Up @@ -163,8 +163,7 @@ open class Snapshot: NSObject {
waitForLoadingIndicatorToDisappear(within: timeout)
}

// more information about this, check out https://docs.fastlane.tools/actions/snapshot/#how-does-it-work
print("snapshot: \(name)")
print("snapshot: \(name)") // more information about this, check out https://docs.fastlane.tools/actions/snapshot/#how-does-it-work

sleep(1) // Waiting for the animation to be finished (kind of)

Expand All @@ -177,16 +176,9 @@ open class Snapshot: NSObject {
return
}

guard let window = app.windows.allElementsBoundByIndex.first(where: { $0.frame.isEmpty == false }) else {
print("Couldn't find an element window in XCUIApplication with a non-empty frame.")
return
}

let window = app.windows.firstMatch
let screenshot = window.screenshot()
guard
let simulator = ProcessInfo().environment["SIMULATOR_DEVICE_NAME"],
let screenshotsDir = screenshotsDirectory
else { return }
guard let simulator = ProcessInfo().environment["SIMULATOR_DEVICE_NAME"], let screenshotsDir = screenshotsDirectory else { return }
let path = screenshotsDir.appendingPathComponent("\(simulator)-\(name).png")
do {
try screenshot.pngRepresentation.write(to: path)
Expand All @@ -203,8 +195,7 @@ open class Snapshot: NSObject {
#endif

let networkLoadingIndicator = XCUIApplication().otherElements.deviceStatusBars.networkLoadingIndicators.element
let networkLoadingIndicatorDisappeared = XCTNSPredicateExpectation(
predicate: NSPredicate(format: "exists == false"), object: networkLoadingIndicator)
let networkLoadingIndicatorDisappeared = XCTNSPredicateExpectation(predicate: NSPredicate(format: "exists == false"), object: networkLoadingIndicator)
_ = XCTWaiter.wait(for: [networkLoadingIndicatorDisappeared], timeout: timeout)
}

Expand Down Expand Up @@ -278,7 +269,7 @@ private extension XCUIElementQuery {
}

var deviceStatusBars: XCUIElementQuery {
let deviceWidth = XCUIApplication().frame.width
let deviceWidth = XCUIApplication().windows.firstMatch.frame.width

let isStatusBar = NSPredicate { evaluatedObject, _ in
guard let element = evaluatedObject as? XCUIElementAttributes else { return false }
Expand All @@ -298,4 +289,4 @@ private extension CGFloat {

// Please don't remove the lines below
// They are used to detect outdated configuration files
// SnapshotHelperVersion [1.10]
// SnapshotHelperVersion [1.12]
6 changes: 3 additions & 3 deletions StudAppSnapshots/StudAppSnapshots.swift
Expand Up @@ -40,8 +40,8 @@ final class StudAppSnapshots: XCTestCase {
XCUIDevice.shared.orientation = .landscapeLeft
}

app.buttons[MockStrings.Semesters.winter1718.localized(language: deviceLanguage)].tap()
app.buttons[MockStrings.Semesters.summer18.localized(language: deviceLanguage)].tap()
app.buttons[MockStrings.Semesters.winter1819.localized(language: deviceLanguage)].tap()
app.buttons[MockStrings.Semesters.summer19.localized(language: deviceLanguage)].tap()

if app.runsOniPad {
app.staticTexts[MockStrings.Courses.coding.localized(language: deviceLanguage)].tap()
Expand All @@ -58,7 +58,7 @@ final class StudAppSnapshots: XCTestCase {
XCUIDevice.shared.orientation = .landscapeLeft
}

app.buttons[MockStrings.Semesters.summer18.localized(language: deviceLanguage)].tap()
app.buttons[MockStrings.Semesters.summer19.localized(language: deviceLanguage)].tap()
app.staticTexts[MockStrings.Courses.coding.localized(language: deviceLanguage)].tap()

snapshot("02-Course")
Expand Down
2 changes: 1 addition & 1 deletion StudKit/MockStrings.swift
Expand Up @@ -50,7 +50,7 @@ public enum MockStrings {
}

public enum Semesters: String, Localizable {
case winter1617, summer17, winter1718, summer18
case winter1718, summer18, winter1819, summer19
}

public enum Users: String, Localizable {
Expand Down
8 changes: 4 additions & 4 deletions StudKit/StudIp/MockResponses.swift
Expand Up @@ -32,13 +32,13 @@ struct MockResponses {
// MARK: - Semesters

private(set) lazy var semesters = [
SemesterResponse(id: "S0", title: MockStrings.Semesters.winter1617.localized,
SemesterResponse(id: "S0", title: MockStrings.Semesters.winter1718.localized,
beginsAt: Date(timeIntervalSince1970: 1_475_338_860), endsAt: Date(timeIntervalSince1970: 1_488_388_860)),
SemesterResponse(id: "S1", title: MockStrings.Semesters.summer17.localized,
SemesterResponse(id: "S1", title: MockStrings.Semesters.summer18.localized,
beginsAt: Date(timeIntervalSince1970: 1_491_004_800), endsAt: Date(timeIntervalSince1970: 1_504_224_000)),
SemesterResponse(id: "S2", title: MockStrings.Semesters.winter1718.localized,
SemesterResponse(id: "S2", title: MockStrings.Semesters.winter1819.localized,
beginsAt: Date(timeIntervalSince1970: 1_504_282_860), endsAt: Date(timeIntervalSince1970: 1_519_924_860)),
SemesterResponse(id: "S3", title: MockStrings.Semesters.summer18.localized,
SemesterResponse(id: "S3", title: MockStrings.Semesters.summer19.localized,
beginsAt: Date(timeIntervalSince1970: 1_522_540_800), endsAt: Date(timeIntervalSince1970: 1_535_760_000)),
]

Expand Down
2 changes: 1 addition & 1 deletion StudKit/ViewModels/Files/DownloadListViewModel.swift
Expand Up @@ -19,7 +19,7 @@
import CoreData

public final class FetchedDownloadsController: NSFetchedResultsController<File> {
override public func sectionIndexTitle(forSectionName sectionName: String) -> String? {
public override func sectionIndexTitle(forSectionName sectionName: String) -> String? {
let name = sectionName
.components(separatedBy: "-")
.dropFirst()
Expand Down
4 changes: 2 additions & 2 deletions StudKit/de.lproj/Localizable.strings
Expand Up @@ -221,10 +221,10 @@

// MARK: Semesters

"Semesters.winter1617" = "Winter 2016/17";
"Semesters.summer17" = "Sommer 2017";
"Semesters.winter1718" = "Winter 2017/18";
"Semesters.summer18" = "Sommer 2018";
"Semesters.winter1819" = "Winter 2018/19";
"Semesters.summer19" = "Sommer 2019";

// MARK: Users

Expand Down
4 changes: 2 additions & 2 deletions StudKit/en.lproj/Localizable.strings
Expand Up @@ -221,10 +221,10 @@

// MARK: Semesters

"Semesters.winter1617" = "Winter 2016/17";
"Semesters.summer17" = "Summer 2017";
"Semesters.winter1718" = "Winter 2017/18";
"Semesters.summer18" = "Summer 2018";
"Semesters.winter1819" = "Winter 2018/19";
"Semesters.summer19" = "Summer 2019";

// MARK: Users

Expand Down
3 changes: 2 additions & 1 deletion fastlane/Snapfile
Expand Up @@ -2,7 +2,8 @@ devices([
"iPhone 8",
"iPhone 8 Plus",
"iPhone SE",
"iPhone X",
"iPhone XS",
"iPhone XS Max",
"iPad Pro (12.9-inch)",
"iPad Pro (10.5-inch)",
"iPad Pro (9.7-inch)"
Expand Down

0 comments on commit 296fe9c

Please sign in to comment.