Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
baas-ide
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
guxukai
baas-ide
Commits
47e35676
Commit
47e35676
authored
Apr 21, 2020
by
LianaHus
Committed by
Aniket
Apr 24, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added progress for results
parent
fd67fd3f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
15 deletions
+36
-15
test-tab.js
src/app/tabs/test-tab.js
+36
-15
No files found.
src/app/tabs/test-tab.js
View file @
47e35676
...
@@ -148,6 +148,8 @@ module.exports = class TestTab extends ViewPlugin {
...
@@ -148,6 +148,8 @@ module.exports = class TestTab extends ViewPlugin {
this
.
testsSummary
.
appendChild
(
yo
`<div class=
${
css
.
summaryTitle
}
>
${
filename
}
</div>`
)
this
.
testsSummary
.
appendChild
(
yo
`<div class=
${
css
.
summaryTitle
}
>
${
filename
}
</div>`
)
if
(
result
)
{
if
(
result
)
{
++
this
.
readyTestsNumber
yo
.
update
(
this
.
resultStatistics
,
this
.
createResultLabel
())
if
(
result
.
totalPassing
>
0
)
{
if
(
result
.
totalPassing
>
0
)
{
this
.
testsSummary
.
appendChild
(
yo
`<div class="text-success">
${
result
.
totalPassing
}
passing (
${
result
.
totalTime
}
s)</div>`
)
this
.
testsSummary
.
appendChild
(
yo
`<div class="text-success">
${
result
.
totalPassing
}
passing (
${
result
.
totalTime
}
s)</div>`
)
this
.
testsSummary
.
appendChild
(
yo
`<br>`
)
this
.
testsSummary
.
appendChild
(
yo
`<br>`
)
...
@@ -163,15 +165,17 @@ module.exports = class TestTab extends ViewPlugin {
...
@@ -163,15 +165,17 @@ module.exports = class TestTab extends ViewPlugin {
})
})
}
}
if
(
this
.
hasBeenStopped
)
{
if
(
this
.
hasBeenStopped
)
{
this
.
testsSummary
.
appendChild
(
yo
`<label class="text-warning h5">The test execution has been stopped</label>`
)
this
.
testsExecutionStopped
.
hidden
=
false
}
if
(
this
.
hasBeenStopped
||
this
.
readyTestsNumber
===
this
.
data
.
selectedTests
.
length
)
{
// All tests are ready or the operation has been canceled
const
stopBtn
=
document
.
getElementById
(
'runTestsTabStopAction'
)
stopBtn
.
setAttribute
(
'disabled'
,
'disabled'
)
const
stopBtnLabel
=
document
.
getElementById
(
'runTestsTabStopActionLabel'
)
stopBtnLabel
.
innerText
=
'Stop'
const
runBtn
=
document
.
getElementById
(
'runTestsTabRunAction'
)
runBtn
.
removeAttribute
(
'disabled'
)
}
}
const
stopBtn
=
document
.
getElementById
(
'runTestsTabStopAction'
)
const
stopBtnLabel
=
document
.
getElementById
(
'runTestsTabStopActionLabel'
)
stopBtnLabel
.
innerText
=
'Stop'
stopBtn
.
setAttribute
(
'disabled'
,
'disabled'
)
const
runBtn
=
document
.
getElementById
(
'runTestsTabRunAction'
)
runBtn
.
removeAttribute
(
'disabled'
)
}
}
async
testFromPath
(
path
)
{
async
testFromPath
(
path
)
{
...
@@ -208,7 +212,7 @@ module.exports = class TestTab extends ViewPlugin {
...
@@ -208,7 +212,7 @@ module.exports = class TestTab extends ViewPlugin {
this
.
updateFinalResult
()
this
.
updateFinalResult
()
return
return
}
}
this
.
loading
.
hidden
=
false
this
.
resultStatistics
.
hidden
=
false
this
.
fileManager
.
getFile
(
testFilePath
).
then
((
content
)
=>
{
this
.
fileManager
.
getFile
(
testFilePath
).
then
((
content
)
=>
{
const
runningTest
=
{}
const
runningTest
=
{}
runningTest
[
testFilePath
]
=
{
content
}
runningTest
[
testFilePath
]
=
{
content
}
...
@@ -227,7 +231,6 @@ module.exports = class TestTab extends ViewPlugin {
...
@@ -227,7 +231,6 @@ module.exports = class TestTab extends ViewPlugin {
(
_err
,
result
,
cb
)
=>
this
.
resultsCallback
(
_err
,
result
,
cb
),
(
_err
,
result
,
cb
)
=>
this
.
resultsCallback
(
_err
,
result
,
cb
),
(
error
,
result
)
=>
{
(
error
,
result
)
=>
{
this
.
updateFinalResult
(
error
,
result
,
testFilePath
)
this
.
updateFinalResult
(
error
,
result
,
testFilePath
)
this
.
loading
.
hidden
=
true
callback
(
error
)
callback
(
error
)
},
(
url
,
cb
)
=>
{
},
(
url
,
cb
)
=>
{
return
this
.
compileTab
.
compileTabLogic
.
importFileCb
(
url
,
cb
)
return
this
.
compileTab
.
compileTabLogic
.
importFileCb
(
url
,
cb
)
...
@@ -240,6 +243,8 @@ module.exports = class TestTab extends ViewPlugin {
...
@@ -240,6 +243,8 @@ module.exports = class TestTab extends ViewPlugin {
runTests
()
{
runTests
()
{
this
.
hasBeenStopped
=
false
this
.
hasBeenStopped
=
false
this
.
readyTestsNumber
=
0
yo
.
update
(
this
.
resultStatistics
,
this
.
createResultLabel
())
const
stopBtn
=
document
.
getElementById
(
'runTestsTabStopAction'
)
const
stopBtn
=
document
.
getElementById
(
'runTestsTabStopAction'
)
stopBtn
.
removeAttribute
(
'disabled'
)
stopBtn
.
removeAttribute
(
'disabled'
)
const
runBtn
=
document
.
getElementById
(
'runTestsTabRunAction'
)
const
runBtn
=
document
.
getElementById
(
'runTestsTabRunAction'
)
...
@@ -247,10 +252,14 @@ module.exports = class TestTab extends ViewPlugin {
...
@@ -247,10 +252,14 @@ module.exports = class TestTab extends ViewPlugin {
this
.
call
(
'editor'
,
'clearAnnotations'
)
this
.
call
(
'editor'
,
'clearAnnotations'
)
this
.
testsOutput
.
innerHTML
=
''
this
.
testsOutput
.
innerHTML
=
''
this
.
testsSummary
.
innerHTML
=
''
this
.
testsSummary
.
innerHTML
=
''
this
.
testsExecutionStopped
.
hidden
=
true
const
tests
=
this
.
data
.
selectedTests
const
tests
=
this
.
data
.
selectedTests
if
(
!
tests
)
return
if
(
!
tests
)
return
this
.
loading
.
hidden
=
tests
.
length
===
0
this
.
resultStatistics
.
hidden
=
tests
.
length
===
0
async
.
eachOfSeries
(
tests
,
(
value
,
key
,
callback
)
=>
{
if
(
this
.
hasBeenStopped
)
return
;
this
.
runTest
(
value
,
callback
)
})
async
.
eachOfSeries
(
tests
,
(
value
,
key
,
callback
)
=>
{
if
(
this
.
hasBeenStopped
)
return
this
.
runTest
(
value
,
callback
)
})
}
}
stopTests
()
{
stopTests
()
{
...
@@ -353,12 +362,21 @@ module.exports = class TestTab extends ViewPlugin {
...
@@ -353,12 +362,21 @@ module.exports = class TestTab extends ViewPlugin {
<
/a
>
<
/a
>
`
`
}
}
createResultLabel () {
if (!this.data.selectedTests) return yo`
<
span
><
/span>
`
const
ready
=
this
.
readyTestsNumber
?
`
${
this
.
readyTestsNumber
}
`
:
'0'
return
yo
`<span class='text-info ml-1'>Progress:
${
ready
}
finished (out of
${
this
.
data
.
selectedTests
.
length
}
)</span>`
}
render () {
render () {
this.onActivationInternal()
this.onActivationInternal()
this.testsOutput = yo`
<
div
class
=
"${css.container} mx-3 border-top border-primary"
hidden
=
'true'
id
=
"solidityUnittestsOutput"
data
-
id
=
"testTabSolidityUnitTestsOutput"
><
/a>
`
this.testsOutput = yo`
<
div
class
=
"${css.container} mx-3 border-top border-primary"
hidden
=
'true'
id
=
"solidityUnittestsOutput"
data
-
id
=
"testTabSolidityUnitTestsOutput"
><
/a>
`
this
.
testsSummary
=
yo
`<div class="
${
css
.
container
}
mx-3 pt-2 border-top border-primary" hidden='true' id="solidityUnittestsSummary" data-id="testTabSolidityUnitTestsSummary"></div>`
this
.
testsSummary
=
yo
`<div class="
${
css
.
container
}
mx-3 pt-2 border-top border-primary" hidden='true' id="solidityUnittestsSummary" data-id="testTabSolidityUnitTestsSummary"></div>`
this
.
loading
=
yo
`<span class='text-info ml-1'>Running tests...</span>`
this
.
testsExecutionStopped
=
yo
`<label class="text-warning h5">The test execution has been stopped</label>`
this
.
loading
.
hidden
=
true
this
.
testsExecutionStopped
.
hidden
=
true
this
.
resultStatistics
=
this
.
createResultLabel
()
this
.
resultStatistics
.
hidden
=
true
var
el
=
yo
`
var
el
=
yo
`
<div class="
${
css
.
testTabView
}
px-2" id="testView">
<div class="
${
css
.
testTabView
}
px-2" id="testView">
<div class="
${
css
.
infoBox
}
">
<div class="
${
css
.
infoBox
}
">
...
@@ -376,7 +394,10 @@ module.exports = class TestTab extends ViewPlugin {
...
@@ -376,7 +394,10 @@ module.exports = class TestTab extends ViewPlugin {
</div>
</div>
${
this
.
selectAll
()}
${
this
.
selectAll
()}
${
this
.
updateTestFileList
()}
${
this
.
updateTestFileList
()}
<div class="
${
css
.
buttons
}
mt-2 mb-0"><h6>Results:
${
this
.
loading
}
</h6></div>
<div class="align-items-start flex-column mt-2 mb-0">
<h6>
${
this
.
resultStatistics
}
</h6>
${
this
.
testsExecutionStopped
}
</div>
${
this
.
testsOutput
}
${
this
.
testsOutput
}
${
this
.
testsSummary
}
${
this
.
testsSummary
}
</div>
</div>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment