diff --git a/Coverage/ExportHtml.automator b/Coverage/ExportHtml.automator new file mode 100644 index 0000000..573fe7f --- /dev/null +++ b/Coverage/ExportHtml.automator @@ -0,0 +1,22 @@ +on run argv + + tell application "/Applications/CoverStory.app" + + quit + + activate + + set x to open (item 1 of argv) + + tell x to export to HTML in (item 2 of argv) + + quit + + end tell + + + + return item 1 of argv & "|" & item 2 of argv + +end run + diff --git a/Coverage/ExportHtmlComment.txt b/Coverage/ExportHtmlComment.txt new file mode 100644 index 0000000..3ef6022 --- /dev/null +++ b/Coverage/ExportHtmlComment.txt @@ -0,0 +1 @@ +http://jorudolph.wordpress.com/category/ios-continous-integration-series/ diff --git a/Coverage/README.md b/Coverage/README.md index 0f42d3d..1cdb49d 100644 --- a/Coverage/README.md +++ b/Coverage/README.md @@ -32,4 +32,5 @@ size_t fwrite$UNIX2003( const void *a, size_t b, size_t c, FILE *d ) } ``` -Add the code above to any .c file that is going to be linked into your application (must be in app itself, not the tests bundle). \ No newline at end of file +Add the code above to any .c file that is going to be linked into your application (must be in app itself, not the tests bundle). You can find this file in the source tree above. +Alternatively, you can link libCoverageFopenFix.a to it. This is a "fat" library that can be used both with for device and the simulator build. diff --git a/Tests/Jasmine/README.md b/Tests/Jasmine/README.md index 555e0ed..a0ec669 100644 --- a/Tests/Jasmine/README.md +++ b/Tests/Jasmine/README.md @@ -11,7 +11,9 @@ UI Automation has a few issues, to make it work on simulator you need to launch it as follows: ```shell -TPL=/Developer/Platforms/iPhoneOS.platform/Developer/Library/Instruments/PlugIns/AutomationInstrument.bundle/Contents/Resources/Automation.tracetemplate + +XCODE_PATH=`xcode-select -print-path` +TPL=$XCODE_PATH/Platforms/iPhoneOS.platform/Developer/Library/Instruments/PlugIns/AutomationInstrument.bundle/Contents/Resources/Automation.tracetemplate APP=/Users/USERNAME/Library/Developer/Xcode/DerivedData/APP-RANDOMHASH/Build/Products/CONFIG-iphonesimulator/APPNAME.app instruments -t "$TPL" "$APP" -e UIASCRIPT PATHTOYOUR/suite.js -e UIARESULTSPATH PATHTO/ARTIFACTS @@ -79,4 +81,4 @@ describe("PocketCasts", function() { 2012-02-10 10:07:19 +0000 Fail: Expected 'Tap to download video' to equal 'Tap to subscribe at railscasts.com'. Instruments Trace Complete (Duration : 8.940802s; Output : /Users/farcaller/Developer/Active/pocketcasts/PocketCasts/instrumentscli4.trace) -``` \ No newline at end of file +``` diff --git a/Tests/Jasmine/RunAutomationScript.sh b/Tests/Jasmine/RunAutomationScript.sh new file mode 100755 index 0000000..5df3bdf --- /dev/null +++ b/Tests/Jasmine/RunAutomationScript.sh @@ -0,0 +1,6 @@ + +XCODE_PATH=`xcode-select -print-path` +TPL=$XCODE_PATH/Platforms/iPhoneOS.platform/Developer/Library/Instruments/PlugIns/AutomationInstrument.bundle/Contents/Resources/Automation.tracetemplate +APP=/Users/USERNAME/Library/Developer/Xcode/DerivedData/APP-RANDOMHASH/Build/Products/CONFIG-iphonesimulator/APPNAME.app + +instruments -t "$TPL" "$APP" -e UIASCRIPT PATHTOYOUR/suite.js -e UIARESULTSPATH PATHTO/ARTIFACTS diff --git a/Tests/Jasmine/SampleSpec.sh b/Tests/Jasmine/SampleSpec.sh new file mode 100644 index 0000000..6d2af3e --- /dev/null +++ b/Tests/Jasmine/SampleSpec.sh @@ -0,0 +1,38 @@ +describe("PocketCasts", function() { + var target = UIATarget.localTarget(); + + function dumpTree() { + UIATarget.localTarget().frontMostApp().logElementTree(); + } + + function pickVideoWithIndex(i) { + target.frontMostApp().mainWindow().tableViews()[0].visibleCells()[i].tap(); + } + + function firstTableGroup() { + return target.frontMostApp().mainWindow().tableViews()[0].groups()[0]; + } + + function goBack() { + target.frontMostApp().navigationBar().leftButton().tap(); + } + + afterEach(function(){ + goBack(); + }); + + it("should show download button for video, that is not downloaded", function(){ + pickVideoWithIndex(0); + expect(firstTableGroup().name()).toEqual("Tap to download video"); + }); + + it("should show play button for video that is downloaded", function(){ + pickVideoWithIndex(1); + expect(firstTableGroup().name()).toEqual("Tap to play video"); + }); + + it("should show subscribe button for pro video when there's no subscription", function(){ + pickVideoWithIndex(2); + expect(firstTableGroup().name()).toEqual("Tap to subscribe at railscasts.com"); + }); +});