diff options
e2e beta tests for contract deployment and calling a contract method.
Diffstat (limited to 'test/e2e/beta/helpers.js')
-rw-r--r-- | test/e2e/beta/helpers.js | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/test/e2e/beta/helpers.js b/test/e2e/beta/helpers.js index 31c41d8b7..949fece96 100644 --- a/test/e2e/beta/helpers.js +++ b/test/e2e/beta/helpers.js @@ -3,12 +3,41 @@ const mkdirp = require('mkdirp') const pify = require('pify') const {until} = require('selenium-webdriver') +const testContract = ` + pragma solidity ^0.4.0; + contract PiggyBank { + + uint private balance; + address public owner; + + function PiggyBank() public { + owner = msg.sender; + balance = 0; + } + + function deposit() public payable returns (uint) { + balance += msg.value; + return balance; + } + + function withdraw(uint withdrawAmount) public returns (uint remainingBal) { + require(msg.sender == owner); + balance -= withdrawAmount; + + msg.sender.transfer(withdrawAmount); + + return balance; + } + } +` + module.exports = { checkBrowserForConsoleErrors, loadExtension, verboseReportOnFailure, findElement, findElements, + testContract, } async function loadExtension (driver, extensionId) { |