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
6be5afc6
Commit
6be5afc6
authored
Mar 30, 2020
by
ioedeveloper
Committed by
Aniket
Apr 17, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added failing test case
parent
6cad4620
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
74 additions
and
16 deletions
+74
-16
test-tab.js
src/app/tabs/test-tab.js
+1
-1
solidityUnittests.js
test-browser/tests/solidityUnittests.js
+73
-15
No files found.
src/app/tabs/test-tab.js
View file @
6be5afc6
...
@@ -268,7 +268,7 @@ module.exports = class TestTab extends ViewPlugin {
...
@@ -268,7 +268,7 @@ module.exports = class TestTab extends ViewPlugin {
render
()
{
render
()
{
this
.
onActivationInternal
()
this
.
onActivationInternal
()
this
.
testsOutput
=
yo
`<div class="
${
css
.
container
}
m-3 border border-primary border-right-0 border-left-0 border-bottom-0" hidden='true' id="solidityUnittestsOutput" data-id="testTabSolidityUnitTestsOutput"></div>`
this
.
testsOutput
=
yo
`<div class="
${
css
.
container
}
m-3 border border-primary border-right-0 border-left-0 border-bottom-0" hidden='true' id="solidityUnittestsOutput" data-id="testTabSolidityUnitTestsOutput"></div>`
this
.
testsSummary
=
yo
`<div class="
${
css
.
container
}
border border-primary border-right-0 border-left-0 border-bottom-0" hidden='true' id="solidityUnittestsSummary"></div>`
this
.
testsSummary
=
yo
`<div class="
${
css
.
container
}
border border-primary border-right-0 border-left-0 border-bottom-0" hidden='true' id="solidityUnittestsSummary"
data-id="testTabSolidityUnitTestsSummary"
></div>`
this
.
loading
=
yo
`<span class='text-info ml-1'>Running tests...</span>`
this
.
loading
=
yo
`<span class='text-info ml-1'>Running tests...</span>`
this
.
loading
.
hidden
=
true
this
.
loading
.
hidden
=
true
var
el
=
yo
`
var
el
=
yo
`
...
...
test-browser/tests/solidityUnittests.js
View file @
6be5afc6
...
@@ -44,10 +44,13 @@ module.exports = {
...
@@ -44,10 +44,13 @@ module.exports = {
.
click
(
'*[data-id="testTabCheckAllTests"]'
)
.
click
(
'*[data-id="testTabCheckAllTests"]'
)
.
click
(
'.singleTestLabel:nth-of-type(2)'
)
.
click
(
'.singleTestLabel:nth-of-type(2)'
)
.
scrollAndClick
(
'*[data-id="testTabRunTestsTabRunAction"]'
)
.
scrollAndClick
(
'*[data-id="testTabRunTestsTabRunAction"]'
)
.
pause
(
1
0
000
)
.
pause
(
1
5
000
)
.
assert
.
containsText
(
'*[data-id="testTabSolidityUnitTestsOutput"]'
,
'browser/simple_storage_test.sol (MyTest)'
)
.
assert
.
containsText
(
'*[data-id="testTabSolidityUnitTestsOutput"]'
,
'browser/simple_storage_test.sol (MyTest)'
)
.
assert
.
containsText
(
'*[data-id="testTabSolidityUnitTestsOutput"]'
,
'✓ (Initial value should be100)'
)
.
assert
.
containsText
(
'*[data-id="testTabSolidityUnitTestsOutput"]'
,
'✓ (Initial value should be100)'
)
.
assert
.
containsText
(
'*[data-id="testTabSolidityUnitTestsOutput"]'
,
'✓ (Value is set200)'
)
.
assert
.
containsText
(
'*[data-id="testTabSolidityUnitTestsOutput"]'
,
'✓ (Value is set200)'
)
.
assert
.
containsText
(
'*[data-id="testTabSolidityUnitTestsOutput"]'
,
'✘ (Should fail for wrong value200)'
)
.
assert
.
containsText
(
'*[data-id="testTabSolidityUnitTestsSummary"]'
,
'1 failing'
)
.
assert
.
containsText
(
'*[data-id="testTabSolidityUnitTestsSummary"]'
,
'2 passing'
)
},
},
'Should run advance unit test using natspec and experimental ABIEncoderV2 `ks2b_test.sol` '
:
function
(
browser
)
{
'Should run advance unit test using natspec and experimental ABIEncoderV2 `ks2b_test.sol` '
:
function
(
browser
)
{
...
@@ -59,34 +62,62 @@ module.exports = {
...
@@ -59,34 +62,62 @@ module.exports = {
.
click
(
'*[data-id="testTabCheckAllTests"]'
)
.
click
(
'*[data-id="testTabCheckAllTests"]'
)
.
click
(
'.singleTestLabel:nth-of-type(3)'
)
.
click
(
'.singleTestLabel:nth-of-type(3)'
)
.
scrollAndClick
(
'*[data-id="testTabRunTestsTabRunAction"]'
)
.
scrollAndClick
(
'*[data-id="testTabRunTestsTabRunAction"]'
)
.
pause
(
1
0
000
)
.
pause
(
1
5
000
)
.
assert
.
containsText
(
'*[data-id="testTabSolidityUnitTestsOutput"]'
,
'browser/ks2b_test.sol (kickstarterTest)'
)
.
assert
.
containsText
(
'*[data-id="testTabSolidityUnitTestsOutput"]'
,
'browser/ks2b_test.sol (kickstarterTest)'
)
.
assert
.
containsText
(
'*[data-id="testTabSolidityUnitTestsOutput"]'
,
'✓ (Check project exists)'
)
.
assert
.
containsText
(
'*[data-id="testTabSolidityUnitTestsOutput"]'
,
'✓ (Check project exists)'
)
.
assert
.
containsText
(
'*[data-id="testTabSolidityUnitTestsOutput"]'
,
'✓ (Check project is fundable)'
)
.
assert
.
containsText
(
'*[data-id="testTabSolidityUnitTestsOutput"]'
,
'✓ (Check project is fundable)'
)
},
},
'Should
run all test files
'
:
function
(
browser
)
{
'Should
fail on compilation
'
:
function
(
browser
)
{
browser
.
waitForElementPresent
(
'*[data-id="verticalIconsKindfileExplorers"]'
)
browser
.
waitForElementPresent
(
'*[data-id="verticalIconsKindfileExplorers"]'
)
.
addFile
(
'compilationError_test.sol'
,
sources
[
0
][
'browser/compilationError_test.sol'
])
.
clickLaunchIcon
(
'fileExplorers'
)
.
clickLaunchIcon
(
'fileExplorers'
)
.
switchFile
(
'browser/
3_Ballo
t.sol'
)
.
switchFile
(
'browser/
compilationError_tes
t.sol'
)
.
clickLaunchIcon
(
'solidityUnitTesting'
)
.
clickLaunchIcon
(
'solidityUnitTesting'
)
.
click
(
'*[data-id="testTabCheckAllTests"]'
)
.
click
(
'.singleTestLabel:nth-of-type(4)'
)
.
scrollAndClick
(
'*[data-id="testTabRunTestsTabRunAction"]'
)
.
scrollAndClick
(
'*[data-id="testTabRunTestsTabRunAction"]'
)
.
pause
(
30000
)
.
pause
(
5000
)
.
assert
.
containsText
(
'*[data-id="testTabSolidityUnitTestsOutput"]'
,
'browser/4_Ballot_test.sol (BallotTest)'
)
.
waitForElementPresent
(
'*[data-id="testTabSolidityUnitTestsSummary"]'
)
.
assert
.
containsText
(
'*[data-id="testTabSolidityUnitTestsOutput"]'
,
'✓ (Check winning proposal)'
)
.
assert
.
containsText
(
'*[data-id="testTabSolidityUnitTestsSummary"]'
,
'SyntaxError: No visibility specified'
)
.
assert
.
containsText
(
'*[data-id="testTabSolidityUnitTestsOutput"]'
,
'✓ (Check winnin proposal with return value)'
)
},
.
assert
.
containsText
(
'*[data-id="testTabSolidityUnitTestsOutput"]'
,
'browser/simple_storage_test.sol (MyTest)'
)
.
assert
.
containsText
(
'*[data-id="testTabSolidityUnitTestsOutput"]'
,
'✓ (Initial value should be100)'
)
'Should fail on deploy'
:
function
(
browser
)
{
.
assert
.
containsText
(
'*[data-id="testTabSolidityUnitTestsOutput"]'
,
'✓ (Value is set200)'
)
browser
.
waitForElementPresent
(
'*[data-id="verticalIconsKindfileExplorers"]'
)
.
assert
.
containsText
(
'*[data-id="testTabSolidityUnitTestsOutput"]'
,
'browser/ks2b_test.sol (kickstarterTest)'
)
.
addFile
(
'deployError_test.sol'
,
sources
[
0
][
'browser/deployError_test.sol'
])
.
assert
.
containsText
(
'*[data-id="testTabSolidityUnitTestsOutput"]'
,
'✓ (Check project exists)'
)
.
clickLaunchIcon
(
'fileExplorers'
)
.
assert
.
containsText
(
'*[data-id="testTabSolidityUnitTestsOutput"]'
,
'✓ (Check project is fundable)'
)
.
switchFile
(
'browser/deployError_test.sol'
)
.
end
()
.
clickLaunchIcon
(
'solidityUnitTesting'
)
.
click
(
'*[data-id="testTabCheckAllTests"]'
)
.
click
(
'.singleTestLabel:nth-of-type(5)'
)
.
scrollAndClick
(
'*[data-id="testTabRunTestsTabRunAction"]'
)
.
pause
(
10000
)
.
waitForElementPresent
(
'*[data-id="testTabSolidityUnitTestsSummary"]'
)
.
assert
.
containsText
(
'*[data-id="testTabSolidityUnitTestsSummary"]'
,
'contract deployment failed after trying twice'
)
},
'Solidity Unittests'
:
function
(
browser
)
{
runTests
(
browser
)
},
},
tearDown
:
sauce
tearDown
:
sauce
}
}
function
runTests
(
browser
)
{
browser
.
waitForElementPresent
(
'*[data-id="verticalIconsKindfileExplorers"]'
)
.
clickLaunchIcon
(
'fileExplorers'
)
.
switchFile
(
'browser/3_Ballot.sol'
)
.
clickLaunchIcon
(
'solidityUnitTesting'
)
.
scrollAndClick
(
'#runTestsTabRunAction'
)
.
waitForElementPresent
(
'#solidityUnittestsOutput div[class^="testPass"]'
)
.
pause
(
10000
)
.
assert
.
containsText
(
'#solidityUnittestsOutput'
,
'browser/4_Ballot_test.sol (BallotTest)'
)
.
assert
.
containsText
(
'#solidityUnittestsOutput'
,
'✓ (Check winning proposal)'
)
.
assert
.
containsText
(
'#solidityUnittestsOutput'
,
'✓ (Check winnin proposal with return value)'
)
.
end
()
}
var
sources
=
[
var
sources
=
[
{
{
'browser/simple_storage.sol'
:
{
'browser/simple_storage.sol'
:
{
...
@@ -131,6 +162,11 @@ var sources = [
...
@@ -131,6 +162,11 @@ var sources = [
foo.set(200);
foo.set(200);
return Assert.equal(foo.get(), 200, "value is not 200");
return Assert.equal(foo.get(), 200, "value is not 200");
}
}
function shouldFailForWrongValue200() public returns (bool) {
foo.set(300);
return Assert.equal(foo.get(), 200, "value is not 200");
}
}
}
`
`
},
},
...
@@ -224,6 +260,28 @@ var sources = [
...
@@ -224,6 +260,28 @@ var sources = [
}
}
}
}
`
`
},
'browser/compilationError_test.sol'
:
{
content
:
`
pragma solidity ^0.6.1;
contract failOnCompilation {
fallback() {
}
}
`
},
'browser/deployError_test.sol'
:
{
content
:
`
pragma solidity ^0.6.0;
contract failingDeploy {
constructor() public {
revert('Deploy Failed');
}
}
`
}
}
}
}
]
]
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