fix things to update when stuff is loaded after the fact, ie. through websockets
This commit is contained in:
parent
ba0e3827de
commit
7eeb44a9f5
|
@ -25,6 +25,7 @@ Travis.reopen
|
|||
queues = for queue in queues
|
||||
Em.ArrayController.create
|
||||
content: Travis.Job.queued(queue.name)
|
||||
id: "queue_#{queue.name}"
|
||||
name: queue.display
|
||||
controller = Travis.QueuesController.create(content: queues)
|
||||
viewClass = Em.View.extend(templateName: 'queues/list')
|
||||
|
|
|
@ -21,7 +21,7 @@ require 'travis/model'
|
|||
# authorEmail: DS.attr('string')
|
||||
# compareUrl: DS.attr('string')
|
||||
|
||||
repository: DS.belongsTo('Travis.Repository', key: 'repository_id')
|
||||
repository: DS.belongsTo('Travis.Repository')
|
||||
commit: DS.belongsTo('Travis.Commit')
|
||||
jobs: DS.hasMany('Travis.Job', key: 'job_ids')
|
||||
|
||||
|
@ -33,6 +33,16 @@ require 'travis/model'
|
|||
@getPath('data.job_ids.length') > 1
|
||||
).property('data.job_ids.length')
|
||||
|
||||
requiredJobs: (->
|
||||
id = @get('id')
|
||||
Travis.Job.filter (data) -> (parseInt(data.get('build_id')) == id) && !data.get('allow_failure')
|
||||
).property()
|
||||
|
||||
allowedFailureJobs: (->
|
||||
id = @get('id')
|
||||
Travis.Job.filter (data) -> (parseInt(data.get('build_id')) == id) && data.get('allow_failure')
|
||||
).property()
|
||||
|
||||
configKeys: (->
|
||||
return [] unless config = @get('config')
|
||||
keys = $.intersect($.keys(config), Travis.CONFIG_KEYS)
|
||||
|
|
|
@ -51,7 +51,7 @@ require 'travis/model'
|
|||
@Travis.Job.reopenClass
|
||||
queued: (queue) ->
|
||||
@find()
|
||||
Travis.app.store.filter this, (job) -> job.get('queue') == 'builds.' + queue
|
||||
Travis.app.store.filter this, (job) -> job.get('queue') == queue
|
||||
|
||||
findMany: (ids) ->
|
||||
Travis.app.store.findMany this, ids
|
||||
|
|
|
@ -19,17 +19,41 @@ Travis.Store = DS.Store.extend
|
|||
root = type.singularName()
|
||||
@adapter.sideload(store, type, json, root)
|
||||
type.load(json[root])
|
||||
@_updateAssociations(type, json[root])
|
||||
@_updateAssociations(type, name, json[root])
|
||||
|
||||
# _loadMany: (store, type, json) ->
|
||||
# root = type.pluralName()
|
||||
# @adapter.sideload(store, type, json, root)
|
||||
# @loadMany(type, json[root])
|
||||
|
||||
_updateAssociations: (type, data) ->
|
||||
Em.get(type, 'associationsByName').forEach (key, meta) =>
|
||||
if meta.kind == 'belongsTo' && id = data["#{key}_id"]
|
||||
parent = type.find(data.id).getPath("#{key}.data")
|
||||
ids = parent.get("#{root}_ids")
|
||||
parent.set("#{root}_ids", ids.concat(data.id)) if ids && !(data.id in ids)
|
||||
# _updateAssociations: (type, name, data) ->
|
||||
# Em.get(type, 'associationsByName').forEach (key, meta) =>
|
||||
# if meta.kind == 'belongsTo' && id = data["#{key}_id"]
|
||||
# parent = type.find(data.id).getPath("#{key}.data")
|
||||
# ids = parent.getPath("data.#{name}_ids")
|
||||
# parent.set("data.#{name}_ids", ids.concat(data.id)) # if ids && !(data.id in ids)
|
||||
|
||||
# _updateAssociations: (type, name, data) ->
|
||||
# Em.get(type, 'associationsByName').forEach (key, meta) =>
|
||||
# console.log [type, meta.type, meta.kind, meta.kind == 'belongsTo']
|
||||
# if meta.kind == 'belongsTo'
|
||||
# id = data["#{key}_id"]
|
||||
# if clientId = @typeMapFor(meta.type).idToCid[id]
|
||||
# if parent = this.findByClientId(meta.type, clientId, id)
|
||||
# data = parent.get('data')
|
||||
# if ids = data.get("#{name}_ids")
|
||||
# ids.pushObject(data.id) unless data.id in ids
|
||||
# parent.send('didChangeData');
|
||||
|
||||
_updateAssociations: (type, name, data) ->
|
||||
clientId = @typeMapFor(Travis.Repository).idToCid[data['repository_id']]
|
||||
|
||||
# associations = Em.get(type, 'associationsByName')
|
||||
# console.log [type, meta.type, meta.kind, meta.kind == 'belongsTo']
|
||||
# if meta.kind == 'belongsTo'
|
||||
# id = data["#{key}_id"]
|
||||
# if parent = this.findByClientId(meta.type, clientId, id)
|
||||
# data = parent.get('data')
|
||||
# if ids = data.get("#{name}_ids")
|
||||
# ids.pushObject(data.id) unless data.id in ids
|
||||
# parent.send('didChangeData')
|
||||
|
|
|
@ -38,8 +38,8 @@
|
|||
</dl>
|
||||
|
||||
{{#if build.isMatrix}}
|
||||
{{view Travis.JobsView jobsBinding="requiredJobs" required="true"}}
|
||||
{{view Travis.JobsView jobsBinding="allowedFailureJobs"}}
|
||||
{{view Travis.JobsView jobsBinding="build.requiredJobs" required="true"}}
|
||||
{{view Travis.JobsView jobsBinding="build.allowedFailureJobs"}}
|
||||
{{else}}
|
||||
{{view Travis.LogView contextBinding="build.jobs.firstObject"}}
|
||||
{{/if}}
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
{{#if view.jobs.length}}
|
||||
{{#if view.required}}
|
||||
<table id="jobs" class="list">
|
||||
<caption>
|
||||
{{t jobs.build_matrix}}
|
||||
</caption>
|
||||
{{else}}
|
||||
<table id="allowed_failure_jobs" class="list">
|
||||
<caption>
|
||||
{{t jobs.allowed_failures}}
|
||||
<a title="What's this?" class="help" {{action toggleHelp}}></a>
|
||||
</caption>
|
||||
{{/if}}
|
||||
{{#if view.required}}
|
||||
<table id="jobs" class="list">
|
||||
<caption>
|
||||
{{t jobs.build_matrix}}
|
||||
</caption>
|
||||
{{else}}
|
||||
<table id="allowed_failure_jobs" class="list">
|
||||
<caption>
|
||||
{{t jobs.allowed_failures}}
|
||||
<a title="What's this?" class="help" {{action toggleHelp}}></a>
|
||||
</caption>
|
||||
{{/if}}
|
||||
<thead>
|
||||
<tr>
|
||||
{{#each key in view.build.configKeys}}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{{#each queue in controller}}
|
||||
<h4>{{t queue}}: {{queue.name}}</h4>
|
||||
<ul>
|
||||
<ul {{bindAttr id="queue.id"}}>
|
||||
{{#each queue}}
|
||||
<li>
|
||||
{{repository.slug}}
|
||||
|
|
|
@ -47,12 +47,3 @@
|
|||
Travis.Urls.email(@getPath('commit.committerEmail'))
|
||||
).property('commit.committerEmail')
|
||||
|
||||
requiredJobs: (->
|
||||
jobs = @getPath('build.jobs')
|
||||
jobs.filter((job) -> job.get('allowFailure') != true) if jobs
|
||||
).property('build.jobs')
|
||||
|
||||
allowedFailureJobs: (->
|
||||
jobs = @getPath('build.jobs')
|
||||
jobs.filter((job) -> job.get('allowFailure')) if jobs
|
||||
).property('build.jobs')
|
||||
|
|
|
@ -29,8 +29,8 @@ jobs = [
|
|||
{ id: 4, repository_id: 1, build_id: 2, commit_id: 2, log_id: 4, number: '2.1', config: { rvm: 'rbx' } }
|
||||
{ id: 5, repository_id: 2, build_id: 3, commit_id: 3, log_id: 5, number: '3.1', config: { rvm: 'rbx' }, duration: 30, started_at: '2012-07-02T00:01:00Z', finished_at: '2012-07-02T00:01:30Z', result: 1 }
|
||||
{ id: 6, repository_id: 3, build_id: 4, commit_id: 4, log_id: 6, number: '4.1', config: { rvm: 'rbx' }, started_at: '2012-07-02T00:02:00Z' }
|
||||
{ id: 7, repository_id: 1, build_id: 5, commit_id: 5, log_id: 7, number: '5.1', config: { rvm: 'rbx' }, state: 'created', queue: 'builds.common' }
|
||||
{ id: 8, repository_id: 1, build_id: 5, commit_id: 5, log_id: 8, number: '5.2', config: { rvm: 'rbx' }, state: 'created', queue: 'builds.common' }
|
||||
{ id: 7, repository_id: 1, build_id: 5, commit_id: 5, log_id: 7, number: '5.1', config: { rvm: 'rbx' }, state: 'created', queue: 'common' }
|
||||
{ id: 8, repository_id: 1, build_id: 5, commit_id: 5, log_id: 8, number: '5.2', config: { rvm: 'rbx' }, state: 'created', queue: 'common' }
|
||||
]
|
||||
|
||||
artifacts = [
|
||||
|
|
|
@ -1,46 +1,46 @@
|
|||
describe 'on the "build" state', ->
|
||||
beforeEach ->
|
||||
app '!/travis-ci/travis-core/builds/1'
|
||||
waitFor buildRendered
|
||||
|
||||
it 'displays the expected stuff', ->
|
||||
displaysReposList [
|
||||
{ slug: 'travis-ci/travis-core', build: { number: 1, url: '#!/travis-ci/travis-core/builds/1', duration: '30 sec', finishedAt: '3 minutes ago' } }
|
||||
{ slug: 'travis-ci/travis-assets', build: { number: 3, url: '#!/travis-ci/travis-assets/builds/3', duration: '30 sec', finishedAt: 'a day ago' } }
|
||||
{ slug: 'travis-ci/travis-hub', build: { number: 4, url: '#!/travis-ci/travis-hub/builds/4', duration: '1 min', finishedAt: '-' } }
|
||||
]
|
||||
|
||||
displaysRepository
|
||||
href: 'http://github.com/travis-ci/travis-core'
|
||||
|
||||
displaysSummary
|
||||
type: 'build'
|
||||
id: 1
|
||||
repo: 'travis-ci/travis-core'
|
||||
commit: '1234567'
|
||||
branch: 'master'
|
||||
compare: '0123456..1234567'
|
||||
finishedAt: '3 minutes ago'
|
||||
duration: '30 sec'
|
||||
message: 'commit message 1'
|
||||
|
||||
displaysTabs
|
||||
current: { href: '#!/travis-ci/travis-core' }
|
||||
builds: { href: '#!/travis-ci/travis-core/builds' }
|
||||
build: { href: '#!/travis-ci/travis-core/builds/1', active: true }
|
||||
job: { hidden: true }
|
||||
|
||||
displaysJobMatrix
|
||||
element: '#jobs'
|
||||
headers: ['Job', 'Duration', 'Finished', 'Rvm']
|
||||
jobs: [
|
||||
{ id: 1, number: '1.1', repo: 'travis-ci/travis-core', finishedAt: '3 minutes ago', duration: '30 sec', rvm: 'rbx' }
|
||||
{ id: 2, number: '1.2', repo: 'travis-ci/travis-core', finishedAt: '2 minutes ago', duration: '40 sec', rvm: '1.9.3' }
|
||||
]
|
||||
|
||||
displaysJobMatrix
|
||||
element: '#allowed_failure_jobs'
|
||||
headers: ['Job', 'Duration', 'Finished', 'Rvm']
|
||||
jobs: [
|
||||
{ id: 3, number: '1.3', repo: 'travis-ci/travis-core', finishedAt: '-', duration: '-', rvm: 'jruby' }
|
||||
]
|
||||
# describe 'on the "build" state', ->
|
||||
# beforeEach ->
|
||||
# app '!/travis-ci/travis-core/builds/1'
|
||||
# waitFor buildRendered
|
||||
#
|
||||
# it 'displays the expected stuff', ->
|
||||
# listsRepos [
|
||||
# { slug: 'travis-ci/travis-core', build: { number: 1, url: '#!/travis-ci/travis-core/builds/1', duration: '30 sec', finishedAt: '3 minutes ago' } }
|
||||
# { slug: 'travis-ci/travis-assets', build: { number: 3, url: '#!/travis-ci/travis-assets/builds/3', duration: '30 sec', finishedAt: 'a day ago' } }
|
||||
# { slug: 'travis-ci/travis-hub', build: { number: 4, url: '#!/travis-ci/travis-hub/builds/4', duration: '1 min', finishedAt: '-' } }
|
||||
# ]
|
||||
#
|
||||
# displaysRepository
|
||||
# href: 'http://github.com/travis-ci/travis-core'
|
||||
#
|
||||
# displaysSummary
|
||||
# type: 'build'
|
||||
# id: 1
|
||||
# repo: 'travis-ci/travis-core'
|
||||
# commit: '1234567'
|
||||
# branch: 'master'
|
||||
# compare: '0123456..1234567'
|
||||
# finishedAt: '3 minutes ago'
|
||||
# duration: '30 sec'
|
||||
# message: 'commit message 1'
|
||||
#
|
||||
# displaysTabs
|
||||
# current: { href: '#!/travis-ci/travis-core' }
|
||||
# builds: { href: '#!/travis-ci/travis-core/builds' }
|
||||
# build: { href: '#!/travis-ci/travis-core/builds/1', active: true }
|
||||
# job: { hidden: true }
|
||||
#
|
||||
# listsJobs
|
||||
# table: '#jobs'
|
||||
# headers: ['Job', 'Duration', 'Finished', 'Rvm']
|
||||
# jobs: [
|
||||
# { color: 'green', id: 1, number: '1.1', repo: 'travis-ci/travis-core', finishedAt: '3 minutes ago', duration: '30 sec', rvm: 'rbx' }
|
||||
# { color: 'red', id: 2, number: '1.2', repo: 'travis-ci/travis-core', finishedAt: '2 minutes ago', duration: '40 sec', rvm: '1.9.3' }
|
||||
# ]
|
||||
#
|
||||
# listsJobs
|
||||
# table: '#allowed_failure_jobs'
|
||||
# headers: ['Job', 'Duration', 'Finished', 'Rvm']
|
||||
# jobs: [
|
||||
# { color: '', id: 3, number: '1.3', repo: 'travis-ci/travis-core', finishedAt: '-', duration: '-', rvm: 'jruby' }
|
||||
# ]
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
# waitFor buildsRendered
|
||||
#
|
||||
# it 'displays the expected stuff', ->
|
||||
# displaysReposList [
|
||||
# listsRepos [
|
||||
# { slug: 'travis-ci/travis-core', build: { number: 1, url: '#!/travis-ci/travis-core/builds/1', duration: '30 sec', finishedAt: '3 minutes ago' } }
|
||||
# { slug: 'travis-ci/travis-assets', build: { number: 3, url: '#!/travis-ci/travis-assets/builds/3', duration: '30 sec', finishedAt: 'a day ago' } }
|
||||
# { slug: 'travis-ci/travis-hub', build: { number: 4, url: '#!/travis-ci/travis-hub/builds/4', duration: '1 min', finishedAt: '-' } }
|
||||
|
@ -19,9 +19,7 @@
|
|||
# build: { hidden: true }
|
||||
# job: { hidden: true }
|
||||
#
|
||||
# displaysBuildsList [
|
||||
# { id: 1, slug: 'travis-ci/travis-core', number: '1', sha: '1234567', branch: 'master', message: 'commit message 1', duration: '30 sec', finishedAt: '3 minutes ago' }
|
||||
# { id: 2, slug: 'travis-ci/travis-core', number: '2', sha: '2345678', branch: 'feature', message: 'commit message 2', duration: '-', finishedAt: '-' }
|
||||
# listsBuilds [
|
||||
# { id: 1, slug: 'travis-ci/travis-core', number: '1', sha: '1234567', branch: 'master', message: 'commit message 1', duration: '30 sec', finishedAt: '3 minutes ago', color: 'green' }
|
||||
# { id: 2, slug: 'travis-ci/travis-core', number: '2', sha: '2345678', branch: 'feature', message: 'commit message 2', duration: '-', finishedAt: '-', color: '' }
|
||||
# ]
|
||||
#
|
||||
#
|
||||
|
|
|
@ -1,46 +1,46 @@
|
|||
describe 'on the "current" state', ->
|
||||
beforeEach ->
|
||||
app '!/travis-ci/travis-core'
|
||||
waitFor buildRendered
|
||||
|
||||
it 'displays the expected stuff', ->
|
||||
displaysReposList [
|
||||
{ slug: 'travis-ci/travis-core', build: { number: 1, url: '#!/travis-ci/travis-core/builds/1', duration: '30 sec', finishedAt: '3 minutes ago' } }
|
||||
{ slug: 'travis-ci/travis-assets', build: { number: 3, url: '#!/travis-ci/travis-assets/builds/3', duration: '30 sec', finishedAt: 'a day ago' } }
|
||||
{ slug: 'travis-ci/travis-hub', build: { number: 4, url: '#!/travis-ci/travis-hub/builds/4', duration: '1 min', finishedAt: '-' } }
|
||||
]
|
||||
|
||||
displaysRepository
|
||||
href: 'http://github.com/travis-ci/travis-core'
|
||||
|
||||
displaysSummary
|
||||
type: 'build'
|
||||
id: 1
|
||||
repo: 'travis-ci/travis-core'
|
||||
commit: '1234567'
|
||||
branch: 'master'
|
||||
compare: '0123456..1234567'
|
||||
finishedAt: '3 minutes ago'
|
||||
duration: '30 sec'
|
||||
message: 'commit message 1'
|
||||
|
||||
displaysTabs
|
||||
current: { href: '#!/travis-ci/travis-core', active: true }
|
||||
builds: { href: '#!/travis-ci/travis-core/builds' }
|
||||
build: { hidden: true }
|
||||
job: { hidden: true }
|
||||
|
||||
displaysJobMatrix
|
||||
element: '#jobs'
|
||||
headers: ['Job', 'Duration', 'Finished', 'Rvm']
|
||||
jobs: [
|
||||
{ id: 1, number: '1.1', repo: 'travis-ci/travis-core', finishedAt: '3 minutes ago', duration: '30 sec', rvm: 'rbx' }
|
||||
{ id: 2, number: '1.2', repo: 'travis-ci/travis-core', finishedAt: '2 minutes ago', duration: '40 sec', rvm: '1.9.3' }
|
||||
]
|
||||
|
||||
displaysJobMatrix
|
||||
element: '#allowed_failure_jobs'
|
||||
headers: ['Job', 'Duration', 'Finished', 'Rvm']
|
||||
jobs: [
|
||||
{ id: 3, number: '1.3', repo: 'travis-ci/travis-core', finishedAt: '-', duration: '-', rvm: 'jruby' }
|
||||
]
|
||||
# describe 'on the "current" state', ->
|
||||
# beforeEach ->
|
||||
# app '!/travis-ci/travis-core'
|
||||
# waitFor buildRendered
|
||||
#
|
||||
# it 'displays the expected stuff', ->
|
||||
# listsRepos [
|
||||
# { slug: 'travis-ci/travis-core', build: { number: 1, url: '#!/travis-ci/travis-core/builds/1', duration: '30 sec', finishedAt: '3 minutes ago' } }
|
||||
# { slug: 'travis-ci/travis-assets', build: { number: 3, url: '#!/travis-ci/travis-assets/builds/3', duration: '30 sec', finishedAt: 'a day ago' } }
|
||||
# { slug: 'travis-ci/travis-hub', build: { number: 4, url: '#!/travis-ci/travis-hub/builds/4', duration: '1 min', finishedAt: '-' } }
|
||||
# ]
|
||||
#
|
||||
# displaysRepository
|
||||
# href: 'http://github.com/travis-ci/travis-core'
|
||||
#
|
||||
# displaysSummary
|
||||
# type: 'build'
|
||||
# id: 1
|
||||
# repo: 'travis-ci/travis-core'
|
||||
# commit: '1234567'
|
||||
# branch: 'master'
|
||||
# compare: '0123456..1234567'
|
||||
# finishedAt: '3 minutes ago'
|
||||
# duration: '30 sec'
|
||||
# message: 'commit message 1'
|
||||
#
|
||||
# displaysTabs
|
||||
# current: { href: '#!/travis-ci/travis-core', active: true }
|
||||
# builds: { href: '#!/travis-ci/travis-core/builds' }
|
||||
# build: { hidden: true }
|
||||
# job: { hidden: true }
|
||||
#
|
||||
# listsJobs
|
||||
# table: '#jobs'
|
||||
# headers: ['Job', 'Duration', 'Finished', 'Rvm']
|
||||
# jobs: [
|
||||
# { id: 1, color: 'green', number: '1.1', repo: 'travis-ci/travis-core', finishedAt: '3 minutes ago', duration: '30 sec', rvm: 'rbx' }
|
||||
# { id: 2, color: 'red', number: '1.2', repo: 'travis-ci/travis-core', finishedAt: '2 minutes ago', duration: '40 sec', rvm: '1.9.3' }
|
||||
# ]
|
||||
#
|
||||
# listsJobs
|
||||
# table: '#allowed_failure_jobs'
|
||||
# headers: ['Job', 'Duration', 'Finished', 'Rvm']
|
||||
# jobs: [
|
||||
# { id: 3, color: '', number: '1.3', repo: 'travis-ci/travis-core', finishedAt: '-', duration: '-', rvm: 'jruby' }
|
||||
# ]
|
||||
|
|
|
@ -1,55 +1,100 @@
|
|||
# describe 'events', ->
|
||||
# beforeEach ->
|
||||
# app
|
||||
# waitFor buildRendered
|
||||
#
|
||||
# it 'foo', ->
|
||||
# Travis.app.receive 'job:created',
|
||||
# job:
|
||||
# id: 10
|
||||
# repository_id: 1
|
||||
# build_id: 10
|
||||
# commit_id: 10
|
||||
# log_id: 10
|
||||
# number: '10.1'
|
||||
# commit:
|
||||
# id: 10
|
||||
# sha: '1234567'
|
||||
# branch: 'master'
|
||||
# message: 'commit message 1'
|
||||
# author_name: 'author name'
|
||||
# author_email: 'author@email.com'
|
||||
# committer_name: 'committer name'
|
||||
# committer_email: 'committer@email.com'
|
||||
# compare_url: 'http://github.com/compare/0123456..1234567'
|
||||
describe 'events', ->
|
||||
# describe 'an event adding a repository', ->
|
||||
# beforeEach ->
|
||||
# app ''
|
||||
# waitFor jobsRendered
|
||||
|
||||
# it 'adds a repository to the list', ->
|
||||
# app ''
|
||||
# waitFor reposRendered
|
||||
#
|
||||
# Em.run ->
|
||||
# Travis.app.receive 'build:created',
|
||||
# repository:
|
||||
# id: 10
|
||||
# slug: 'travis-ci/travis-support'
|
||||
# last_build_id: 10
|
||||
# last_build_number: 10
|
||||
# last_build_started_at: '2012-07-02T00:02:00Z'
|
||||
# build:
|
||||
# id: 10
|
||||
# repository_id: 10
|
||||
|
||||
# listsRepo
|
||||
# row: 4
|
||||
# item: { slug: 'travis-ci/travis-support', build: { number: 4, url: '#!/travis-ci/travis-support/builds/10', duration: '1 min', finishedAt: '-' } }
|
||||
|
||||
# describe 'an event adding a build', ->
|
||||
# beforeEach ->
|
||||
# app '#!/travis-ci/travis-core/builds'
|
||||
# waitFor buildsRendered
|
||||
|
||||
# it 'adds a build to the builds list', ->
|
||||
# Em.run ->
|
||||
# Travis.app.receive 'build:finished',
|
||||
# build:
|
||||
# id: 10
|
||||
# repository_id: 1
|
||||
# commit_id: 10
|
||||
# number: '3'
|
||||
# duration: 55
|
||||
# started_at: '2012-07-02T00:02:00Z'
|
||||
# finished_at: '2012-07-02T00:02:55Z'
|
||||
# event_type: 'push'
|
||||
# result: 1
|
||||
# commit:
|
||||
# id: 10
|
||||
# sha: '1234567'
|
||||
# branch: 'master'
|
||||
# message: 'commit message 3'
|
||||
|
||||
# listsBuild
|
||||
# row: 3
|
||||
# item: { id: 10, slug: 'travis-ci/travis-core', number: '3', sha: '1234567', branch: 'master', message: 'commit message 3', finishedAt: 'less than a minute ago', duration: '55 sec', color: 'red' }
|
||||
|
||||
# describe 'an event adding a job', ->
|
||||
# beforeEach ->
|
||||
# app ''
|
||||
# waitFor jobsRendered
|
||||
# waitFor queuesRendered
|
||||
|
||||
# it 'adds a job to the jobs matrix', ->
|
||||
# Em.run ->
|
||||
# Travis.app.receive 'job:created',
|
||||
# job:
|
||||
# id: 10
|
||||
# repository_id: 1
|
||||
# build_id: 1
|
||||
# commit_id: 1
|
||||
# log_id: 1
|
||||
# number: '1.4'
|
||||
# duration: 55
|
||||
# started_at: '2012-07-02T00:02:00Z'
|
||||
# finished_at: '2012-07-02T00:02:55Z'
|
||||
# config: { rvm: 'jruby' }
|
||||
|
||||
# listsJob
|
||||
# table: '#jobs'
|
||||
# row: 3
|
||||
# item: { id: 10, number: '1.4', repo: 'travis-ci/travis-core', finishedAt: 'less than a minute ago', duration: '55 sec', rvm: 'jruby' }
|
||||
|
||||
describe 'an event adding a job', ->
|
||||
beforeEach ->
|
||||
app ''
|
||||
waitFor jobsRendered
|
||||
waitFor queuesRendered
|
||||
|
||||
it 'adds a job to the jobs queue', ->
|
||||
Em.run ->
|
||||
Travis.app.receive 'job:created',
|
||||
job:
|
||||
id: 10
|
||||
repository_id: 1
|
||||
number: '1.4'
|
||||
queue: 'common'
|
||||
|
||||
listsQueuedJob
|
||||
name: 'common'
|
||||
row: 3
|
||||
item: { number: '1.4', repo: 'travis-ci/travis-core' }
|
||||
|
||||
# Travis.app.receive 'build:started',
|
||||
# repository:
|
||||
# id: 10
|
||||
# owner: 'travis-ci'
|
||||
# name: 'travis-support'
|
||||
# slug: 'travis-ci/travis-support'
|
||||
# build_ids: [10]
|
||||
# last_build_id: 10
|
||||
# last_build_number: 10
|
||||
# last_build_started_at: '2012-07-02T00:02:00Z'
|
||||
# description: 'Description of travis-hub'
|
||||
# build:
|
||||
# id: 10
|
||||
# repository_id: 1
|
||||
# commit_id: 10
|
||||
# job_ids: [10]
|
||||
# number: 10
|
||||
# event_type: 'push'
|
||||
# config: { rvm: ['rbx'] }
|
||||
# commit:
|
||||
# id: 10
|
||||
# sha: '1234567'
|
||||
# branch: 'master'
|
||||
# message: 'commit message 1'
|
||||
# author_name: 'author name'
|
||||
# author_email: 'author@email.com'
|
||||
# committer_name: 'committer name'
|
||||
# committer_email: 'committer@email.com'
|
||||
# compare_url: 'http://github.com/compare/0123456..1234567'
|
||||
|
|
|
@ -1,46 +1,46 @@
|
|||
describe 'on the "index" state', ->
|
||||
beforeEach ->
|
||||
app ''
|
||||
waitFor buildRendered
|
||||
|
||||
it 'displays the expected stuff', ->
|
||||
displaysReposList [
|
||||
{ slug: 'travis-ci/travis-core', build: { number: 1, url: '#!/travis-ci/travis-core/builds/1', duration: '30 sec', finishedAt: '3 minutes ago' } }
|
||||
{ slug: 'travis-ci/travis-assets', build: { number: 3, url: '#!/travis-ci/travis-assets/builds/3', duration: '30 sec', finishedAt: 'a day ago' } }
|
||||
{ slug: 'travis-ci/travis-hub', build: { number: 4, url: '#!/travis-ci/travis-hub/builds/4', duration: '1 min', finishedAt: '-' } }
|
||||
]
|
||||
|
||||
displaysRepository
|
||||
href: 'http://github.com/travis-ci/travis-core'
|
||||
|
||||
displaysSummary
|
||||
type: 'build'
|
||||
id: 1
|
||||
repo: 'travis-ci/travis-core'
|
||||
commit: '1234567'
|
||||
branch: 'master'
|
||||
compare: '0123456..1234567'
|
||||
finishedAt: '3 minutes ago'
|
||||
duration: '30 sec'
|
||||
message: 'commit message 1'
|
||||
|
||||
displaysTabs
|
||||
current: { href: '#!/travis-ci/travis-core', active: true }
|
||||
builds: { href: '#!/travis-ci/travis-core/builds' }
|
||||
build: { hidden: true }
|
||||
job: { hidden: true }
|
||||
|
||||
displaysJobMatrix
|
||||
element: '#jobs'
|
||||
headers: ['Job', 'Duration', 'Finished', 'Rvm']
|
||||
jobs: [
|
||||
{ id: 1, number: '1.1', repo: 'travis-ci/travis-core', finishedAt: '3 minutes ago', duration: '30 sec', rvm: 'rbx' }
|
||||
{ id: 2, number: '1.2', repo: 'travis-ci/travis-core', finishedAt: '2 minutes ago', duration: '40 sec', rvm: '1.9.3' }
|
||||
]
|
||||
|
||||
displaysJobMatrix
|
||||
element: '#allowed_failure_jobs'
|
||||
headers: ['Job', 'Duration', 'Finished', 'Rvm']
|
||||
jobs: [
|
||||
{ id: 3, number: '1.3', repo: 'travis-ci/travis-core', finishedAt: '-', duration: '-', rvm: 'jruby' }
|
||||
]
|
||||
# describe 'on the "index" state', ->
|
||||
# beforeEach ->
|
||||
# app ''
|
||||
# waitFor buildRendered
|
||||
#
|
||||
# it 'displays the expected stuff', ->
|
||||
# listsRepos [
|
||||
# { slug: 'travis-ci/travis-core', build: { number: 1, url: '#!/travis-ci/travis-core/builds/1', duration: '30 sec', finishedAt: '3 minutes ago' } }
|
||||
# { slug: 'travis-ci/travis-assets', build: { number: 3, url: '#!/travis-ci/travis-assets/builds/3', duration: '30 sec', finishedAt: 'a day ago' } }
|
||||
# { slug: 'travis-ci/travis-hub', build: { number: 4, url: '#!/travis-ci/travis-hub/builds/4', duration: '1 min', finishedAt: '-' } }
|
||||
# ]
|
||||
#
|
||||
# displaysRepository
|
||||
# href: 'http://github.com/travis-ci/travis-core'
|
||||
#
|
||||
# displaysSummary
|
||||
# type: 'build'
|
||||
# id: 1
|
||||
# repo: 'travis-ci/travis-core'
|
||||
# commit: '1234567'
|
||||
# branch: 'master'
|
||||
# compare: '0123456..1234567'
|
||||
# finishedAt: '3 minutes ago'
|
||||
# duration: '30 sec'
|
||||
# message: 'commit message 1'
|
||||
#
|
||||
# displaysTabs
|
||||
# current: { href: '#!/travis-ci/travis-core', active: true }
|
||||
# builds: { href: '#!/travis-ci/travis-core/builds' }
|
||||
# build: { hidden: true }
|
||||
# job: { hidden: true }
|
||||
#
|
||||
# listsJobs
|
||||
# table: '#jobs'
|
||||
# headers: ['Job', 'Duration', 'Finished', 'Rvm']
|
||||
# jobs: [
|
||||
# { color: 'green', id: 1, number: '1.1', repo: 'travis-ci/travis-core', finishedAt: '3 minutes ago', duration: '30 sec', rvm: 'rbx' }
|
||||
# { color: 'red', id: 2, number: '1.2', repo: 'travis-ci/travis-core', finishedAt: '2 minutes ago', duration: '40 sec', rvm: '1.9.3' }
|
||||
# ]
|
||||
#
|
||||
# listsJobs
|
||||
# table: '#allowed_failure_jobs'
|
||||
# headers: ['Job', 'Duration', 'Finished', 'Rvm']
|
||||
# jobs: [
|
||||
# { color: '', id: 3, number: '1.3', repo: 'travis-ci/travis-core', finishedAt: '-', duration: '-', rvm: 'jruby' }
|
||||
# ]
|
||||
|
|
|
@ -1,36 +1,36 @@
|
|||
describe 'on the "job" state', ->
|
||||
beforeEach ->
|
||||
app '!/travis-ci/travis-core/jobs/1'
|
||||
waitFor jobRendered
|
||||
waitFor hasText('#tab_build', 'Build #1')
|
||||
|
||||
it 'displays the expected stuff', ->
|
||||
displaysReposList [
|
||||
{ slug: 'travis-ci/travis-core', build: { number: 1, url: '#!/travis-ci/travis-core/builds/1', duration: '30 sec', finishedAt: '3 minutes ago' } }
|
||||
{ slug: 'travis-ci/travis-assets', build: { number: 3, url: '#!/travis-ci/travis-assets/builds/3', duration: '30 sec', finishedAt: 'a day ago' } }
|
||||
{ slug: 'travis-ci/travis-hub', build: { number: 4, url: '#!/travis-ci/travis-hub/builds/4', duration: '1 min', finishedAt: '-' } }
|
||||
]
|
||||
|
||||
displaysRepository
|
||||
href: 'http://github.com/travis-ci/travis-core'
|
||||
|
||||
displaysSummary
|
||||
id: 1
|
||||
type: 'job'
|
||||
repo: 'travis-ci/travis-core'
|
||||
commit: '1234567'
|
||||
branch: 'master'
|
||||
compare: '0123456..1234567'
|
||||
finishedAt: '3 minutes ago'
|
||||
duration: '30 sec'
|
||||
message: 'commit message 1'
|
||||
|
||||
displaysTabs
|
||||
current: { href: '#!/travis-ci/travis-core' }
|
||||
builds: { href: '#!/travis-ci/travis-core/builds' }
|
||||
build: { href: '#!/travis-ci/travis-core/builds/1' }
|
||||
job: { href: '#!/travis-ci/travis-core/jobs/1', active: true }
|
||||
|
||||
displaysLog [
|
||||
'log 1'
|
||||
]
|
||||
# describe 'on the "job" state', ->
|
||||
# beforeEach ->
|
||||
# app '!/travis-ci/travis-core/jobs/1'
|
||||
# waitFor jobRendered
|
||||
# waitFor hasText('#tab_build', 'Build #1')
|
||||
#
|
||||
# it 'displays the expected stuff', ->
|
||||
# listsRepos [
|
||||
# { slug: 'travis-ci/travis-core', build: { number: 1, url: '#!/travis-ci/travis-core/builds/1', duration: '30 sec', finishedAt: '3 minutes ago' } }
|
||||
# { slug: 'travis-ci/travis-assets', build: { number: 3, url: '#!/travis-ci/travis-assets/builds/3', duration: '30 sec', finishedAt: 'a day ago' } }
|
||||
# { slug: 'travis-ci/travis-hub', build: { number: 4, url: '#!/travis-ci/travis-hub/builds/4', duration: '1 min', finishedAt: '-' } }
|
||||
# ]
|
||||
#
|
||||
# displaysRepository
|
||||
# href: 'http://github.com/travis-ci/travis-core'
|
||||
#
|
||||
# displaysSummary
|
||||
# id: 1
|
||||
# type: 'job'
|
||||
# repo: 'travis-ci/travis-core'
|
||||
# commit: '1234567'
|
||||
# branch: 'master'
|
||||
# compare: '0123456..1234567'
|
||||
# finishedAt: '3 minutes ago'
|
||||
# duration: '30 sec'
|
||||
# message: 'commit message 1'
|
||||
#
|
||||
# displaysTabs
|
||||
# current: { href: '#!/travis-ci/travis-core' }
|
||||
# builds: { href: '#!/travis-ci/travis-core/builds' }
|
||||
# build: { href: '#!/travis-ci/travis-core/builds/1' }
|
||||
# job: { href: '#!/travis-ci/travis-core/jobs/1', active: true }
|
||||
#
|
||||
# displaysLog [
|
||||
# 'log 1'
|
||||
# ]
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
@reposRendered = notEmpty('#repositories li a.current')
|
||||
@buildRendered = notEmpty('#summary .number')
|
||||
@buildsRendered = notEmpty('#builds .number')
|
||||
@matrixRendered = notEmpty('#jobs')
|
||||
@jobRendered = notEmpty('#summary .number')
|
||||
@jobsRendered = notEmpty('#jobs .number')
|
||||
@queuesRendered = notEmpty('#queue_common li')
|
||||
|
||||
|
|
|
@ -1,14 +1,3 @@
|
|||
@displaysReposList = (repos) ->
|
||||
elements = $('#repositories li').toArray()
|
||||
ix = 0
|
||||
for repo in repos
|
||||
element = elements[ix]
|
||||
expect($('a.current', element).attr('href')).toEqual "#!/#{repo.slug}"
|
||||
expect($('a.last_build', element).attr('href')).toEqual repo.build.url
|
||||
expect($('.duration', element).text()).toEqual repo.build.duration
|
||||
expect($('.finished_at', element).text()).toEqual repo.build.finishedAt
|
||||
ix += 1
|
||||
|
||||
@displaysRepository = (repo) ->
|
||||
expect($('#repository h3 a').attr('href')).toEqual (repo.href)
|
||||
|
||||
|
@ -18,7 +7,6 @@
|
|||
expect($("#tab_#{name}").hasClass('active')).toEqual !!tab.active
|
||||
expect($("#tab_#{name}").hasClass('display')).toEqual !tab.hidden if name in ['build', 'job']
|
||||
|
||||
|
||||
@displaysSummary = (data) ->
|
||||
element = $('#summary .left:first-child dt:first-child')
|
||||
expect(element.text()).toEqual $.camelize(data.type)
|
||||
|
@ -47,44 +35,80 @@
|
|||
element = $('#summary .message')
|
||||
expect(element.text()).toEqual data.message
|
||||
|
||||
@displaysJobMatrix = (data) ->
|
||||
headers = ($(element).text() for element in $("#{data.element} thead th"))
|
||||
expect(headers).toEqual(data.headers)
|
||||
|
||||
$.each data.jobs, (ix, job) ->
|
||||
ix = (ix + 1) * 3 # cuz metamorph is adding two script elements
|
||||
|
||||
element = $("#{data.element} tr:nth-child(#{ix}) td.number")
|
||||
expect(element.text()).toEqual job.number
|
||||
|
||||
element = $("#{data.element} tr:nth-child(#{ix}) td.number a")
|
||||
expect(element.attr('href')).toEqual "#!/#{job.repo}/jobs/#{job.id}"
|
||||
|
||||
element = $("#{data.element} tr:nth-child(#{ix}) td.duration")
|
||||
expect(element.text()).toEqual job.duration
|
||||
|
||||
element = $("#{data.element} tr:nth-child(#{ix}) td.finished_at")
|
||||
expect(element.text()).toEqual job.finishedAt
|
||||
|
||||
element = $("#{data.element} tr:nth-child(#{ix}) td:nth-child(6)")
|
||||
expect(element.text()).toEqual job.rvm
|
||||
|
||||
@displaysBuildsList = (builds) ->
|
||||
rows = $('#builds tbody tr').toArray()
|
||||
ix = 0
|
||||
for build in builds
|
||||
row = rows[ix]
|
||||
expect($('.number a', row).attr('href')).toEqual "#!/#{build.slug}/builds/#{build.id}"
|
||||
expect($('.number a', row).text()).toEqual build.number
|
||||
expect($('.message', row).text()).toEqual build.message
|
||||
expect($('.duration', row).text()).toEqual build.duration
|
||||
expect($('.finished_at', row).text()).toEqual build.finishedAt
|
||||
ix += 1
|
||||
|
||||
@displaysLog = (lines) ->
|
||||
ix = 0
|
||||
log = $.map(lines, (line) -> ix += 1; "#{ix}#{line}").join("\n")
|
||||
expect($('#log').text().trim()).toEqual log
|
||||
|
||||
@listsRepos = (items) ->
|
||||
listsItems('repo', items)
|
||||
|
||||
@listsRepo = (data) ->
|
||||
repo = data.repo
|
||||
row = $('#repositories li')[data.row - 1]
|
||||
|
||||
expect($('a.current', row).attr('href')).toEqual "#!/#{repo.slug}"
|
||||
expect($('a.last_build', row).attr('href')).toEqual repo.build.url
|
||||
expect($('.duration', row).text()).toEqual repo.build.duration
|
||||
expect($('.finished_at', row).text()).toEqual repo.build.finishedAt
|
||||
|
||||
@listsJobs = (data) ->
|
||||
table = $(data.table)
|
||||
headers = ($(element).text() for element in $("thead th", table))
|
||||
expect(headers).toEqual(data.headers)
|
||||
|
||||
$.each data.jobs, (row, job) -> listsJob(table: data.table, row: row + 1, job: job)
|
||||
|
||||
@listsJob = (data) ->
|
||||
row = $('tbody tr', data.table)[data.row - 1]
|
||||
job = data.job
|
||||
|
||||
element = $(row)
|
||||
expect(element.attr('class')).toEqual job.color
|
||||
|
||||
element = $("td.number", row)
|
||||
expect(element.text()).toEqual job.number
|
||||
|
||||
element = $("td.number a", row)
|
||||
expect(element.attr('href')).toEqual "#!/#{job.repo}/jobs/#{job.id}"
|
||||
|
||||
element = $("td.duration", row)
|
||||
expect(element.text()).toEqual job.duration
|
||||
|
||||
element = $("td.finished_at", row)
|
||||
expect(element.text()).toEqual job.finishedAt
|
||||
|
||||
element = $("td:nth-child(6)", row)
|
||||
expect(element.text()).toEqual job.rvm
|
||||
|
||||
@listsBuilds = (builds) ->
|
||||
listsItems('build', jobs)
|
||||
|
||||
@listsBuild = (data) ->
|
||||
row = $('#builds tbody tr')[data.row - 1]
|
||||
build = data.item
|
||||
|
||||
expect($('.number a', row).attr('href')).toEqual "#!/#{build.slug}/builds/#{build.id}"
|
||||
expect($('.number a', row).text()).toEqual build.number
|
||||
expect($('.message', row).text()).toEqual build.message
|
||||
expect($('.duration', row).text()).toEqual build.duration
|
||||
expect($('.finished_at', row).text()).toEqual build.finishedAt
|
||||
expect($(row).attr('class')).toEqual build.color
|
||||
|
||||
@listsQueuedJobs = (jobs) ->
|
||||
listsItems('queuedJob', jobs)
|
||||
|
||||
@listsQueuedJob = (data) ->
|
||||
console.log data
|
||||
job = data.item
|
||||
text = $($("#queue_#{data.name} li")[data.row - 1]).text()
|
||||
expect(text).toContain job.repo
|
||||
expect(text).toContain "##{job.number}"
|
||||
|
||||
@listsItems = (type, items) ->
|
||||
console.log items
|
||||
$.each items, (item, row) ->
|
||||
this["lists#{$.camelize(type)}"](item: item, row: row + 1)
|
||||
|
||||
|
||||
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1,101 +1,46 @@
|
|||
(function() {
|
||||
|
||||
describe('on the "build" state', function() {
|
||||
beforeEach(function() {
|
||||
app('!/travis-ci/travis-core/builds/1');
|
||||
return waitFor(buildRendered);
|
||||
});
|
||||
return it('displays the expected stuff', function() {
|
||||
displaysReposList([
|
||||
{
|
||||
slug: 'travis-ci/travis-core',
|
||||
build: {
|
||||
number: 1,
|
||||
url: '#!/travis-ci/travis-core/builds/1',
|
||||
duration: '30 sec',
|
||||
finishedAt: '3 minutes ago'
|
||||
}
|
||||
}, {
|
||||
slug: 'travis-ci/travis-assets',
|
||||
build: {
|
||||
number: 3,
|
||||
url: '#!/travis-ci/travis-assets/builds/3',
|
||||
duration: '30 sec',
|
||||
finishedAt: 'a day ago'
|
||||
}
|
||||
}, {
|
||||
slug: 'travis-ci/travis-hub',
|
||||
build: {
|
||||
number: 4,
|
||||
url: '#!/travis-ci/travis-hub/builds/4',
|
||||
duration: '1 min',
|
||||
finishedAt: '-'
|
||||
}
|
||||
}
|
||||
]);
|
||||
displaysRepository({
|
||||
href: 'http://github.com/travis-ci/travis-core'
|
||||
|
||||
|
||||
}).call(this);
|
||||
(function() {
|
||||
|
||||
|
||||
|
||||
}).call(this);
|
||||
(function() {
|
||||
|
||||
|
||||
|
||||
}).call(this);
|
||||
(function() {
|
||||
|
||||
describe('events', function() {
|
||||
return describe('an event adding a job', function() {
|
||||
beforeEach(function() {
|
||||
app('');
|
||||
waitFor(jobsRendered);
|
||||
return waitFor(queuesRendered);
|
||||
});
|
||||
displaysSummary({
|
||||
type: 'build',
|
||||
id: 1,
|
||||
repo: 'travis-ci/travis-core',
|
||||
commit: '1234567',
|
||||
branch: 'master',
|
||||
compare: '0123456..1234567',
|
||||
finishedAt: '3 minutes ago',
|
||||
duration: '30 sec',
|
||||
message: 'commit message 1'
|
||||
});
|
||||
displaysTabs({
|
||||
current: {
|
||||
href: '#!/travis-ci/travis-core'
|
||||
},
|
||||
builds: {
|
||||
href: '#!/travis-ci/travis-core/builds'
|
||||
},
|
||||
build: {
|
||||
href: '#!/travis-ci/travis-core/builds/1',
|
||||
active: true
|
||||
},
|
||||
job: {
|
||||
hidden: true
|
||||
}
|
||||
});
|
||||
displaysJobMatrix({
|
||||
element: '#jobs',
|
||||
headers: ['Job', 'Duration', 'Finished', 'Rvm'],
|
||||
jobs: [
|
||||
{
|
||||
id: 1,
|
||||
number: '1.1',
|
||||
repo: 'travis-ci/travis-core',
|
||||
finishedAt: '3 minutes ago',
|
||||
duration: '30 sec',
|
||||
rvm: 'rbx'
|
||||
}, {
|
||||
id: 2,
|
||||
number: '1.2',
|
||||
repo: 'travis-ci/travis-core',
|
||||
finishedAt: '2 minutes ago',
|
||||
duration: '40 sec',
|
||||
rvm: '1.9.3'
|
||||
return it('adds a job to the jobs queue', function() {
|
||||
Em.run(function() {
|
||||
return Travis.app.receive('job:created', {
|
||||
job: {
|
||||
id: 10,
|
||||
repository_id: 1,
|
||||
number: '1.4',
|
||||
queue: 'common'
|
||||
}
|
||||
});
|
||||
});
|
||||
return listsQueuedJob({
|
||||
name: 'common',
|
||||
row: 3,
|
||||
item: {
|
||||
number: '1.4',
|
||||
repo: 'travis-ci/travis-core'
|
||||
}
|
||||
]
|
||||
});
|
||||
return displaysJobMatrix({
|
||||
element: '#allowed_failure_jobs',
|
||||
headers: ['Job', 'Duration', 'Finished', 'Rvm'],
|
||||
jobs: [
|
||||
{
|
||||
id: 3,
|
||||
number: '1.3',
|
||||
repo: 'travis-ci/travis-core',
|
||||
finishedAt: '-',
|
||||
duration: '-',
|
||||
rvm: 'jruby'
|
||||
}
|
||||
]
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -108,283 +53,7 @@
|
|||
}).call(this);
|
||||
(function() {
|
||||
|
||||
describe('on the "current" state', function() {
|
||||
beforeEach(function() {
|
||||
app('!/travis-ci/travis-core');
|
||||
return waitFor(buildRendered);
|
||||
});
|
||||
return it('displays the expected stuff', function() {
|
||||
displaysReposList([
|
||||
{
|
||||
slug: 'travis-ci/travis-core',
|
||||
build: {
|
||||
number: 1,
|
||||
url: '#!/travis-ci/travis-core/builds/1',
|
||||
duration: '30 sec',
|
||||
finishedAt: '3 minutes ago'
|
||||
}
|
||||
}, {
|
||||
slug: 'travis-ci/travis-assets',
|
||||
build: {
|
||||
number: 3,
|
||||
url: '#!/travis-ci/travis-assets/builds/3',
|
||||
duration: '30 sec',
|
||||
finishedAt: 'a day ago'
|
||||
}
|
||||
}, {
|
||||
slug: 'travis-ci/travis-hub',
|
||||
build: {
|
||||
number: 4,
|
||||
url: '#!/travis-ci/travis-hub/builds/4',
|
||||
duration: '1 min',
|
||||
finishedAt: '-'
|
||||
}
|
||||
}
|
||||
]);
|
||||
displaysRepository({
|
||||
href: 'http://github.com/travis-ci/travis-core'
|
||||
});
|
||||
displaysSummary({
|
||||
type: 'build',
|
||||
id: 1,
|
||||
repo: 'travis-ci/travis-core',
|
||||
commit: '1234567',
|
||||
branch: 'master',
|
||||
compare: '0123456..1234567',
|
||||
finishedAt: '3 minutes ago',
|
||||
duration: '30 sec',
|
||||
message: 'commit message 1'
|
||||
});
|
||||
displaysTabs({
|
||||
current: {
|
||||
href: '#!/travis-ci/travis-core',
|
||||
active: true
|
||||
},
|
||||
builds: {
|
||||
href: '#!/travis-ci/travis-core/builds'
|
||||
},
|
||||
build: {
|
||||
hidden: true
|
||||
},
|
||||
job: {
|
||||
hidden: true
|
||||
}
|
||||
});
|
||||
displaysJobMatrix({
|
||||
element: '#jobs',
|
||||
headers: ['Job', 'Duration', 'Finished', 'Rvm'],
|
||||
jobs: [
|
||||
{
|
||||
id: 1,
|
||||
number: '1.1',
|
||||
repo: 'travis-ci/travis-core',
|
||||
finishedAt: '3 minutes ago',
|
||||
duration: '30 sec',
|
||||
rvm: 'rbx'
|
||||
}, {
|
||||
id: 2,
|
||||
number: '1.2',
|
||||
repo: 'travis-ci/travis-core',
|
||||
finishedAt: '2 minutes ago',
|
||||
duration: '40 sec',
|
||||
rvm: '1.9.3'
|
||||
}
|
||||
]
|
||||
});
|
||||
return displaysJobMatrix({
|
||||
element: '#allowed_failure_jobs',
|
||||
headers: ['Job', 'Duration', 'Finished', 'Rvm'],
|
||||
jobs: [
|
||||
{
|
||||
id: 3,
|
||||
number: '1.3',
|
||||
repo: 'travis-ci/travis-core',
|
||||
finishedAt: '-',
|
||||
duration: '-',
|
||||
rvm: 'jruby'
|
||||
}
|
||||
]
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
}).call(this);
|
||||
(function() {
|
||||
|
||||
|
||||
|
||||
}).call(this);
|
||||
(function() {
|
||||
|
||||
describe('on the "index" state', function() {
|
||||
beforeEach(function() {
|
||||
app('');
|
||||
return waitFor(buildRendered);
|
||||
});
|
||||
return it('displays the expected stuff', function() {
|
||||
displaysReposList([
|
||||
{
|
||||
slug: 'travis-ci/travis-core',
|
||||
build: {
|
||||
number: 1,
|
||||
url: '#!/travis-ci/travis-core/builds/1',
|
||||
duration: '30 sec',
|
||||
finishedAt: '3 minutes ago'
|
||||
}
|
||||
}, {
|
||||
slug: 'travis-ci/travis-assets',
|
||||
build: {
|
||||
number: 3,
|
||||
url: '#!/travis-ci/travis-assets/builds/3',
|
||||
duration: '30 sec',
|
||||
finishedAt: 'a day ago'
|
||||
}
|
||||
}, {
|
||||
slug: 'travis-ci/travis-hub',
|
||||
build: {
|
||||
number: 4,
|
||||
url: '#!/travis-ci/travis-hub/builds/4',
|
||||
duration: '1 min',
|
||||
finishedAt: '-'
|
||||
}
|
||||
}
|
||||
]);
|
||||
displaysRepository({
|
||||
href: 'http://github.com/travis-ci/travis-core'
|
||||
});
|
||||
displaysSummary({
|
||||
type: 'build',
|
||||
id: 1,
|
||||
repo: 'travis-ci/travis-core',
|
||||
commit: '1234567',
|
||||
branch: 'master',
|
||||
compare: '0123456..1234567',
|
||||
finishedAt: '3 minutes ago',
|
||||
duration: '30 sec',
|
||||
message: 'commit message 1'
|
||||
});
|
||||
displaysTabs({
|
||||
current: {
|
||||
href: '#!/travis-ci/travis-core',
|
||||
active: true
|
||||
},
|
||||
builds: {
|
||||
href: '#!/travis-ci/travis-core/builds'
|
||||
},
|
||||
build: {
|
||||
hidden: true
|
||||
},
|
||||
job: {
|
||||
hidden: true
|
||||
}
|
||||
});
|
||||
displaysJobMatrix({
|
||||
element: '#jobs',
|
||||
headers: ['Job', 'Duration', 'Finished', 'Rvm'],
|
||||
jobs: [
|
||||
{
|
||||
id: 1,
|
||||
number: '1.1',
|
||||
repo: 'travis-ci/travis-core',
|
||||
finishedAt: '3 minutes ago',
|
||||
duration: '30 sec',
|
||||
rvm: 'rbx'
|
||||
}, {
|
||||
id: 2,
|
||||
number: '1.2',
|
||||
repo: 'travis-ci/travis-core',
|
||||
finishedAt: '2 minutes ago',
|
||||
duration: '40 sec',
|
||||
rvm: '1.9.3'
|
||||
}
|
||||
]
|
||||
});
|
||||
return displaysJobMatrix({
|
||||
element: '#allowed_failure_jobs',
|
||||
headers: ['Job', 'Duration', 'Finished', 'Rvm'],
|
||||
jobs: [
|
||||
{
|
||||
id: 3,
|
||||
number: '1.3',
|
||||
repo: 'travis-ci/travis-core',
|
||||
finishedAt: '-',
|
||||
duration: '-',
|
||||
rvm: 'jruby'
|
||||
}
|
||||
]
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
}).call(this);
|
||||
(function() {
|
||||
|
||||
describe('on the "job" state', function() {
|
||||
beforeEach(function() {
|
||||
app('!/travis-ci/travis-core/jobs/1');
|
||||
waitFor(jobRendered);
|
||||
return waitFor(hasText('#tab_build', 'Build #1'));
|
||||
});
|
||||
return it('displays the expected stuff', function() {
|
||||
displaysReposList([
|
||||
{
|
||||
slug: 'travis-ci/travis-core',
|
||||
build: {
|
||||
number: 1,
|
||||
url: '#!/travis-ci/travis-core/builds/1',
|
||||
duration: '30 sec',
|
||||
finishedAt: '3 minutes ago'
|
||||
}
|
||||
}, {
|
||||
slug: 'travis-ci/travis-assets',
|
||||
build: {
|
||||
number: 3,
|
||||
url: '#!/travis-ci/travis-assets/builds/3',
|
||||
duration: '30 sec',
|
||||
finishedAt: 'a day ago'
|
||||
}
|
||||
}, {
|
||||
slug: 'travis-ci/travis-hub',
|
||||
build: {
|
||||
number: 4,
|
||||
url: '#!/travis-ci/travis-hub/builds/4',
|
||||
duration: '1 min',
|
||||
finishedAt: '-'
|
||||
}
|
||||
}
|
||||
]);
|
||||
displaysRepository({
|
||||
href: 'http://github.com/travis-ci/travis-core'
|
||||
});
|
||||
displaysSummary({
|
||||
id: 1,
|
||||
type: 'job',
|
||||
repo: 'travis-ci/travis-core',
|
||||
commit: '1234567',
|
||||
branch: 'master',
|
||||
compare: '0123456..1234567',
|
||||
finishedAt: '3 minutes ago',
|
||||
duration: '30 sec',
|
||||
message: 'commit message 1'
|
||||
});
|
||||
displaysTabs({
|
||||
current: {
|
||||
href: '#!/travis-ci/travis-core'
|
||||
},
|
||||
builds: {
|
||||
href: '#!/travis-ci/travis-core/builds'
|
||||
},
|
||||
build: {
|
||||
href: '#!/travis-ci/travis-core/builds/1'
|
||||
},
|
||||
job: {
|
||||
href: '#!/travis-ci/travis-core/jobs/1',
|
||||
active: true
|
||||
}
|
||||
});
|
||||
return displaysLog(['log 1']);
|
||||
});
|
||||
});
|
||||
|
||||
}).call(this);
|
||||
(function() {
|
||||
|
@ -442,30 +111,15 @@
|
|||
|
||||
this.buildsRendered = notEmpty('#builds .number');
|
||||
|
||||
this.matrixRendered = notEmpty('#jobs');
|
||||
|
||||
this.jobRendered = notEmpty('#summary .number');
|
||||
|
||||
this.jobsRendered = notEmpty('#jobs .number');
|
||||
|
||||
this.queuesRendered = notEmpty('#queue_common li');
|
||||
|
||||
}).call(this);
|
||||
(function() {
|
||||
|
||||
this.displaysReposList = function(repos) {
|
||||
var element, elements, ix, repo, _i, _len, _results;
|
||||
elements = $('#repositories li').toArray();
|
||||
ix = 0;
|
||||
_results = [];
|
||||
for (_i = 0, _len = repos.length; _i < _len; _i++) {
|
||||
repo = repos[_i];
|
||||
element = elements[ix];
|
||||
expect($('a.current', element).attr('href')).toEqual("#!/" + repo.slug);
|
||||
expect($('a.last_build', element).attr('href')).toEqual(repo.build.url);
|
||||
expect($('.duration', element).text()).toEqual(repo.build.duration);
|
||||
expect($('.finished_at', element).text()).toEqual(repo.build.finishedAt);
|
||||
_results.push(ix += 1);
|
||||
}
|
||||
return _results;
|
||||
};
|
||||
|
||||
this.displaysRepository = function(repo) {
|
||||
return expect($('#repository h3 a').attr('href')).toEqual(repo.href);
|
||||
};
|
||||
|
@ -510,52 +164,6 @@
|
|||
return expect(element.text()).toEqual(data.message);
|
||||
};
|
||||
|
||||
this.displaysJobMatrix = function(data) {
|
||||
var element, headers;
|
||||
headers = (function() {
|
||||
var _i, _len, _ref, _results;
|
||||
_ref = $("" + data.element + " thead th");
|
||||
_results = [];
|
||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||
element = _ref[_i];
|
||||
_results.push($(element).text());
|
||||
}
|
||||
return _results;
|
||||
})();
|
||||
expect(headers).toEqual(data.headers);
|
||||
return $.each(data.jobs, function(ix, job) {
|
||||
ix = (ix + 1) * 3;
|
||||
element = $("" + data.element + " tr:nth-child(" + ix + ") td.number");
|
||||
expect(element.text()).toEqual(job.number);
|
||||
element = $("" + data.element + " tr:nth-child(" + ix + ") td.number a");
|
||||
expect(element.attr('href')).toEqual("#!/" + job.repo + "/jobs/" + job.id);
|
||||
element = $("" + data.element + " tr:nth-child(" + ix + ") td.duration");
|
||||
expect(element.text()).toEqual(job.duration);
|
||||
element = $("" + data.element + " tr:nth-child(" + ix + ") td.finished_at");
|
||||
expect(element.text()).toEqual(job.finishedAt);
|
||||
element = $("" + data.element + " tr:nth-child(" + ix + ") td:nth-child(6)");
|
||||
return expect(element.text()).toEqual(job.rvm);
|
||||
});
|
||||
};
|
||||
|
||||
this.displaysBuildsList = function(builds) {
|
||||
var build, ix, row, rows, _i, _len, _results;
|
||||
rows = $('#builds tbody tr').toArray();
|
||||
ix = 0;
|
||||
_results = [];
|
||||
for (_i = 0, _len = builds.length; _i < _len; _i++) {
|
||||
build = builds[_i];
|
||||
row = rows[ix];
|
||||
expect($('.number a', row).attr('href')).toEqual("#!/" + build.slug + "/builds/" + build.id);
|
||||
expect($('.number a', row).text()).toEqual(build.number);
|
||||
expect($('.message', row).text()).toEqual(build.message);
|
||||
expect($('.duration', row).text()).toEqual(build.duration);
|
||||
expect($('.finished_at', row).text()).toEqual(build.finishedAt);
|
||||
_results.push(ix += 1);
|
||||
}
|
||||
return _results;
|
||||
};
|
||||
|
||||
this.displaysLog = function(lines) {
|
||||
var ix, log;
|
||||
ix = 0;
|
||||
|
@ -566,6 +174,100 @@
|
|||
return expect($('#log').text().trim()).toEqual(log);
|
||||
};
|
||||
|
||||
this.listsRepos = function(items) {
|
||||
return listsItems('repo', items);
|
||||
};
|
||||
|
||||
this.listsRepo = function(data) {
|
||||
var repo, row;
|
||||
repo = data.repo;
|
||||
row = $('#repositories li')[data.row - 1];
|
||||
expect($('a.current', row).attr('href')).toEqual("#!/" + repo.slug);
|
||||
expect($('a.last_build', row).attr('href')).toEqual(repo.build.url);
|
||||
expect($('.duration', row).text()).toEqual(repo.build.duration);
|
||||
return expect($('.finished_at', row).text()).toEqual(repo.build.finishedAt);
|
||||
};
|
||||
|
||||
this.listsJobs = function(data) {
|
||||
var element, headers, table;
|
||||
table = $(data.table);
|
||||
headers = (function() {
|
||||
var _i, _len, _ref, _results;
|
||||
_ref = $("thead th", table);
|
||||
_results = [];
|
||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||
element = _ref[_i];
|
||||
_results.push($(element).text());
|
||||
}
|
||||
return _results;
|
||||
})();
|
||||
expect(headers).toEqual(data.headers);
|
||||
return $.each(data.jobs, function(row, job) {
|
||||
return listsJob({
|
||||
table: data.table,
|
||||
row: row + 1,
|
||||
job: job
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
this.listsJob = function(data) {
|
||||
var element, job, row;
|
||||
row = $('tbody tr', data.table)[data.row - 1];
|
||||
job = data.job;
|
||||
element = $(row);
|
||||
expect(element.attr('class')).toEqual(job.color);
|
||||
element = $("td.number", row);
|
||||
expect(element.text()).toEqual(job.number);
|
||||
element = $("td.number a", row);
|
||||
expect(element.attr('href')).toEqual("#!/" + job.repo + "/jobs/" + job.id);
|
||||
element = $("td.duration", row);
|
||||
expect(element.text()).toEqual(job.duration);
|
||||
element = $("td.finished_at", row);
|
||||
expect(element.text()).toEqual(job.finishedAt);
|
||||
element = $("td:nth-child(6)", row);
|
||||
return expect(element.text()).toEqual(job.rvm);
|
||||
};
|
||||
|
||||
this.listsBuilds = function(builds) {
|
||||
return listsItems('build', jobs);
|
||||
};
|
||||
|
||||
this.listsBuild = function(data) {
|
||||
var build, row;
|
||||
row = $('#builds tbody tr')[data.row - 1];
|
||||
build = data.item;
|
||||
expect($('.number a', row).attr('href')).toEqual("#!/" + build.slug + "/builds/" + build.id);
|
||||
expect($('.number a', row).text()).toEqual(build.number);
|
||||
expect($('.message', row).text()).toEqual(build.message);
|
||||
expect($('.duration', row).text()).toEqual(build.duration);
|
||||
expect($('.finished_at', row).text()).toEqual(build.finishedAt);
|
||||
return expect($(row).attr('class')).toEqual(build.color);
|
||||
};
|
||||
|
||||
this.listsQueuedJobs = function(jobs) {
|
||||
return listsItems('queuedJob', jobs);
|
||||
};
|
||||
|
||||
this.listsQueuedJob = function(data) {
|
||||
var job, text;
|
||||
console.log(data);
|
||||
job = data.item;
|
||||
text = $($("#queue_" + data.name + " li")[data.row - 1]).text();
|
||||
expect(text).toContain(job.repo);
|
||||
return expect(text).toContain("#" + job.number);
|
||||
};
|
||||
|
||||
this.listsItems = function(type, items) {
|
||||
console.log(items);
|
||||
return $.each(items, function(item, row) {
|
||||
return this["lists" + ($.camelize(type))]({
|
||||
item: item,
|
||||
row: row + 1
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
}).call(this);
|
||||
(function() {
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user