Skip to content

Commit

Permalink
Use xcpretty in CI builds (jjochen#91)
Browse files Browse the repository at this point in the history
* use xcpretty and store junit reports

* test ci: failing test, less code coverage

* fail xcpretty when tests fail

* improve tests

* revert failing test

* Revert "test ci: failing test, less code coverage"

This reverts commit fe0e066.

* show button state in example delegate calls
  • Loading branch information
jjochen authored Jan 5, 2018
1 parent aa6edf2 commit be5e1cb
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 15 deletions.
7 changes: 7 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ aliases:
- &update-codecov
name: Update Codecov
command: bash <(curl -s https://codecov.io/bash)

- &xcpretty-reports
path: build/reports/junit.xml

- &filter-version-tags-only
filters:
Expand Down Expand Up @@ -89,6 +92,8 @@ jobs:
- save_cache: *save-pods-cache
- run: *run-tests
- run: *update-codecov
- store_artifacts: *xcpretty-reports
- store_test_results: *xcpretty-reports


build-and-test-ios10-iphone7plus:
Expand All @@ -111,6 +116,8 @@ jobs:
- save_cache: *save-pods-cache
- run: *run-tests
- run: *update-codecov
- store_artifacts: *xcpretty-reports
- store_test_results: *xcpretty-reports


lint-podspec:
Expand Down
13 changes: 5 additions & 8 deletions Example/JJFloatingActionButton/FirstViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -81,33 +81,30 @@ internal class FirstViewController: UIViewController {
}
}


extension FirstViewController: JJFloatingActionButtonDelegate {

func floatingActionButtonWillOpen(_ button: JJFloatingActionButton) {
print("Action button will open")
print("Action button will open: \(button.state)")
}

func floatingActionButtonDidOpen(_ button: JJFloatingActionButton) {
print("Action button did open")
print("Action button did open: \(button.state)")
}

func floatingActionButtonWillClose(_ button: JJFloatingActionButton) {
print("Action button will close")
print("Action button will close: \(button.state)")
}

func floatingActionButtonDidClose(_ button: JJFloatingActionButton) {
print("Action button did close")
print("Action button did close: \(button.state)")
}
}

extension FirstViewController {

func showMessage(for item: JJActionItem) {
let alertController = UIAlertController(title: item.titleLabel.text, message: "button tapped!", preferredStyle: .alert)
alertController.addAction(UIAlertAction(title: "OK", style: .default, handler: nil))
present(alertController, animated: true, completion: nil)
}
}


12 changes: 6 additions & 6 deletions Example/Tests/JJFloatingActionButtonSpec.swift
Original file line number Diff line number Diff line change
Expand Up @@ -65,30 +65,30 @@ class JJFloatingActionButtonSpec: QuickSpec {

it("looks correct highlighted") {
actionButton.isHighlighted = true
expect(actionButton.isHighlighted).to(beTruthy())
expect(actionButton.isHighlighted).to(beTrue())
expect(superview) == snapshot()
}

it("looks correct highlighted with dark color") {
actionButton.buttonColor = UIColor(hue: 0.6, saturation: 0.9, brightness: 0.3, alpha: 1)
actionButton.highlightedItemButtonColor = nil
actionButton.isHighlighted = true
expect(actionButton.isHighlighted).to(beTruthy())
expect(actionButton.isHighlighted).to(beTrue())
expect(superview) == snapshot()
}

it("looks correct highlighted with light color") {
actionButton.buttonColor = UIColor(hue: 0.4, saturation: 0.9, brightness: 0.7, alpha: 1)
actionButton.highlightedItemButtonColor = nil
actionButton.isHighlighted = true
expect(actionButton.isHighlighted).to(beTruthy())
expect(actionButton.isHighlighted).to(beTrue())
expect(superview) == snapshot()
}

it("looks correct highlighted with custom color") {
actionButton.highlightedButtonColor = UIColor.orange
actionButton.isHighlighted = true
expect(actionButton.isHighlighted).to(beTruthy())
expect(actionButton.isHighlighted).to(beTrue())
expect(superview) == snapshot()
}

Expand Down Expand Up @@ -190,15 +190,15 @@ class JJFloatingActionButtonSpec: QuickSpec {
it("items look correct highlighted") {
let item = actionButton.items[0]
item.isHighlighted = true
expect(item.isHighlighted).to(beTruthy())
expect(item.isHighlighted).to(beTrue())
expect(superview) == snapshot()
}

it("items look correct highlighted with custom highligted color") {
actionButton.highlightedItemButtonColor = UIColor.purple
let item = actionButton.items[0]
item.isHighlighted = true
expect(item.isHighlighted).to(beTruthy())
expect(item.isHighlighted).to(beTrue())
expect(superview) == snapshot()
}

Expand Down
3 changes: 2 additions & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,8 @@ def xcodebuild_test(destination)
" -enableCodeCoverage YES" \
" CODE_SIGNING_REQUIRED=NO" \
" CODE_SIGN_IDENTITY=" \
" PROVISIONING_PROFILE="
" PROVISIONING_PROFILE=" \
" | xcpretty --report junit && exit ${PIPESTATUS[0]}"
end

def ensure_clean_git_status
Expand Down

0 comments on commit be5e1cb

Please sign in to comment.