Skip to content

Commit

Permalink
fix import
Browse files Browse the repository at this point in the history
  • Loading branch information
yann300 committed Feb 15, 2018
1 parent 1fe61b2 commit 4826172
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 2 deletions.
1 change: 1 addition & 0 deletions contracts/src/gmbh/company.sol
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import "./contract.sol";
contract Assets {

function add(uint8 _numProposals) {
Expand Down
2 changes: 1 addition & 1 deletion src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ Please make a backup of your contracts and start using http://remix.ethereum.org
if (exist) {
return provider.get(url, cb)
} else {
return cb('file not found')
return cb('Unable to import "' + url + '": File not found')
}
})
} else {
Expand Down
48 changes: 47 additions & 1 deletion test-browser/tests/simpleContract.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,35 @@ function runTests (browser) {
async.waterfall([function (callback) { callback(null, browser) },
testSimpleContract,
testSuccessImport,
testFailedImport /* testGitHubImport */
testFailedImport, /* testGitHubImport */
testImportFromRemixd
],
function () {
browser.end()
})
})
}

function testImportFromRemixd (browser, callback) {
browser.click('.websocketconn')
.waitForElementVisible('#modal-footer-ok', 10000)
.click('#modal-footer-ok')
.waitForElementVisible('[data-path="localhost"]', 100000)
.click('[data-path="localhost"]')
.waitForElementVisible('[data-path="localhost/src"]', 100000)
.click('[data-path="localhost/src"]')
.waitForElementVisible('[data-path="localhost/src/gmbh"]', 100000)
.click('[data-path="localhost/src/gmbh"]')
.waitForElementVisible('[data-path="localhost/src/gmbh/company.sol"]', 100000)
.click('[data-path="localhost/src/gmbh/company.sol"]')
.perform(() => {
contractHelper.verifyContract(browser, ['Assets', 'gmbh'], function () {
browser.click('.websocketconn')
callback(null, browser)
})
})
}

function testSimpleContract (browser, callback) {
console.log('testSimpleContract')
contractHelper.testContracts(browser, 'Untitled.sol', sources[0]['browser/Untitled.sol'], ['test1', 'test2'], function () {
Expand Down Expand Up @@ -198,6 +219,24 @@ contract ENS is AbstractENS {
}
}`

var assetsTestContract = `import "./contract.sol";
contract Assets {
function add(uint8 _numProposals) {
proposals.length = _numProposals;
}
}
`

var gmbhTestContract = `
contract gmbh {
function register(uint8 _numProposals) {
proposals.length = _numProposals;
}
}
`

var sources = [
{
'browser/Untitled.sol': {content: 'contract test1 {} contract test2 {}'}
Expand All @@ -217,5 +256,12 @@ var sources = [
'browser/Untitled4.sol': {content: 'import "github.com/ethereum/ens/contracts/ENS.sol"; contract test7 {}'},
'github.com/ethereum/ens/contracts/ENS.sol': {content: ENS},
'github.com/ethereum/ens/contracts/AbstractENS.sol': {content: abstractENS}
},
{
'localhost/src/gmbh/company.sol': {content: assetsTestContract}
},
{
'localhost/src/gmbh/company.sol': {content: assetsTestContract},
'localhost/src/gmbh/contract.sol': {content: gmbhTestContract}
}
]

0 comments on commit 4826172

Please sign in to comment.