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
26c3dd79
Commit
26c3dd79
authored
Apr 10, 2020
by
ioedeveloper
Committed by
Aniket
Apr 17, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added failing test cases and removed custom sender from beforeAll
parent
6be5afc6
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
5 deletions
+37
-5
solidityUnittests.js
test-browser/tests/solidityUnittests.js
+37
-5
No files found.
test-browser/tests/solidityUnittests.js
View file @
26c3dd79
...
@@ -64,8 +64,9 @@ module.exports = {
...
@@ -64,8 +64,9 @@ module.exports = {
.
scrollAndClick
(
'*[data-id="testTabRunTestsTabRunAction"]'
)
.
scrollAndClick
(
'*[data-id="testTabRunTestsTabRunAction"]'
)
.
pause
(
15000
)
.
pause
(
15000
)
.
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)'
)
.
assert
.
containsText
(
'*[data-id="testTabSolidityUnitTestsSummary"]'
,
'owner is incorrect'
)
},
},
'Should fail on compilation'
:
function
(
browser
)
{
'Should fail on compilation'
:
function
(
browser
)
{
...
@@ -96,6 +97,19 @@ module.exports = {
...
@@ -96,6 +97,19 @@ module.exports = {
.
assert
.
containsText
(
'*[data-id="testTabSolidityUnitTestsSummary"]'
,
'contract deployment failed after trying twice'
)
.
assert
.
containsText
(
'*[data-id="testTabSolidityUnitTestsSummary"]'
,
'contract deployment failed after trying twice'
)
},
},
'Should fail when parameters are to method in test contract'
:
function
(
browser
)
{
browser
.
waitForElementPresent
(
'*[data-id="verticalIconsKindfileExplorers"]'
)
.
addFile
(
'methodFailure_test.sol'
,
sources
[
0
][
'browser/methodFailure_test.sol'
])
.
clickLaunchIcon
(
'fileExplorers'
)
.
switchFile
(
'browser/methodFailure_test.sol'
)
.
clickLaunchIcon
(
'solidityUnitTesting'
)
.
click
(
'*[data-id="testTabCheckAllTests"]'
)
.
click
(
'.singleTestLabel:nth-of-type(6)'
)
.
scrollAndClick
(
'*[data-id="testTabRunTestsTabRunAction"]'
)
.
pause
(
10000
)
.
waitForElementPresent
(
'*[data-id="testTabSolidityUnitTestsSummary"]'
)
},
'Solidity Unittests'
:
function
(
browser
)
{
'Solidity Unittests'
:
function
(
browser
)
{
runTests
(
browser
)
runTests
(
browser
)
},
},
...
@@ -237,20 +251,25 @@ var sources = [
...
@@ -237,20 +251,25 @@ var sources = [
enum State { Started, Completed }
enum State { Started, Completed }
Kickstarter kickstarter;
Kickstarter kickstarter;
/// #sender: account-0
function beforeAll () public {
function beforeAll () public {
kickstarter = new Kickstarter();
kickstarter = new Kickstarter();
kickstarter.createProject("ProjectA", 123000);
kickstarter.createProject("ProjectA", 123000);
kickstarter.createProject("ProjectB", 100);
kickstarter.createProject("ProjectB", 100);
}
}
/// #sender: account-
0
/// #sender: account-
1
/// #value: 10000000
/// #value: 10000000
function checkProjectExists () public payable {
function checkProjectExists () public payable {
(address owner, string memory name, uint goal, uint fundsAvailable, uint amountContributed, Kickstarter.State state) = kickstarter.projects(0);
(address owner, string memory name, uint goal, uint fundsAvailable, uint amountContributed, Kickstarter.State state) = kickstarter.projects(0);
Assert.equal(name, "ProjectA", "project name is incorrect");
Assert.equal(name, "ProjectA", "project name is incorrect");
Assert.equal(owner, address(this), "owner is incorrect");
Assert.equal(goal, 123000, "funding goal is incorrect");
Assert.equal(goal, 123000, "funding goal is incorrect");
Assert.equal(owner, TestsAccounts.getAccount(0), "owner is incorrect"); //failing case
Assert.equal(owner, address(this), "owner is incorrect");
Assert.equal(msg.sender, TestsAccounts.getAccount(0), "wrong sender"); //failing case
Assert.equal(msg.sender, TestsAccounts.getAccount(1), "wrong sender");
Assert.equal(msg.value, 5000000, "wrong value"); //failing case
Assert.equal(msg.value, 10000000, "wrong value");
}
}
function checkProjectIsFundable () public {
function checkProjectIsFundable () public {
...
@@ -258,6 +277,7 @@ var sources = [
...
@@ -258,6 +277,7 @@ var sources = [
(address owner, string memory name, uint goal, uint fundsAvailable, uint amountContributed, Kickstarter.State state) = kickstarter.projects(0);
(address owner, string memory name, uint goal, uint fundsAvailable, uint amountContributed, Kickstarter.State state) = kickstarter.projects(0);
Assert.equal(amountContributed, 120000, "contributed amount is incorrect");
Assert.equal(amountContributed, 120000, "contributed amount is incorrect");
}
}
}
}
`
`
},
},
...
@@ -282,6 +302,18 @@ var sources = [
...
@@ -282,6 +302,18 @@ var sources = [
}
}
}
}
`
`
}
},
'browser/methodFailure_test.sol'
:
{
content
:
`
pragma solidity ^0.6.0;
contract methodfailure {
function add(uint a, uint b) public {
uint c = a+b;
Assert.equal(a+b, c, "wrong value");
}
}
`
},
}
}
]
]
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