This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Merge remote-tracking branch 'origin/tuneup_js' into tuneup_again

Conflicts:
	integration/coffeescript/iphone/helpers/Pusher.coffee
  • Loading branch information...
listrophy committed Apr 4, 2012
2 parents fa20823 + b2fd948 commit ad1d6378c259abc3d083442fc5b6e6acf6a62f87
@@ -0,0 +1,21 @@
+#import "../../../../Pods/tuneup_js/tuneup.js"
+
+#import "helpers/TravisCI.js"
+
+test 'Favoriting a repository', (target, app) ->
+ RepositoriesScreen.tapRepositoryNamed 'CITravis by Travis-ci'
+ BuildsScreen.addToFavorites(app)
+ BuildsScreen.back()
+ RepositoriesScreen.tapFavorites()
+ FavoritesScreen.assertFavoriteNamed 'CITravis by Travis-ci'
+ FavoritesScreen.tapAll()
+
+test 'Unfavoriting a repository', (target, app) ->
+ RepositoriesScreen.tapFavorites()
+ FavoritesScreen.assertFavoriteNamed 'CITravis by Travis-ci'
+ FavoritesScreen.tapFavoriteNamed 'CITravis by Travis-ci'
+ BuildsScreen.removeFromFavorites(app)
+ BuildsScreen.back()
+ FavoritesScreen.assertNoFavoriteNamed 'CITravis by Travis-ci'
+ FavoritesScreen.tapAll()
+
@@ -1,4 +1,4 @@
-class BuildsScreenClass
+class BuildsScreenClass extends NavigationScreen
tableView: ->
TravisCI.window().tableViews()['Builds']
@@ -8,11 +8,12 @@ class BuildsScreenClass
tapBuildNumber: (buildNumber) ->
@tableView().cells()["Build ##{buildNumber} is still building"].tap()
- # assertWindow
- # navigationBar:
- # if
- # UIALogger.logPass("Element #{el_name} is visible")
- # else
- # UIALogger.logFail("Element #{el_name} is not visible")
+ addToFavorites: (app) ->
+ @navigationBar().rightButton().tap()
+ app.actionSheet().elements().Add.tap()
+
+ removeFromFavorites: (app) ->
+ @navigationBar().rightButton().tap()
+ app.actionSheet().elements().Remove.tap()
BuildsScreen = new BuildsScreenClass
@@ -0,0 +1,20 @@
+class FavoritesScreenClass extends NavigationScreen
+ favoritesList: ->
+ TravisCI.tableWithName('Repositories')
+
+ assertFavoriteNamed: (name) ->
+ assertTrue @favoritesList().cells()[name].isVisible()
+
+ assertNoFavoriteNamed: (name) ->
+ result = @favoritesList().cells()[name].isVisible()
+ UIALogger.logDebug("should be true #{result}")
+ assertFalse result
+
+ tapAll: ->
+ @navigationBar().elements().All.tap()
+
+ tapFavoriteNamed: (name) ->
+ @favoritesList().cells()[name].tap()
+
+
+FavoritesScreen = new FavoritesScreenClass
@@ -1,4 +1,4 @@
-class JobLogScreenClass
+class JobLogScreenClass extends NavigationScreen
textView: ->
TravisCI.window().textViews()['Job Log']
@@ -1,3 +1,6 @@
class NavigationScreen
+ navigationBar: ->
+ TravisCI.window().navigationBar()
+
back: ->
- TravisCI.window().navigationBar().leftButton().tap()
+ @navigationBar().leftButton().tap()
@@ -5,8 +5,11 @@ class PusherClass
jobId
logText
]
+ host = UIATarget.localTarget().host()
+ path = "~/dev/ios/TravisCI/integration/pusher_event"
timeout = 5 # seconds
- host = target.host()
+
host.performTaskWithPathArgumentsTimeout(path, args, timeout)
+
Pusher = new PusherClass
@@ -5,4 +5,7 @@ class RepositoriesScreenClass extends NavigationScreen
tapRepositoryNamed: (name) ->
@repositoryList().cells()[name].tap()
+ tapFavorites: ->
+ @navigationBar().elements().Favorites.tap()
+
RepositoriesScreen = new RepositoriesScreenClass
@@ -5,6 +5,7 @@
#import "JobsScreen.js"
#import "JobDetailScreen.js"
#import "JobLogScreen.js"
+#import "FavoritesScreen.js"
class TravisCIClass
window: ->
@@ -1,22 +0,0 @@
-assertElementPresent = (el, el_name) ->
- el_name = el_name ? el_name : ''
- if el.isValid()
- UIALogger.logPass("Element #{el_name} is present")
- else
- UIALogger.logFail("Element #{el_name} is not present")
-
-window = () ->
- UIATarget.localTarget().frontMostApp().mainWindow()
-
-whenITapTheFirstRepo = () ->
- repository_list = window().tableViews().firstWithName("Repositories")
- assertElementPresent(repository_list.cells(), "repository cells")
- latest_repo = repository_list.cells()[0]
- latest_repo.tap()
-
-whenITapTheFollowButton = () ->
- button = window().navigationBar().rightButton()
- UIALogger.logDebug(button)
-
-whenITapTheFirstRepo()
-whenITapTheFollowButton()
@@ -20,15 +20,15 @@ test 'see job log', (target, app) ->
JobLogScreen.assertLogEquals("log line one\n")
test 'pusher works with job log', (target, app) ->
- Pusher.appendToLog(target, "110", "pushed log line\n")
+ Pusher.appendToLog("110", "pushed log line\n")
JobLogScreen.assertLogEquals("log line one\npushed log line\n")
test 'going back and re-entering log still updates', (target, app) ->
JobLogScreen.back()
JobDetailScreen.back()
JobsScreen.tapJobNumber '3.1'
JobDetailScreen.tapLog()
- Pusher.appendToLog(target, "110", "another line\n")
+ Pusher.appendToLog("110", "another line\n")
JobLogScreen.assertLogEquals("log line one\npushed log line\nanother line\n")
View
@@ -21,11 +21,18 @@ channel = %Q($1)
event = %Q($2)
data = %Q($3)
-if !channel.empty? && !event.empty? && !data.empty?
- Pusher[channel].trigger(event, data)
-else
+if channel.empty? || event.empty? || data.empty?
puts 'usage: pusher_event <channel> <event> <data>'
+ return
+end
+
+begin
+ Pusher[channel].trigger(event, data)
+rescue Pusher::Error => e
+ puts "Receieved error from pusher: #{e}"
end
+
EOP
)
bundle exec ruby -e "$ruby_program"
+exit 0

0 comments on commit ad1d637

Please sign in to comment.