From d561931f605aa0f8e762211175ff3683cc88cb43 Mon Sep 17 00:00:00 2001 From: pissang Date: Wed, 11 Sep 2019 16:49:09 +0800 Subject: [PATCH] test: add more run options. --- test/runTest/client/client.js | 44 +++++++++++++++++++++++----------- test/runTest/client/index.html | 7 +++--- 2 files changed, 34 insertions(+), 17 deletions(-) diff --git a/test/runTest/client/client.js b/test/runTest/client/client.js index 2cd05634f..7f644eda2 100644 --- a/test/runTest/client/client.js +++ b/test/runTest/client/client.js @@ -109,6 +109,22 @@ const app = new Vue({ }).sort(sortFunc); }, + selectedTests() { + return this.fullTests.filter(test => { + return test.selected; + }); + }, + unfinishedTests() { + return this.fullTests.filter(test => { + return test.status !== 'finished'; + }); + }, + failedTests() { + return this.fullTests.filter(test => { + return test.status === 'finished' && test.summary !== 'success'; + }); + }, + currentTest() { let currentTest = this.fullTests.find(item => item.name === this.currentTestName); if (!currentTest) { @@ -171,20 +187,20 @@ const app = new Vue({ runTests([testName]); }, run(runTarget) { - const tests = this.fullTests.filter(test => { - if (runTarget === 'selected') { - return test.selected; - } - else if (runTarget === 'unfinished') { - return test.status !== 'finished'; - } - else { // Run all - return true; - } - }).map(test => { - return test.name; - }); - runTests(tests); + let tests; + if (runTarget === 'selected') { + tests = this.selectedTests; + } + else if (runTarget === 'unfinished') { + tests = this.unfinishedTests; + } + else if (runTarget === 'failed') { + tests = this.failedTests; + } + else { + tests = this.fullTests; + } + runTests(tests.map(test => test.name)); }, stopTests() { this.running = false; diff --git a/test/runTest/client/index.html b/test/runTest/client/index.html index 64c2eba62..8706c3324 100644 --- a/test/runTest/client/index.html +++ b/test/runTest/client/index.html @@ -46,10 +46,11 @@ under the License. @click="run('selected')" @command="run" > - Run selected + Run selected ({{selectedTests.length}}) - Run unfinished - Run all + Run unfinished ({{unfinishedTests.length}}) + Run failed ({{failedTests.length}}) + Run all ({{fullTests.length}}) -- GitLab