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
18f762ed
Commit
18f762ed
authored
Jun 19, 2020
by
LianaHus
Committed by
ioedeveloper
Jul 13, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed the test
parent
0d96830e
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
25 deletions
+27
-25
fileProvider.js
apps/remix-ide/src/app/files/fileProvider.js
+2
-3
testTab.js
apps/remix-ide/src/app/tabs/testTab/testTab.js
+1
-0
solidityUnittests.test.js
apps/remix-ide/test-browser/tests/solidityUnittests.test.js
+24
-22
No files found.
apps/remix-ide/src/app/files/fileProvider.js
View file @
18f762ed
...
...
@@ -98,7 +98,8 @@ class FileProvider {
return
true
}
if
(
!
exists
&&
unprefixedpath
.
indexOf
(
'/'
)
!==
-
1
)
{
this
.
createDir
(
path
)
// the last element is the filename and we should remove it
this
.
createDir
(
path
.
substr
(
0
,
path
.
lastIndexOf
(
'/'
)))
}
try
{
window
.
remixFileSystem
.
writeFileSync
(
unprefixedpath
,
content
)
...
...
@@ -118,8 +119,6 @@ class FileProvider {
createDir
(
path
,
cb
)
{
const
unprefixedpath
=
this
.
removePrefix
(
path
)
const
paths
=
unprefixedpath
.
split
(
'/'
)
const
last
=
paths
[
paths
.
length
-
1
]
if
(
last
.
indexOf
(
'.'
)
!==
-
1
)
paths
.
pop
()
// check if the last element is the filename and remove it
if
(
paths
.
length
&&
paths
[
0
]
===
''
)
paths
.
shift
()
let
currentCheck
=
''
paths
.
forEach
((
value
)
=>
{
...
...
apps/remix-ide/src/app/tabs/testTab/testTab.js
View file @
18f762ed
...
...
@@ -27,6 +27,7 @@ class TestTabLogic {
if
(
error
)
return
modalDialogCustom
.
alert
(
'Failed to create file. '
+
newFile
+
' '
+
error
)
if
(
!
fileProvider
.
set
(
newFile
,
this
.
generateTestContractSample
(
hasCurrent
,
fileName
)))
return
modalDialogCustom
.
alert
(
'Failed to create test file '
+
newFile
)
this
.
fileManager
.
open
(
newFile
)
this
.
fileManager
.
syncEditor
(
newFile
)
})
}
...
...
apps/remix-ide/test-browser/tests/solidityUnittests.test.js
View file @
18f762ed
...
...
@@ -31,14 +31,16 @@ module.exports = {
.
click
(
'*[data-id="verticalIconsKindsolidityUnitTesting"]'
)
.
waitForElementPresent
(
'*[data-id="testTabGenerateTestFile"]'
)
.
click
(
'*[data-id="testTabGenerateTestFile"]'
)
.
waitForElementPresent
(
'*[title="browser/simple_storage_test.sol"]'
)
.
waitForElementPresent
(
'*[title="browser/
tests/
simple_storage_test.sol"]'
)
.
clickLaunchIcon
(
'fileExplorers'
)
.
removeFile
(
'browser/simple_storage_test.sol'
)
.
pause
(
10000
)
.
openFile
(
'browser/tests/simple_storage_test.sol'
)
.
removeFile
(
'browser/tests/simple_storage_test.sol'
)
},
'Should run simple unit test `simple_storage_test.sol` '
:
function
(
browser
)
{
browser
.
waitForElementPresent
(
'*[data-id="verticalIconsKindfileExplorers"]'
)
.
addFile
(
'simple_storage_test.sol'
,
sources
[
0
][
'browser/simple_storage_test.sol'
])
.
addFile
(
'simple_storage_test.sol'
,
sources
[
0
][
'browser/
tests/
simple_storage_test.sol'
])
.
click
(
'*[data-id="verticalIconsKindsolidityUnitTesting"]'
)
.
waitForElementPresent
(
'*[data-id="testTabCheckAllTests"]'
)
.
click
(
'*[data-id="testTabCheckAllTests"]'
)
...
...
@@ -46,19 +48,19 @@ module.exports = {
.
scrollAndClick
(
'*[data-id="testTabRunTestsTabRunAction"]'
)
.
waitForElementPresent
(
'*[data-id="testTabSolidityUnitTestsOutputheader"]'
,
80000
)
.
pause
(
5000
)
.
assert
.
containsText
(
'*[data-id="testTabSolidityUnitTestsOutput"]'
,
'MyTest (browser/simple_storage_test.sol)'
)
.
assert
.
containsText
(
'*[data-id="testTabSolidityUnitTestsOutput"]'
,
'MyTest (browser/
tests/
simple_storage_test.sol)'
)
.
assert
.
containsText
(
'*[data-id="testTabSolidityUnitTestsOutput"]'
,
'✓ Initial value should be100'
)
.
assert
.
containsText
(
'*[data-id="testTabSolidityUnitTestsOutput"]'
,
'✓ Value is set200'
)
.
assert
.
containsText
(
'*[data-id="testTabSolidityUnitTestsOutput"]'
,
'✘ Should fail for wrong value200'
)
.
assert
.
containsText
(
'*[data-id="testTabSolidityUnitTestsOutput"]'
,
'Passing: 2'
)
.
assert
.
containsText
(
'*[data-id="testTabSolidityUnitTestsOutput"]'
,
'Failing: 1'
)
.
assert
.
containsText
(
'*[data-id="testTabSolidityUnitTestsOutput"]'
,
'FAIL MyTest (browser/simple_storage_test.sol)'
)
.
assert
.
containsText
(
'*[data-id="testTabSolidityUnitTestsOutput"]'
,
'FAIL MyTest (browser/
tests/
simple_storage_test.sol)'
)
},
'Should run advance unit test using natspec and experimental ABIEncoderV2 `ks2b_test.sol` '
:
function
(
browser
)
{
browser
.
waitForElementPresent
(
'*[data-id="verticalIconsKindfileExplorers"]'
)
.
clickLaunchIcon
(
'fileExplorers'
)
.
addFile
(
'ks2b_test.sol'
,
sources
[
0
][
'browser/ks2b_test.sol'
])
.
addFile
(
'ks2b_test.sol'
,
sources
[
0
][
'browser/
tests/
ks2b_test.sol'
])
.
click
(
'*[data-id="verticalIconsKindsolidityUnitTesting"]'
)
.
waitForElementPresent
(
'*[data-id="testTabCheckAllTests"]'
)
.
click
(
'*[data-id="testTabCheckAllTests"]'
)
...
...
@@ -66,7 +68,7 @@ module.exports = {
.
scrollAndClick
(
'*[data-id="testTabRunTestsTabRunAction"]'
)
.
waitForElementPresent
(
'*[data-id="testTabSolidityUnitTestsOutputheader"]'
,
40000
)
.
pause
(
5000
)
.
assert
.
containsText
(
'*[data-id="testTabSolidityUnitTestsOutput"]'
,
'browser/ks2b_test.sol'
)
.
assert
.
containsText
(
'*[data-id="testTabSolidityUnitTestsOutput"]'
,
'browser/
tests/
ks2b_test.sol'
)
.
assert
.
containsText
(
'*[data-id="testTabSolidityUnitTestsOutput"]'
,
'✓ Check project exists'
)
.
assert
.
containsText
(
'*[data-id="testTabSolidityUnitTestsOutput"]'
,
'✘ Check wrong project owner'
)
.
assert
.
containsText
(
'*[data-id="testTabSolidityUnitTestsOutput"]'
,
'✘ Check wrong sender'
)
...
...
@@ -89,9 +91,9 @@ module.exports = {
.
pause
(
1000
)
.
assert
.
containsText
(
'*[data-id="testTabRunTestsTabStopAction"]'
,
'Stopping'
)
.
waitForElementPresent
(
'*[data-id="testTabSolidityUnitTestsOutputheader"]'
,
40000
)
.
assert
.
containsText
(
'*[data-id="testTabSolidityUnitTestsOutput"]'
,
'browser/ks2b_test.sol'
)
.
notContainsText
(
'*[data-id="testTabSolidityUnitTestsOutput"]'
,
'browser/4_Ballot_test.sol'
)
.
notContainsText
(
'*[data-id="testTabSolidityUnitTestsOutput"]'
,
'browser/simple_storage_test.sol'
)
.
assert
.
containsText
(
'*[data-id="testTabSolidityUnitTestsOutput"]'
,
'browser/
tests/
ks2b_test.sol'
)
.
notContainsText
(
'*[data-id="testTabSolidityUnitTestsOutput"]'
,
'browser/
tests/
4_Ballot_test.sol'
)
.
notContainsText
(
'*[data-id="testTabSolidityUnitTestsOutput"]'
,
'browser/
tests/
simple_storage_test.sol'
)
.
pause
(
6000
)
.
assert
.
containsText
(
'*[data-id="testTabTestsExecutionStopped"]'
,
'The test execution has been stopped'
)
},
...
...
@@ -100,7 +102,7 @@ module.exports = {
browser
.
waitForElementPresent
(
'*[data-id="verticalIconsKindfileExplorers"]'
)
.
addFile
(
'compilationError_test.sol'
,
sources
[
0
][
'browser/compilationError_test.sol'
])
.
clickLaunchIcon
(
'fileExplorers'
)
.
openFile
(
'browser/compilationError_test.sol'
)
.
openFile
(
'browser/
tests/
compilationError_test.sol'
)
.
clickLaunchIcon
(
'solidityUnitTesting'
)
.
click
(
'*[data-id="testTabCheckAllTests"]'
)
.
clickElementAtPosition
(
'.singleTestLabel'
,
3
)
...
...
@@ -113,9 +115,9 @@ module.exports = {
'Should fail on deploy'
:
function
(
browser
)
{
browser
.
waitForElementPresent
(
'*[data-id="verticalIconsKindfileExplorers"]'
)
.
addFile
(
'deployError_test.sol'
,
sources
[
0
][
'browser/deployError_test.sol'
])
.
addFile
(
'deployError_test.sol'
,
sources
[
0
][
'browser/
tests/
deployError_test.sol'
])
.
clickLaunchIcon
(
'fileExplorers'
)
.
openFile
(
'browser/deployError_test.sol'
)
.
openFile
(
'browser/
tests/
deployError_test.sol'
)
.
clickLaunchIcon
(
'solidityUnitTesting'
)
.
click
(
'*[data-id="testTabCheckAllTests"]'
)
.
clickElementAtPosition
(
'.singleTestLabel'
,
4
)
...
...
@@ -127,9 +129,9 @@ module.exports = {
'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'
])
.
addFile
(
'methodFailure_test.sol'
,
sources
[
0
][
'browser/
tests/
methodFailure_test.sol'
])
.
clickLaunchIcon
(
'fileExplorers'
)
.
openFile
(
'browser/methodFailure_test.sol'
)
.
openFile
(
'browser/
tests/
methodFailure_test.sol'
)
.
clickLaunchIcon
(
'solidityUnitTesting'
)
.
click
(
'*[data-id="testTabCheckAllTests"]'
)
.
clickElementAtPosition
(
'.singleTestLabel'
,
5
)
...
...
@@ -157,7 +159,7 @@ function runTests (browser) {
.
waitForElementPresent
(
'*[data-id="testTabSolidityUnitTestsOutputheader"]'
,
40000
)
.
pause
(
5000
)
.
waitForElementPresent
(
'#solidityUnittestsOutput div[class^="testPass"]'
)
.
assert
.
containsText
(
'#solidityUnittestsOutput'
,
'browser/4_Ballot_test.sol'
)
.
assert
.
containsText
(
'#solidityUnittestsOutput'
,
'browser/
tests/
4_Ballot_test.sol'
)
.
assert
.
containsText
(
'#solidityUnittestsOutput'
,
'✓ Check winning proposal'
)
.
assert
.
containsText
(
'#solidityUnittestsOutput'
,
'✓ Check winnin proposal with return value'
)
.
end
()
...
...
@@ -186,11 +188,11 @@ var sources = [
}
`
},
'browser/simple_storage_test.sol'
:
{
'browser/
tests/
simple_storage_test.sol'
:
{
content
:
`
pragma solidity >=0.4.22 <0.7.0;
import "remix_tests.sol";
import "./simple_storage.sol";
import ".
.
/simple_storage.sol";
contract MyTest {
SimpleStorage foo;
...
...
@@ -269,14 +271,14 @@ var sources = [
}
`
},
'browser/ks2b_test.sol'
:
{
'browser/
tests/
ks2b_test.sol'
:
{
content
:
`
pragma solidity >=0.4.22 <0.6.0;
pragma experimental ABIEncoderV2;
import "remix_tests.sol"; // this import is automatically injected by Remix.
import "remix_accounts.sol";
import "./ks2a.sol";
import ".
.
/ks2a.sol";
contract kickstarterTest {
enum State { Started, Completed }
...
...
@@ -339,7 +341,7 @@ var sources = [
}
`
},
'browser/deployError_test.sol'
:
{
'browser/
tests/
deployError_test.sol'
:
{
content
:
`
pragma solidity ^0.6.0;
...
...
@@ -350,7 +352,7 @@ var sources = [
}
`
},
'browser/methodFailure_test.sol'
:
{
'browser/
tests/
methodFailure_test.sol'
:
{
content
:
`
pragma solidity ^0.6.0;
...
...
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