pull/3262/head^2
filip mertens 2 years ago committed by Aniket
parent c7fc670d6a
commit db048f3a40
  1. 46
      apps/remix-ide-e2e/src/tests/remixd.test.ts

@ -72,8 +72,8 @@ module.exports = {
return sources
},
'run Remixd tests #group4': function (browser) {
browser.perform((done) => {
remixd = spawnRemixd(join(process.cwd(), '/apps/remix-ide', '/contracts'))
browser.perform(async (done) => {
await spawnRemixd(join(process.cwd(), '/apps/remix-ide', '/contracts'))
console.log('working directory', process.cwd())
connectRemixd(browser, done)
})
@ -86,8 +86,8 @@ module.exports = {
when a relative import is used (i.e import "openzeppelin-solidity/contracts/math/SafeMath.sol")
remix (as well as truffle) try to resolve it against the node_modules and installed_contracts folder.
*/
browser.perform((done) => {
remixd = spawnRemixd(join(process.cwd(), '/apps/remix-ide', '/contracts'))
browser.perform(async (done) => {
await spawnRemixd(join(process.cwd(), '/apps/remix-ide', '/contracts'))
console.log('working directory', process.cwd())
connectRemixd(browser, done)
})
@ -100,8 +100,8 @@ module.exports = {
.testContracts('test_import_node_modules.sol', sources[3]['test_import_node_modules.sol'], ['SafeMath'])
},
'Import from node_modules and reference a github import #group2': function (browser) {
browser.perform((done) => {
remixd = spawnRemixd(join(process.cwd(), '/apps/remix-ide', '/contracts'))
browser.perform(async (done) => {
await spawnRemixd(join(process.cwd(), '/apps/remix-ide', '/contracts'))
console.log('working directory', process.cwd())
connectRemixd(browser, done)
})
@ -146,8 +146,8 @@ module.exports = {
'Should listen on compilation result from hardhat #group5': function (browser: NightwatchBrowser) {
browser.perform((done) => {
remixd = spawnRemixd(join(process.cwd(), '/apps/remix-ide', '/contracts/hardhat'))
browser.perform(async (done) => {
await spawnRemixd(join(process.cwd(), '/apps/remix-ide', '/contracts/hardhat'))
console.log('working directory', process.cwd())
connectRemixd(browser, done)
})
@ -181,8 +181,8 @@ module.exports = {
writeFileSync('./apps/remix-ide/contracts/hardhat/artifacts/build-info/7839ba878952cc00ff316061405f273a.json', JSON.stringify(hardhatCompilation))
done()
})
.perform((done) => {
remixd = spawnRemixd(join(process.cwd(), '/apps/remix-ide', '/contracts/hardhat'))
.perform(async (done) => {
await spawnRemixd(join(process.cwd(), '/apps/remix-ide', '/contracts/hardhat'))
console.log('working directory', process.cwd())
connectRemixd(browser, done)
})
@ -201,8 +201,8 @@ module.exports = {
'Should listen on compilation result from foundry #group7': function (browser: NightwatchBrowser) {
browser.perform((done) => {
remixd = spawnRemixd(join(process.cwd(), '/apps/remix-ide', '/contracts/foundry'))
browser.perform(async (done) => {
await spawnRemixd(join(process.cwd(), '/apps/remix-ide', '/contracts/foundry'))
console.log('working directory', process.cwd())
connectRemixd(browser, done)
})
@ -236,8 +236,8 @@ module.exports = {
'Should listen on compilation result from truffle #group8': function (browser: NightwatchBrowser) {
browser.perform((done) => {
remixd = spawnRemixd(join(process.cwd(), '/apps/remix-ide', '/contracts/truffle'))
browser.perform(async (done) => {
await spawnRemixd(join(process.cwd(), '/apps/remix-ide', '/contracts/truffle'))
console.log('working directory', process.cwd())
connectRemixd(browser, done)
})
@ -311,15 +311,19 @@ function testImportFromRemixd(browser: NightwatchBrowser, callback: VoidFunction
.perform(() => { callback() })
}
function spawnRemixd(path: string) {
async function spawnRemixd(path: string) {
const remixd = spawn('yarn run remixd', [`-s ${path}`], { cwd: process.cwd(), shell: true, detached: true })
remixd.stdout.on('data', function (data) {
console.log('stdout: ' + data.toString())
})
remixd.stderr.on('err', function (data) {
console.log('err: ' + data.toString())
return new Promise((resolve) => {
remixd.stdout.on('data', function (data) {
console.log('stdout: ' + data.toString())
})
remixd.stderr.on('err', function (data) {
console.log('err: ' + data.toString())
})
remixd.on("exit", (code) => {
resolve(code);
});
})
return remixd
}
function connectRemixd(browser: NightwatchBrowser, done: any) {

Loading…
Cancel
Save