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
36bdf024
Commit
36bdf024
authored
Aug 03, 2020
by
ioedeveloper
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added staticAnalysis tests
parent
59b8f234
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
70 additions
and
0 deletions
+70
-0
staticAnalysis.test.ts
apps/remix-ide-e2e/src/tests/staticAnalysis.test.ts
+70
-0
No files found.
apps/remix-ide-e2e/src/tests/staticAnalysis.test.ts
0 → 100644
View file @
36bdf024
'use strict'
import
{
NightwatchBrowser
}
from
"nightwatch"
import
init
from
'../helpers/init'
import
sauce
from
'./sauce'
const
sources
=
[
{
'browser/Untitled.sol'
:
{
content
:
`
pragma solidity >=0.4.22 <0.6.0;
contract test1 { address test = tx.origin; }
contract test2 {}
contract TooMuchGas {
uint x;
function() external {
x++;
uint test;
uint test1;
}
}`
}}
]
module
.
exports
=
{
before
:
function
(
browser
:
NightwatchBrowser
,
done
:
VoidFunction
)
{
init
(
browser
,
done
)
},
'@sources'
:
function
()
{
return
sources
},
'Static Analysis'
:
function
(
browser
:
NightwatchBrowser
)
{
runTests
(
browser
)
},
tearDown
:
sauce
}
function
runTests
(
browser
:
NightwatchBrowser
)
{
browser
.
waitForElementVisible
(
'#icon-panel'
,
10000
)
.
clickLaunchIcon
(
'solidity'
)
.
testContracts
(
'Untitled.sol'
,
sources
[
0
][
'browser/Untitled.sol'
],
[
'TooMuchGas'
,
'test1'
,
'test2'
])
.
clickLaunchIcon
(
'solidityStaticAnalysis'
)
.
click
(
'#staticanalysisView button'
)
.
waitForElementPresent
(
'#staticanalysisresult .warning'
,
2000
,
true
,
function
()
{
listSelectorContains
([
'Use of tx.origin'
,
'Fallback function of contract TooMuchGas requires too much gas'
,
'TooMuchGas.() : Variables have very similar names "test" and "test1".'
],
'#staticanalysisresult .warning'
,
browser
,
function
()
{
browser
.
end
()
}
)
})
}
function
listSelectorContains
(
textsToFind
:
string
[],
selector
:
string
,
browser
:
NightwatchBrowser
,
callback
:
VoidFunction
)
{
browser
.
execute
(
function
(
selector
)
{
const
items
=
document
.
querySelectorAll
(
selector
)
const
ret
=
[]
for
(
let
k
=
0
;
k
<
items
.
length
;
k
++
)
{
ret
.
push
(
items
[
k
].
innerText
)
}
return
ret
},
[
selector
],
function
(
result
)
{
console
.
log
(
result
.
value
)
for
(
const
k
in
textsToFind
)
{
console
.
log
(
'testing `'
+
result
.
value
[
k
]
+
'` against `'
+
textsToFind
[
k
]
+
'`'
)
browser
.
assert
.
equal
(
result
.
value
[
k
].
indexOf
(
textsToFind
[
k
])
!==
-
1
,
true
)
}
callback
()
})
}
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