提交 d561931f 编写于 作者: P pissang

test: add more run options.

上级 61e5a01b
...@@ -109,6 +109,22 @@ const app = new Vue({ ...@@ -109,6 +109,22 @@ const app = new Vue({
}).sort(sortFunc); }).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() { currentTest() {
let currentTest = this.fullTests.find(item => item.name === this.currentTestName); let currentTest = this.fullTests.find(item => item.name === this.currentTestName);
if (!currentTest) { if (!currentTest) {
...@@ -171,20 +187,20 @@ const app = new Vue({ ...@@ -171,20 +187,20 @@ const app = new Vue({
runTests([testName]); runTests([testName]);
}, },
run(runTarget) { run(runTarget) {
const tests = this.fullTests.filter(test => { let tests;
if (runTarget === 'selected') { if (runTarget === 'selected') {
return test.selected; tests = this.selectedTests;
} }
else if (runTarget === 'unfinished') { else if (runTarget === 'unfinished') {
return test.status !== 'finished'; tests = this.unfinishedTests;
} }
else { // Run all else if (runTarget === 'failed') {
return true; tests = this.failedTests;
} }
}).map(test => { else {
return test.name; tests = this.fullTests;
}); }
runTests(tests); runTests(tests.map(test => test.name));
}, },
stopTests() { stopTests() {
this.running = false; this.running = false;
......
...@@ -46,10 +46,11 @@ under the License. ...@@ -46,10 +46,11 @@ under the License.
@click="run('selected')" @click="run('selected')"
@command="run" @command="run"
> >
<i class="el-icon-caret-right"></i> Run selected <i class="el-icon-caret-right"></i> Run selected ({{selectedTests.length}})
<el-dropdown-menu slot="dropdown" > <el-dropdown-menu slot="dropdown" >
<el-dropdown-item command="unfinished">Run unfinished</el-dropdown-item> <el-dropdown-item command="unfinished">Run unfinished ({{unfinishedTests.length}})</el-dropdown-item>
<el-dropdown-item command="all">Run all</el-dropdown-item> <el-dropdown-item command="failed">Run failed ({{failedTests.length}})</el-dropdown-item>
<el-dropdown-item command="all">Run all ({{fullTests.length}})</el-dropdown-item>
</el-dropdown-menu> </el-dropdown-menu>
</el-dropdown> </el-dropdown>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册