From c56f4321a4367fb5969f77be9f7785831d76c4ed Mon Sep 17 00:00:00 2001 From: Phil Gengler Date: Sat, 19 Oct 2019 07:02:23 -0400 Subject: [PATCH 1/7] Split built result acceptance tests into two submodules, and handle relationship setup better --- tests/acceptance/build-results-test.js | 352 ++++++++++++------------- 1 file changed, 175 insertions(+), 177 deletions(-) diff --git a/tests/acceptance/build-results-test.js b/tests/acceptance/build-results-test.js index e8910852..16b65eac 100644 --- a/tests/acceptance/build-results-test.js +++ b/tests/acceptance/build-results-test.js @@ -9,234 +9,232 @@ import moment from 'moment'; module('Acceptance | build results', function(hooks) { setupEmberObserverTest(hooks); - test('displays basic info about a build', async function(assert) { - let addon = server.create('addon'); - let addonVersion = server.create('version', { addonId: addon.id }); - server.create('testResult', { - versionId: addonVersion.id, - createdAt: moment('2016-08-07 16:30').utc() - }); + module('Index', function() { + test('displays basic info about a build', async function(assert) { + let addon = server.create('addon'); + let addonVersion = server.create('version', { addon }); + server.create('testResult', { + version: addonVersion, + createdAt: moment('2016-08-07 16:30').utc() + }); + + await login(); + await visit('/admin/build-results'); + + assert.equal(currentRouteName(), 'admin.build-results.index'); + let results = findAll('.test-build-result td'); + assert.dom(results[0]).hasText(addon.name, 'displays addon name'); + assert.dom(results[1]).hasText('1.0.0', 'displays addon version'); + assert.dom(results[2]).hasText('2016-08-07 16:30', 'displays date/time'); + }); - await login(); - await visit('/admin/build-results'); + test('sorts results by run date', async function(assert) { + let addon = server.create('addon'); + let addonVersion = server.create('version', { addon }); + let middleTestResult = server.create('testResult', { + version: addonVersion, + createdAt: moment('2016-11-19 12:00:00').utc() + }); + let earliestTestResult = server.create('testResult', { + version: addonVersion, + createdAt: moment('2016-11-19 00:00:01').utc() + }); + let latestTestResult = server.create('testResult', { + version: addonVersion, + createdAt: moment('2016-11-19 23:59:59').utc() + }); - assert.equal(currentRouteName(), 'admin.build-results.index'); - let results = findAll('.test-build-result td'); - assert.dom(results[0]).hasText(addon.name, 'displays addon name'); - assert.dom(results[1]).hasText('1.0.0', 'displays addon version'); - assert.dom(results[2]).hasText('2016-08-07 16:30', 'displays date/time'); - }); + await login(); + await visit('/admin/build-results'); - test('sorts results by run date', async function(assert) { - let addon = server.create('addon'); - let addonVersion = server.create('version', { addonId: addon.id }); - let middleTestResult = server.create('testResult', { - createdAt: moment('2016-11-19 12:00:00').utc() - }); - let earliestTestResult = server.create('testResult', { - createdAt: moment('2016-11-19 00:00:01').utc() - }); - let latestTestResult = server.create('testResult', { - createdAt: moment('2016-11-19 23:59:59').utc() - }); - addonVersion.update({ - testResultIds: [middleTestResult.id, earliestTestResult.id, latestTestResult.id] - }); - - await login(); - await visit('/admin/build-results'); + assert.dom('.test-build-result').hasAttribute('data-testResultId', `${latestTestResult.id}`); - assert.dom('.test-build-result').hasAttribute('data-testResultId', `${latestTestResult.id}`); - - let results = findAll('.test-build-result'); - assert.dom(results[1]).hasAttribute('data-testResultId', `${middleTestResult.id}`); - assert.dom(results[2]).hasAttribute('data-testResultId', `${earliestTestResult.id}`); - }); - - test('displays appropriate status based on result', async function(assert) { - let addon = server.create('addon'); - let addonVersion = server.create('version', { addonId: addon.id }); - let timedOutResult = server.create('testResult', { - succeeded: false, - statusMessage: 'timed out', - createdAt: moment().subtract(30, 'minutes').utc() - }); - let succeededResult = server.create('testResult', { - succeeded: true, - createdAt: moment().subtract(1, 'hour').utc() - }); - addonVersion.update({ - testResultIds: [timedOutResult.id, succeededResult.id] + let results = findAll('.test-build-result'); + assert.dom(results[1]).hasAttribute('data-testResultId', `${middleTestResult.id}`); + assert.dom(results[2]).hasAttribute('data-testResultId', `${earliestTestResult.id}`); }); - await login(); - await visit('/admin/build-results'); + test('displays appropriate status based on result', async function(assert) { + let addon = server.create('addon'); + let addonVersion = server.create('version', { addon }); + server.create('testResult', { + version: addonVersion, + succeeded: false, + statusMessage: 'timed out', + createdAt: moment().subtract(30, 'minutes').utc() + }); + server.create('testResult', { + version: addonVersion, + succeeded: true, + createdAt: moment().subtract(1, 'hour').utc() + }); - let results = findAll('.test-build-result'); - assert.dom(results[0]).containsText('failed - timed out', 'displays failure notice with status message for failed builds'); - assert.dom(results[1]).containsText('succeeded', 'displays "succeeded" for successful builds'); - }); + await login(); + await visit('/admin/build-results'); - test('displays semver string for non-canary builds', async function(assert) { - let addon = server.create('addon'); - let addonVersion = server.create('version', { addonId: addon.id }); - server.create('testResult', { - versionId: addonVersion.id, - canary: false, - semverString: '>= 2.0.0', - createdAt: moment('2016-08-07 16:30').utc() + let results = findAll('.test-build-result'); + assert.dom(results[0]).containsText('failed - timed out', 'displays failure notice with status message for failed builds'); + assert.dom(results[1]).containsText('succeeded', 'displays "succeeded" for successful builds'); }); - await login(); - await visit('/admin/build-results'); + test('displays semver string for non-canary builds', async function(assert) { + let addon = server.create('addon'); + let addonVersion = server.create('version', { addon }); + server.create('testResult', { + version: addonVersion, + canary: false, + semverString: '>= 2.0.0', + createdAt: moment('2016-08-07 16:30').utc() + }); - assert.dom('.test-build-result').containsText('>= 2.0.0', 'displays semver string'); + await login(); + await visit('/admin/build-results'); - await click(findByText('.test-build-result a', 'details')); + assert.dom('.test-build-result').containsText('>= 2.0.0', 'displays semver string'); - assert.dom('.test-semver-string').hasText('>= 2.0.0', 'displays semver string'); - }); + await click(findByText('.test-build-result a', 'details')); - test('displays appropriate indication for canary builds', async function(assert) { - let addon = server.create('addon'); - let addonVersion = server.create('version', { addonId: addon.id }); - server.create('testResult', { - versionId: addonVersion.id, - canary: true, - createdAt: moment('2016-08-07 16:30').utc() + assert.dom('.test-semver-string').hasText('>= 2.0.0', 'displays semver string'); }); - await login(); - await visit('/admin/build-results'); + test('displays appropriate indication for canary builds', async function(assert) { + let addon = server.create('addon'); + let addonVersion = server.create('version', { addon }); + server.create('testResult', { + version: addonVersion, + canary: true, + createdAt: moment('2016-08-07 16:30').utc() + }); - assert.dom('.test-build-result').containsText('canary', 'displays indication for canary builds on list'); + await login(); + await visit('/admin/build-results'); - await click(findByText('.test-build-result a', 'details')); - assert.dom('.test-semver-string').hasText('canary', 'displays indication for canary builds in detail'); - }); + assert.dom('.test-build-result').containsText('canary', 'displays indication for canary builds on list'); - test('links to previous day', async function(assert) { - await login(); - await visit('/admin/build-results?date=2017-02-01'); + await click(findByText('.test-build-result a', 'details')); + assert.dom('.test-semver-string').hasText('canary', 'displays indication for canary builds in detail'); + }); - assert.dom('a[href="/admin/build-results?date=2017-01-31"]').exists('has a link to the results for the previous day'); - }); + test('links to previous day', async function(assert) { + await login(); + await visit('/admin/build-results?date=2017-02-01'); - test('links to following day if not viewing the current date', async function(assert) { - await login(); - await visit('/admin/build-results?date=2016-11-18'); + assert.dom('a[href="/admin/build-results?date=2017-01-31"]').exists('has a link to the results for the previous day'); + }); - assert.dom('a[href="/admin/build-results?date=2016-11-19"]').exists('has a link to the results for the following day'); - }); + test('links to following day if not viewing the current date', async function(assert) { + await login(); + await visit('/admin/build-results?date=2016-11-18'); - test('does not link to following day if viewing the current date', async function(assert) { - let tomorrow = moment().add(1, 'day').utc().format('Y-M-D'); + assert.dom('a[href="/admin/build-results?date=2016-11-19"]').exists('has a link to the results for the following day'); + }); - await login(); - await visit('/admin/build-results'); + test('does not link to following day if viewing the current date', async function(assert) { + let tomorrow = moment().add(1, 'day').utc().format('Y-M-D'); - assert.dom(`a[href="/admin/build-results?date=${tomorrow}"]`).doesNotExist('does not have a link to the results for the following day'); - }); + await login(); + await visit('/admin/build-results'); - test('links to detail for individual builds', async function(assert) { - let version = server.create('version'); - let testResult = server.create('testResult', { versionId: version.id }); + assert.dom(`a[href="/admin/build-results?date=${tomorrow}"]`).doesNotExist('does not have a link to the results for the following day'); + }); - await login(); - await visit('/admin/build-results'); - await click(findByText('.test-build-result a', 'details')); + test('links to detail for individual builds', async function(assert) { + let version = server.create('version'); + let testResult = server.create('testResult', { version }); - await percySnapshot('/admin/build-results'); + await login(); + await visit('/admin/build-results'); + await click(findByText('.test-build-result a', 'details')); - assert.equal(currentURL(), `/admin/build-results/${testResult.id}`); - }); + await percySnapshot('/admin/build-results'); - test('detail page shows data for a build', async function(assert) { - let addon = server.create('addon'); - let version = server.create('version', { - addonId: addon.id - }); - let testResult = server.create('testResult', { - versionId: version.id, - output: 'this is the output', - createdAt: moment('2016-08-01 12:34:56').utc() + assert.equal(currentURL(), `/admin/build-results/${testResult.id}`); }); - server.db.versions.update(version, { testResultId: testResult.id }); + }); - await login(); - await visit(`/admin/build-results/${testResult.id}`); + module('Individual build detail', function() { + test('detail page shows data for a build', async function(assert) { + let addon = server.create('addon'); + let version = server.create('version', { + addon + }); + let testResult = server.create('testResult', { + version, + output: 'this is the output', + createdAt: moment('2016-08-01 12:34:56').utc() + }); - assert.dom('.test-addon-name').hasText(addon.name, 'displays addon name'); - assert.dom('.test-addon-version').hasText(version.version, 'displays addon version'); - assert.dom('.test-run-date').hasText('2016-08-01 12:34', 'displays date/time tests ran'); - assert.dom('.test-output').hasText('this is the output', "displays result's output"); - }); + await login(); + await visit(`/admin/build-results/${testResult.id}`); - test('detail page shows "succeeded" for status when build succeeded', async function(assert) { - let version = server.create('version'); - let testResult = server.create('testResult', { - versionId: version.id, - succeeded: true + assert.dom('.test-addon-name').hasText(addon.name, 'displays addon name'); + assert.dom('.test-addon-version').hasText(version.version, 'displays addon version'); + assert.dom('.test-run-date').hasText('2016-08-01 12:34', 'displays date/time tests ran'); + assert.dom('.test-output').hasText('this is the output', "displays result's output"); }); - server.db.versions.update(version, { testResultId: testResult.id }); - await login(); - await visit(`/admin/build-results/${testResult.id}`); + test('detail page shows "succeeded" for status when build succeeded', async function(assert) { + let version = server.create('version'); + let testResult = server.create('testResult', { + version, + succeeded: true + }); - assert.dom('.test-build-status').hasText('succeeded', 'displays "succeeded" for build status'); - }); + await login(); + await visit(`/admin/build-results/${testResult.id}`); - test('detail page shows status message when build did not succeeded', async function(assert) { - let version = server.create('version'); - let testResult = server.create('testResult', { - versionId: version.id, - succeeded: false, - statusMessage: 'this is the status' + assert.dom('.test-build-status').hasText('succeeded', 'displays "succeeded" for build status'); }); - server.db.versions.update(version, { testResultId: testResult.id }); - - await login(); - await visit(`/admin/build-results/${testResult.id}`); - assert.dom('.test-build-status').hasText('this is the status', 'displays status message for the build'); - }); + test('detail page shows status message when build did not succeeded', async function(assert) { + let version = server.create('version'); + let testResult = server.create('testResult', { + version, + succeeded: false, + statusMessage: 'this is the status' + }); - test('detail page has a "retry" button for failed builds', async function(assert) { - assert.expect(3); + await login(); + await visit(`/admin/build-results/${testResult.id}`); - let version = server.create('version'); - let testResult = server.create('testResult', { - versionId: version.id, - succeeded: false, - statusMessage: 'failed' + assert.dom('.test-build-status').hasText('this is the status', 'displays status message for the build'); }); - server.db.versions.update(version, { testResultId: testResult.id }); - server.post('/test_results/:id/retry', function() { - assert.ok(true, 'makes retry request'); - }); + test('detail page has a "retry" button for failed builds', async function(assert) { + assert.expect(3); - await login(); - await visit(`/admin/build-results/${testResult.id}`); + let version = server.create('version'); + let testResult = server.create('testResult', { + version, + succeeded: false, + statusMessage: 'failed' + }); - assert.dom('.test-retry-build').exists('"retry" button exists'); + server.post('/test_results/:id/retry', function() { + assert.ok(true, 'makes retry request'); + }); - await click('.test-retry-build'); + await login(); + await visit(`/admin/build-results/${testResult.id}`); - assert.dom('.test-retry-build').doesNotExist('"retry" button removed after retrying'); - }); + assert.dom('.test-retry-build').exists('"retry" button exists'); + + await click('.test-retry-build'); - test('detail page does not have a "retry" button for successful builds', async function(assert) { - let version = server.create('version'); - let testResult = server.create('testResult', { - versionId: version.id, - succeeded: true + assert.dom('.test-retry-build').doesNotExist('"retry" button removed after retrying'); }); - server.db.versions.update(version, { testResultId: testResult.id }); - await login(); - await visit(`/admin/build-results/${testResult.id}`); + test('detail page does not have a "retry" button for successful builds', async function(assert) { + let version = server.create('version'); + let testResult = server.create('testResult', { + version, + succeeded: true + }); - assert.dom('.test-retry-build').doesNotExist('no "retry" button should be displayed'); + await login(); + await visit(`/admin/build-results/${testResult.id}`); + + assert.dom('.test-retry-build').doesNotExist('no "retry" button should be displayed'); + }); }); }); From d67989c8fd5d5046c8448b40025b2811d95ca2ba Mon Sep 17 00:00:00 2001 From: Phil Gengler Date: Sun, 20 Oct 2019 16:42:33 -0400 Subject: [PATCH 2/7] Display basic table with ember-try pass/fail for each scenario --- app/components/build-result-summary-table.js | 8 +++ app/models/test-result.js | 3 + app/templates/admin/build-results/show.hbs | 4 ++ .../components/build-result-summary-table.hbs | 25 ++++++++ tests/acceptance/build-results-test.js | 32 ++++++++++ tests/helpers/ember-try-scenario.js | 15 +++++ .../build-result-summary-table-test.js | 60 +++++++++++++++++++ 7 files changed, 147 insertions(+) create mode 100644 app/components/build-result-summary-table.js create mode 100644 app/templates/components/build-result-summary-table.hbs create mode 100644 tests/helpers/ember-try-scenario.js create mode 100644 tests/integration/components/build-result-summary-table-test.js diff --git a/app/components/build-result-summary-table.js b/app/components/build-result-summary-table.js new file mode 100644 index 00000000..78fb298c --- /dev/null +++ b/app/components/build-result-summary-table.js @@ -0,0 +1,8 @@ +import Component from '@ember/component'; +import { readOnly } from '@ember/object/computed'; + +export default Component.extend({ + tagName: '', + + scenarios: readOnly('results.scenarios') +}); diff --git a/app/models/test-result.js b/app/models/test-result.js index bcc3b42a..35b15335 100644 --- a/app/models/test-result.js +++ b/app/models/test-result.js @@ -25,6 +25,9 @@ export default class TestResult extends Model { @attr('string') semverString; + @attr + emberTryResults; + @belongsTo('version') version; diff --git a/app/templates/admin/build-results/show.hbs b/app/templates/admin/build-results/show.hbs index 91c51a59..5d9315b2 100644 --- a/app/templates/admin/build-results/show.hbs +++ b/app/templates/admin/build-results/show.hbs @@ -23,6 +23,10 @@ + {{#if buildResult.emberTryResults}} + + {{/if}} +

Output

diff --git a/app/templates/components/build-result-summary-table.hbs b/app/templates/components/build-result-summary-table.hbs new file mode 100644 index 00000000..b4d4d3a1 --- /dev/null +++ b/app/templates/components/build-result-summary-table.hbs @@ -0,0 +1,25 @@ + + + + + + + + + {{#each this.scenarios as |scenario|}} + + + + + {{/each}} + +
ScenarioResult
{{scenario.scenarioName}} + {{#if scenario.passed}} + Passed + {{else}} + Failed + {{#if scenario.allowedToFail}} + (allowed) + {{/if}} + {{/if}} +
diff --git a/tests/acceptance/build-results-test.js b/tests/acceptance/build-results-test.js index 16b65eac..8ff8d65d 100644 --- a/tests/acceptance/build-results-test.js +++ b/tests/acceptance/build-results-test.js @@ -2,6 +2,7 @@ import { findAll, click, currentURL, currentRouteName, visit } from '@ember/test import { module, test } from 'qunit'; import { percySnapshot } from 'ember-percy'; import { setupEmberObserverTest } from '../helpers/setup-ember-observer-test'; +import emberTryScenario from 'ember-observer/tests/helpers/ember-try-scenario'; import findByText from '../helpers/find-by-text'; import login from 'ember-observer/tests/helpers/login'; import moment from 'moment'; @@ -236,5 +237,36 @@ module('Acceptance | build results', function(hooks) { assert.dom('.test-retry-build').doesNotExist('no "retry" button should be displayed'); }); + + test('when test result has ember-try results, displays a summary table', async function(assert) { + let testResult = server.create('testResult', { + version: server.create('version'), + succeeded: true, + emberTryResults: { + scenarios: [ + emberTryScenario('3.4'), + emberTryScenario('3.8'), + emberTryScenario('3.12'), + emberTryScenario('3.13') + ] + } + }); + + await visit(`/admin/build-results/${testResult.id}`); + + assert.dom('[data-test-results-table]').exists(); + }); + + test('when test result does not have ember-try results, does not display summary table', async function(assert) { + let testResult = server.create('testResult', { + version: server.create('version'), + succeeded: true, + emberTryResults: null + }); + + await visit(`/admin/build-results/${testResult.id}`); + + assert.dom('[data-test-results-table]').doesNotExist(); + }); }); }); diff --git a/tests/helpers/ember-try-scenario.js b/tests/helpers/ember-try-scenario.js new file mode 100644 index 00000000..56fdaf63 --- /dev/null +++ b/tests/helpers/ember-try-scenario.js @@ -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' + } + ] + }; +} diff --git a/tests/integration/components/build-result-summary-table-test.js b/tests/integration/components/build-result-summary-table-test.js new file mode 100644 index 00000000..eed381e1 --- /dev/null +++ b/tests/integration/components/build-result-summary-table-test.js @@ -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` + + `); + + 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` + + `); + + 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` + + `); + + assert.dom('tbody tr td:nth-child(2)').hasText('Failed (allowed)'); + }); +}); From 2667e357feb6be5a4e13ecf1e281de8479021f87 Mon Sep 17 00:00:00 2001 From: Katie Gengler Date: Sun, 12 Jan 2020 13:58:02 -0800 Subject: [PATCH 3/7] Update PR with master --- app/components/build-result-summary-table.js | 15 +++++++++------ app/models/test-result.js | 2 +- app/templates/admin/build-results/show.hbs | 4 ++-- tests/acceptance/build-results-test.js | 1 + 4 files changed, 13 insertions(+), 9 deletions(-) diff --git a/app/components/build-result-summary-table.js b/app/components/build-result-summary-table.js index 78fb298c..34b4371d 100644 --- a/app/components/build-result-summary-table.js +++ b/app/components/build-result-summary-table.js @@ -1,8 +1,11 @@ -import Component from '@ember/component'; +import classic from 'ember-classic-decorator'; +import { tagName } from '@ember-decorators/component'; import { readOnly } from '@ember/object/computed'; +import Component from '@ember/component'; -export default Component.extend({ - tagName: '', - - scenarios: readOnly('results.scenarios') -}); +@classic +@tagName('') +export default class BuildResultSummaryTable extends Component { + @readOnly('results.scenarios') + scenarios; +} diff --git a/app/models/test-result.js b/app/models/test-result.js index 35b15335..021045d0 100644 --- a/app/models/test-result.js +++ b/app/models/test-result.js @@ -25,7 +25,7 @@ export default class TestResult extends Model { @attr('string') semverString; - @attr + @attr() emberTryResults; @belongsTo('version') diff --git a/app/templates/admin/build-results/show.hbs b/app/templates/admin/build-results/show.hbs index 5d9315b2..e11c2889 100644 --- a/app/templates/admin/build-results/show.hbs +++ b/app/templates/admin/build-results/show.hbs @@ -23,8 +23,8 @@ - {{#if buildResult.emberTryResults}} - + {{#if this.buildResult.emberTryResults}} + {{/if}}

Output

diff --git a/tests/acceptance/build-results-test.js b/tests/acceptance/build-results-test.js index 8ff8d65d..80735a5e 100644 --- a/tests/acceptance/build-results-test.js +++ b/tests/acceptance/build-results-test.js @@ -252,6 +252,7 @@ module('Acceptance | build results', function(hooks) { } }); + await login(); await visit(`/admin/build-results/${testResult.id}`); assert.dom('[data-test-results-table]').exists(); From 90f399bae7e52622aca04f52f94e93f7b4ed141c Mon Sep 17 00:00:00 2001 From: Katie Gengler Date: Sun, 12 Jan 2020 14:16:27 -0800 Subject: [PATCH 4/7] Move component for colocation --- app/{templates => }/components/build-result-summary-table.hbs | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename app/{templates => }/components/build-result-summary-table.hbs (100%) diff --git a/app/templates/components/build-result-summary-table.hbs b/app/components/build-result-summary-table.hbs similarity index 100% rename from app/templates/components/build-result-summary-table.hbs rename to app/components/build-result-summary-table.hbs From f1a8334776b93f835e3f90c4f36b32aa2407a962 Mon Sep 17 00:00:00 2001 From: Phil Gengler Date: Sun, 26 Jan 2020 16:16:34 -0500 Subject: [PATCH 5/7] Make build result summary table not full-width and use color-coding for result column --- app/components/build-result-summary-table.hbs | 18 +++--------------- .../build-result-summary-table/row.hbs | 13 +++++++++++++ .../build-result-summary-table/row.js | 13 +++++++++++++ app/styles/_canary_test_results.scss | 2 +- 4 files changed, 30 insertions(+), 16 deletions(-) create mode 100644 app/components/build-result-summary-table/row.hbs create mode 100644 app/components/build-result-summary-table/row.js diff --git a/app/components/build-result-summary-table.hbs b/app/components/build-result-summary-table.hbs index b4d4d3a1..9934aa33 100644 --- a/app/components/build-result-summary-table.hbs +++ b/app/components/build-result-summary-table.hbs @@ -1,4 +1,4 @@ - +
@@ -7,19 +7,7 @@ {{#each this.scenarios as |scenario|}} - - - - + {{/each}} -
Scenario
{{scenario.scenarioName}} - {{#if scenario.passed}} - Passed - {{else}} - Failed - {{#if scenario.allowedToFail}} - (allowed) - {{/if}} - {{/if}} -
+ \ No newline at end of file diff --git a/app/components/build-result-summary-table/row.hbs b/app/components/build-result-summary-table/row.hbs new file mode 100644 index 00000000..c5ba5252 --- /dev/null +++ b/app/components/build-result-summary-table/row.hbs @@ -0,0 +1,13 @@ + + {{@scenario.scenarioName}} + + {{#if @scenario.passed}} + Passed + {{else}} + Failed + {{#if @scenario.allowedToFail}} + (allowed) + {{/if}} + {{/if}} + + \ No newline at end of file diff --git a/app/components/build-result-summary-table/row.js b/app/components/build-result-summary-table/row.js new file mode 100644 index 00000000..d8de185e --- /dev/null +++ b/app/components/build-result-summary-table/row.js @@ -0,0 +1,13 @@ +import Component from '@glimmer/component'; + +export default class BuildResultSummaryTableRow extends Component { + get testResultClass() { + if (this.args.scenario.passed) { + return 'passed'; + } + if (this.args.scenario.allowedToFail) { + return 'allowed-failure'; + } + return 'failed'; + } +} diff --git a/app/styles/_canary_test_results.scss b/app/styles/_canary_test_results.scss index 6e8bb75f..09ebe7ac 100644 --- a/app/styles/_canary_test_results.scss +++ b/app/styles/_canary_test_results.scss @@ -26,7 +26,7 @@ background-color: #e61313; } - &.error { + &.error, &.allowed-failure { background-color: #9e9e9e; } } From 39017ca2ebdd08e5234e9627dae9d2ec0155a590 Mon Sep 17 00:00:00 2001 From: Phil Gengler Date: Sun, 26 Jan 2020 16:27:02 -0500 Subject: [PATCH 6/7] More style improvements for table --- app/components/build-result-summary-table.hbs | 2 +- app/styles/app.scss | 1 + .../components/_build-result-summary-table.scss | 14 ++++++++++++++ app/templates/admin/build-results/show.hbs | 3 ++- 4 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 app/styles/components/_build-result-summary-table.scss diff --git a/app/components/build-result-summary-table.hbs b/app/components/build-result-summary-table.hbs index 9934aa33..655b1ca7 100644 --- a/app/components/build-result-summary-table.hbs +++ b/app/components/build-result-summary-table.hbs @@ -1,4 +1,4 @@ - +
diff --git a/app/styles/app.scss b/app/styles/app.scss index 712d80be..bdf4afa5 100644 --- a/app/styles/app.scss +++ b/app/styles/app.scss @@ -15,6 +15,7 @@ @import "addons_index"; @import "addons-list"; @import "components/build-result-output"; +@import "components/build-result-summary-table"; @import "components/code-search"; @import "components/dependency-table"; @import "components/large-search"; diff --git a/app/styles/components/_build-result-summary-table.scss b/app/styles/components/_build-result-summary-table.scss new file mode 100644 index 00000000..f581c3c8 --- /dev/null +++ b/app/styles/components/_build-result-summary-table.scss @@ -0,0 +1,14 @@ +.build-result-summary-table { + width: auto; + + td { + padding: 0.75em; + } + + th:first-child { + width: 15em; + } + th:not(:first-child) { + width: 8em; + } +} diff --git a/app/templates/admin/build-results/show.hbs b/app/templates/admin/build-results/show.hbs index e11c2889..3310eb9f 100644 --- a/app/templates/admin/build-results/show.hbs +++ b/app/templates/admin/build-results/show.hbs @@ -24,9 +24,10 @@ {{#if this.buildResult.emberTryResults}} +

Results

{{/if}}

Output

- + \ No newline at end of file From 9ba473036db5ca8b412e0a8481b5d15e3b0edcee Mon Sep 17 00:00:00 2001 From: Phil Gengler Date: Mon, 27 Jan 2020 08:42:11 -0500 Subject: [PATCH 7/7] Update .editorconfig to match linter rules for final newlines in HBS files, and fix offending files --- .editorconfig | 3 --- app/components/build-result-summary-table.hbs | 2 +- app/components/build-result-summary-table/row.hbs | 2 +- app/templates/admin/build-results/show.hbs | 2 +- 4 files changed, 3 insertions(+), 6 deletions(-) diff --git a/.editorconfig b/.editorconfig index 219985c2..12b0275a 100644 --- a/.editorconfig +++ b/.editorconfig @@ -13,8 +13,5 @@ insert_final_newline = true indent_style = space indent_size = 2 -[*.hbs] -insert_final_newline = false - [*.{diff,md}] trim_trailing_whitespace = false diff --git a/app/components/build-result-summary-table.hbs b/app/components/build-result-summary-table.hbs index 655b1ca7..3e75e092 100644 --- a/app/components/build-result-summary-table.hbs +++ b/app/components/build-result-summary-table.hbs @@ -10,4 +10,4 @@ {{/each}} -
Scenario
\ No newline at end of file + diff --git a/app/components/build-result-summary-table/row.hbs b/app/components/build-result-summary-table/row.hbs index c5ba5252..53ad92fe 100644 --- a/app/components/build-result-summary-table/row.hbs +++ b/app/components/build-result-summary-table/row.hbs @@ -10,4 +10,4 @@ {{/if}} {{/if}} - \ No newline at end of file + diff --git a/app/templates/admin/build-results/show.hbs b/app/templates/admin/build-results/show.hbs index 3310eb9f..366d1482 100644 --- a/app/templates/admin/build-results/show.hbs +++ b/app/templates/admin/build-results/show.hbs @@ -30,4 +30,4 @@

Output

- \ No newline at end of file +