From 85dcb8f7f46ffdfd1088677a75454632c1300272 Mon Sep 17 00:00:00 2001 From: pissang Date: Sun, 8 Sep 2019 23:04:14 +0800 Subject: [PATCH] test: add icon for tests recorded actions in ui. --- test/runTest/client/client.css | 5 +++++ test/runTest/client/client.js | 1 + test/runTest/client/index.html | 2 +- test/runTest/recorder/index.html | 7 +++++-- test/runTest/server.js | 9 ++++++++- test/runTest/store.js | 12 ++++++++++++ 6 files changed, 32 insertions(+), 4 deletions(-) diff --git a/test/runTest/client/client.css b/test/runTest/client/client.css index 1b2b025b8..489aab380 100644 --- a/test/runTest/client/client.css +++ b/test/runTest/client/client.css @@ -58,6 +58,7 @@ color: #f3f3f3; font-size: 20px; margin-left: 5px; + cursor: pointer; } .run-config-item { margin: 5px 0; @@ -91,6 +92,10 @@ margin-left: 3px; cursor: pointer; } +.test-list li a.menu-link i { + font-size: 16px; + margin-left: 10px; +} .test-list li.active { background: #e43c59; diff --git a/test/runTest/client/client.js b/test/runTest/client/client.js index 6ac28a167..bfd1e0454 100644 --- a/test/runTest/client/client.js +++ b/test/runTest/client/client.js @@ -196,6 +196,7 @@ socket.on('connect', () => { position: 'top-right', duration: 8000 }); + console.log(`${res.count} test complete, Cost: ${(res.time / 1000).toFixed(1)} s. Threads: ${res.threads}`); app.running = false; }); diff --git a/test/runTest/client/index.html b/test/runTest/client/index.html index aad6d8348..d2d5720a6 100644 --- a/test/runTest/client/index.html +++ b/test/runTest/client/index.html @@ -67,7 +67,7 @@ :percentage="test.percentage" :status="test.summary" > - {{test.name}} + {{test.name}} diff --git a/test/runTest/recorder/index.html b/test/runTest/recorder/index.html index ae54398ba..f077d43da 100644 --- a/test/runTest/recorder/index.html +++ b/test/runTest/recorder/index.html @@ -58,8 +58,11 @@ v-show="drawerVisible" > diff --git a/test/runTest/server.js b/test/runTest/server.js index 1cf628c14..0d18d650a 100644 --- a/test/runTest/server.js +++ b/test/runTest/server.js @@ -222,7 +222,14 @@ async function start() { socket.emit('finish'); }); - socket.emit('getTests', {tests: getTestsList().map(test => test.name)}); + socket.emit('getTests', { + tests: getTestsList().map(test => { + return { + name: test.name, + hasActions: test.hasActions + }; + }) + }); }); console.log(`Dashboard: ${origin}/test/runTest/client/index.html`); diff --git a/test/runTest/store.js b/test/runTest/store.js index 9851b0203..f5adc5eed 100644 --- a/test/runTest/store.js +++ b/test/runTest/store.js @@ -62,6 +62,18 @@ module.exports.updateTestsList = async function () { _tests.push(test); _testsMap[fileUrl] = test; }); + let statAsync = util.promisify(fs.stat); + // Find if file has actions. + await Promise.all(_tests.map(testOpt => { + return statAsync(path.join(__dirname, 'actions', testOpt.name + '.json')) + .then(() => { + testOpt.hasActions = true; + }) + .catch(() => { + testOpt.hasActions = false; + }); + })); + return _tests; }; -- GitLab