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
2b91c6a7
Commit
2b91c6a7
authored
Nov 21, 2016
by
yann300
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix tests
parent
6017b959
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
23 deletions
+34
-23
contracts.js
test-browser/helpers/contracts.js
+3
-2
dom.js
test-browser/helpers/dom.js
+20
-0
staticanalysis.js
test-browser/tests/staticanalysis.js
+11
-21
No files found.
test-browser/helpers/contracts.js
View file @
2b91c6a7
...
...
@@ -21,6 +21,7 @@ function testContracts (browser, contractCode, compiledContractNames, callback)
.
clearValue
(
'#input textarea'
)
.
click
(
'.newFile'
)
.
setValue
(
'#input textarea'
,
contractCode
,
function
()
{})
.
waitForElementPresent
(
'.contract .create'
,
2000
)
checkCompiledContracts
(
browser
,
compiledContractNames
,
callback
)
.
waitForElementPresent
(
'.contract .create'
,
2000
,
true
,
function
()
{
checkCompiledContracts
(
browser
,
compiledContractNames
,
callback
)
})
}
test-browser/helpers/dom.js
0 → 100644
View file @
2b91c6a7
'use strict'
module
.
exports
=
{
listSelectorContains
:
listSelectorContains
}
function
listSelectorContains
(
textsToFind
,
selector
,
browser
,
callback
)
{
browser
.
elements
(
'css selector'
,
selector
,
function
(
warnings
)
{
warnings
.
value
.
map
(
function
(
warning
,
index
)
{
browser
.
elementIdText
(
warning
.
ELEMENT
,
function
(
text
)
{
browser
.
assert
.
equal
(
text
.
value
.
indexOf
(
textsToFind
[
index
])
!==
-
1
,
true
)
if
(
index
===
warnings
.
value
.
length
-
1
)
{
callback
()
}
})
})
})
}
test-browser/tests/staticanalysis.js
View file @
2b91c6a7
...
...
@@ -2,6 +2,7 @@
var
contractHelper
=
require
(
'../helpers/contracts'
)
var
init
=
require
(
'../helpers/init'
)
var
sauce
=
require
(
'./sauce'
)
var
dom
=
require
(
'../helpers/dom'
)
var
sources
=
{
'sources'
:
{
...
...
@@ -28,33 +29,22 @@ module.exports = {
tearDown
:
sauce
}
function
findText
(
browser
,
selector
,
textToFind
)
{
var
found
=
false
browser
.
elements
(
'css selector'
,
selector
,
function
(
warnings
)
{
warnings
.
value
.
forEach
(
function
(
warning
)
{
browser
.
elementIdText
(
warning
.
ELEMENT
,
function
(
text
)
{
if
(
text
.
indexOf
(
textToFind
)
>=
0
)
{
found
=
true
}
})
})
})
browser
.
assert
.
equal
(
found
,
true
)
}
function
runTests
(
browser
)
{
browser
.
waitForElementVisible
(
'.newFile'
,
10000
)
contractHelper
.
testContracts
(
browser
,
sources
.
sources
.
Untitled
,
[
'TooMuchGas'
,
'test1'
,
'test2'
],
function
()
{
console
.
log
(
'pppzzz?'
)
browser
.
click
(
'.staticanalysisView'
)
.
click
(
'#staticanalysisView button'
)
.
waitForElementPresent
(
'#staticanalysisresult .warning'
)
findText
(
browser
,
'#staticanalysisresult .warning span'
,
'Untitled:2:33: use of tx.origin'
)
findText
(
browser
,
'#staticanalysisresult .warning span'
,
'Fallback function of contract TooMuchGas requires too much gas'
)
browser
.
end
()
.
waitForElementPresent
(
'#staticanalysisresult .warning'
,
2000
,
true
,
function
()
{
dom
.
listSelectorContains
([
'Untitled:1:34: use of tx.origin'
,
'Fallback function of contract TooMuchGas requires too much gas'
],
'#staticanalysisresult .warning span'
,
browser
,
function
()
{
browser
.
end
()
}
)
})
})
}
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