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
a6e1fb2b
Commit
a6e1fb2b
authored
Feb 19, 2020
by
ioedeveloper
Committed by
yann300
Apr 01, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve transaction log tests
parent
89ca2698
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
75 additions
and
0 deletions
+75
-0
testTransactionLog.js
test-browser/commands/testTransactionLog.js
+61
-0
ballot.js
test-browser/tests/ballot.js
+14
-0
No files found.
test-browser/commands/testTransactionLog.js
0 → 100644
View file @
a6e1fb2b
const
EventEmitter
=
require
(
'events'
)
const
deepequal
=
require
(
'deep-equal'
)
class
testTransactionLog
extends
EventEmitter
{
command
(
txHash
,
expectedValue
)
{
const
browser
=
this
.
api
const
logs
=
{}
const
setLog
=
(
index
,
value
)
=>
logs
[
Object
.
keys
(
logs
)[
index
]]
=
value
;
browser
.
waitForElementVisible
(
`*[data-id="txLogger
${
txHash
}
"]`
)
.
click
(
`*[data-id="txLogger
${
txHash
}
"]`
)
.
waitForElementVisible
(
`*[data-id="txLoggerTable
${
txHash
}
"]`
)
.
click
(
`*[data-id="txLoggerTable
${
txHash
}
"]`
)
// fetch and format transaction logs as key => pair object
.
elements
(
'css selector'
,
`*[data-shared="key_
${
txHash
}
"]`
,
(
res
)
=>
{
res
.
value
.
forEach
(
function
(
jsonWebElement
)
{
const
jsonWebElementId
=
jsonWebElement
.
ELEMENT
browser
.
elementIdText
(
jsonWebElementId
,
(
jsonElement
)
=>
{
const
key
=
jsonElement
.
value
.
trim
()
logs
[
key
]
=
null
})
})
})
.
elements
(
'css selector'
,
`*[data-shared="pair_
${
txHash
}
"]`
,
(
res
)
=>
{
res
.
value
.
forEach
(
function
(
jsonWebElement
,
index
)
{
const
jsonWebElementId
=
jsonWebElement
.
ELEMENT
browser
.
elementIdText
(
jsonWebElementId
,
(
jsonElement
)
=>
{
let
value
=
jsonElement
.
value
try
{
value
=
JSON
.
parse
(
jsonElement
.
value
)
setLog
(
index
,
value
)
}
catch
(
e
){
setLog
(
index
,
value
)
}
})
})
})
browser
.
perform
(()
=>
{
Object
.
keys
(
expectedValue
).
forEach
(
key
=>
{
const
equal
=
deepequal
(
logs
[
key
],
expectedValue
[
key
])
if
(
!
equal
)
{
browser
.
assert
.
fail
(
`Expected
${
expectedValue
[
key
]}
but got
${
logs
[
key
]}
`
)
}
else
{
browser
.
assert
.
ok
(
true
,
`Expected value matched returned value
${
expectedValue
[
key
]}
`
)
}
})
this
.
emit
(
'complete'
)
})
return
this
}
}
module
.
exports
=
testTransactionLog
\ No newline at end of file
test-browser/tests/ballot.js
View file @
a6e1fb2b
...
...
@@ -55,6 +55,7 @@ module.exports = {
.
clickLaunchIcon
(
'fileExplorers'
)
.
addAtAddressInstance
(
'0x692a70D2e424a56D2C6C27aA97D1a86395877b3A'
,
true
,
true
)
.
pause
(
500
)
<<<<<<<
HEAD
.
waitForElementPresent
(
'*[data-id="universalDappUiContractActionWrapper"]'
)
.
click
(
'*[data-id="universalDappUiTitleExpander"]'
)
.
clickFunction
(
'delegate - transact (not payable)'
,
{
types
:
'address to'
,
values
:
'"0x4b0897b0513fdc7c541b6d9d7e929c4e5364d2db"'
})
...
...
@@ -64,6 +65,19 @@ module.exports = {
'transaction hash'
:
'0xca58080c8099429caeeffe43b8104df919c2c543dceb9edf9242fa55f045c803'
,
'decoded input'
:
{
'address to'
:
'0x4B0897b0513fdC7C541B6d9D7E929C4e5364D2dB'
}
})
=======
.
waitForElementPresent
(
'.instance:nth-of-type(2)'
)
.
click
(
'.instance:nth-of-type(2) > div > button'
)
.
createContract
([
"0xca58080c8099429caeeffe43b8104df919c2c543dceb9edf9242fa55f045c803"
])
.
pause
(
100000
)
.
testTransactionLog
(
'0x57f7ac07a894739a8bbf059248f47aa49935bfcf673494114b1c5c0c183890f0'
,
{
status
:
'0x1 Transaction mined and execution succeed'
,
'transaction hash'
:
'0x57f7ac07a894739a8bbf059248f47aa49935bfcf673494114b1c5c0c183890f0'
,
'decoded input'
:
{
'bytes32[] proposalNames'
:
[
'0x48656c6c6f20576f726c64210000000000000000000000000000000000000000'
]
}
})
>>>>>>>
Improve
transaction
log
tests
},
'Deploy and use Ballot using external web3'
:
function
(
browser
)
{
...
...
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