Skip to content

Commit

Permalink
Merge pull request #4 from EmbeddedSources/master
Browse files Browse the repository at this point in the history
Added an automator script for the CoverStory
  • Loading branch information
farcaller committed May 29, 2012
2 parents 32da69c + b693a5d commit d60ee9e
Show file tree
Hide file tree
Showing 6 changed files with 73 additions and 3 deletions.
22 changes: 22 additions & 0 deletions 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

1 change: 1 addition & 0 deletions Coverage/ExportHtmlComment.txt
@@ -0,0 +1 @@
http://jorudolph.wordpress.com/category/ios-continous-integration-series/
3 changes: 2 additions & 1 deletion Coverage/README.md
Expand Up @@ -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).
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.
6 changes: 4 additions & 2 deletions Tests/Jasmine/README.md
Expand Up @@ -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
Expand Down Expand Up @@ -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)
```
```
6 changes: 6 additions & 0 deletions 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
38 changes: 38 additions & 0 deletions 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");
});
});

0 comments on commit d60ee9e

Please sign in to comment.