-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Display basic table with ember-try pass/fail for each scenario
- Loading branch information
Showing
7 changed files
with
157 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import Component from '@ember/component'; | ||
import { readOnly } from '@ember/object/computed'; | ||
|
||
export default Component.extend({ | ||
tagName: '', | ||
|
||
scenarios: readOnly('results.scenarios') | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,18 @@ | ||
import { readOnly } from '@ember/object/computed'; | ||
import DS from 'ember-data'; | ||
import Model, { attr, belongsTo, hasMany } from '@ember-data/model'; | ||
|
||
export default DS.Model.extend({ | ||
succeeded: DS.attr('boolean'), | ||
statusMessage: DS.attr('string'), | ||
createdAt: DS.attr('date'), | ||
canary: DS.attr('boolean'), | ||
output: DS.attr('string'), | ||
outputFormat: DS.attr('string'), | ||
semverString: DS.attr('string'), | ||
export default Model.extend({ | ||
succeeded: attr('boolean'), | ||
statusMessage: attr('string'), | ||
createdAt: attr('date'), | ||
canary: attr('boolean'), | ||
output: attr('string'), | ||
outputFormat: attr('string'), | ||
semverString: attr('string'), | ||
emberTryResults: attr(), | ||
|
||
version: belongsTo('version'), | ||
emberVersionCompatibilities: hasMany('emberVersionCompatibility'), | ||
|
||
version: DS.belongsTo('version'), | ||
emberVersionCompatibilities: DS.hasMany('emberVersionCompatibility'), | ||
testsRunAt: readOnly('createdAt') | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<table data-test-results-table> | ||
<thead> | ||
<tr> | ||
<th>Scenario</th> | ||
<th>Result</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
{{#each this.scenarios as |scenario|}} | ||
<tr> | ||
<td>{{scenario.scenarioName}}</td> | ||
<td> | ||
{{#if scenario.passed}} | ||
Passed | ||
{{else}} | ||
Failed | ||
{{#if scenario.allowedToFail}} | ||
(allowed) | ||
{{/if}} | ||
{{/if}} | ||
</td> | ||
</tr> | ||
{{/each}} | ||
</tbody> | ||
</table> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
export default function emberTryScenario(version) { | ||
return { | ||
scenarioName: `ember-${version}`, | ||
passed: true, | ||
allowedToFail: false, | ||
dependencies: [ | ||
{ | ||
name: 'ember-source', | ||
versionSeen: `${version}.2`, | ||
versionExpected: `${version}.0`, | ||
type: 'yarn' | ||
} | ||
] | ||
}; | ||
} |
60 changes: 60 additions & 0 deletions
60
tests/integration/components/build-result-summary-table-test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import { module, test } from 'qunit'; | ||
import { setupRenderingTest } from 'ember-qunit'; | ||
import { render } from '@ember/test-helpers'; | ||
import hbs from 'htmlbars-inline-precompile'; | ||
|
||
import emberTryScenario from 'ember-observer/tests/helpers/ember-try-scenario'; | ||
|
||
module('Integration | Component | build-result-summary-table', function(hooks) { | ||
setupRenderingTest(hooks); | ||
|
||
test('displays a row for each scenario in the provided results', async function(assert) { | ||
this.emberTryResults = { | ||
scenarios: [ | ||
emberTryScenario('3.4'), | ||
emberTryScenario('3.8'), | ||
emberTryScenario('3.12'), | ||
emberTryScenario('3.13'), | ||
] | ||
}; | ||
|
||
await render(hbs` | ||
<BuildResultSummaryTable @results={{this.emberTryResults}} /> | ||
`); | ||
|
||
assert.dom('table tbody tr').exists({ count: 4 }); | ||
}); | ||
|
||
test('displays information for a scenario', async function(assert) { | ||
let scenario = emberTryScenario('3.13'); | ||
this.emberTryResults = { | ||
scenarios: [ | ||
scenario | ||
] | ||
}; | ||
|
||
await render(hbs` | ||
<BuildResultSummaryTable @results={{this.emberTryResults}} /> | ||
`); | ||
|
||
assert.dom('tbody tr td:nth-child(1)').hasText(scenario.scenarioName, 'displays scenario name in first column'); | ||
assert.dom('tbody tr td:nth-child(2)').hasText('Passed', 'displays result in second column'); | ||
}); | ||
|
||
test('when an allowed-to-fail scenario fails, result text reflects that', async function(assert) { | ||
let scenario = emberTryScenario('3.13'); | ||
scenario.allowedToFail = true; | ||
scenario.passed = false; | ||
this.emberTryResults = { | ||
scenarios: [ | ||
scenario | ||
] | ||
}; | ||
|
||
await render(hbs` | ||
<BuildResultSummaryTable @results={{this.emberTryResults}} /> | ||
`); | ||
|
||
assert.dom('tbody tr td:nth-child(2)').hasText('Failed (allowed)'); | ||
}); | ||
}); |