Commit 00131882 authored by yann300's avatar yann300

open-save workspace e2e fix

parent 22ea754f
...@@ -16,15 +16,13 @@ class AddFile extends EventEmitter { ...@@ -16,15 +16,13 @@ class AddFile extends EventEmitter {
function addFile (browser: NightwatchBrowser, name: string, content: NightwatchContractContent, done: VoidFunction) { function addFile (browser: NightwatchBrowser, name: string, content: NightwatchContractContent, done: VoidFunction) {
browser.clickLaunchIcon('udapp') browser.clickLaunchIcon('udapp')
.clickLaunchIcon('fileExplorers') .clickLaunchIcon('fileExplorers')
.click('li[data-id="treeViewLitreeViewItembrowser/README.txt"]') // focus on root directory .click('li[data-id="treeViewLitreeViewItemREADME.txt"]') // focus on root directory
.click('.newFile') .click('.newFile')
.waitForElementVisible('*[data-id="treeViewLitreeViewItembrowser/blank"]') .waitForElementVisible('*[data-id="treeViewLitreeViewItem/blank"]')
// .scrollAndClick('*[data-id="treeViewLitreeViewItembrowser/blank"] .remixui_items') .sendKeys('*[data-id="treeViewLitreeViewItem/blank"] .remixui_items', name)
.sendKeys('*[data-id="treeViewLitreeViewItembrowser/blank"] .remixui_items', name) .sendKeys('*[data-id="treeViewLitreeViewItem/blank"] .remixui_items', browser.Keys.ENTER)
.sendKeys('*[data-id="treeViewLitreeViewItembrowser/blank"] .remixui_items', browser.Keys.ENTER)
.pause(2000) .pause(2000)
.waitForElementVisible(`li[data-id="treeViewLitreeViewItembrowser/${name}"]`) .waitForElementVisible(`li[data-id="treeViewLitreeViewItem${name}"]`)
// .click(`li[data-id="treeViewLitreeViewItembrowser/${name}"]`)
.setEditorValue(content.content) .setEditorValue(content.content)
.pause(1000) .pause(1000)
.perform(function () { .perform(function () {
......
import { NightwatchBrowser } from 'nightwatch'
import EventEmitter from 'events'
class GetLastTransactionHash extends EventEmitter {
command (this: NightwatchBrowser, cb: (hash: string) => void): NightwatchBrowser {
this.api.perform((done) => {
getLastTransactionHash(this.api, (hash) => {
cb(hash)
done()
this.emit('complete')
})
})
return this
}
}
function getLastTransactionHash (browser: NightwatchBrowser, callback: (hash: string) => void) {
browser.waitForElementPresent('*[data-shared="universalDappUiInstance"]')
.execute(function () {
const deployedContracts = document.querySelectorAll('*[data-id="terminalJournal"] > div')
for (let i = deployedContracts.length - 1; i >= 0; i--) {
const current = deployedContracts[i]
const attr = current.getAttribute('data-id')
if (attr && attr.replace('block_tx', '').startsWith('0x')) {
return attr.replace('block_tx', '')
}
}
return ''
}, [], function (result) {
const hash = typeof result.value === 'string' ? result.value : null
callback(hash)
})
}
module.exports = GetLastTransactionHash
...@@ -38,15 +38,10 @@ function removeFile (browser: NightwatchBrowser, path: string, done: VoidFunctio ...@@ -38,15 +38,10 @@ function removeFile (browser: NightwatchBrowser, path: string, done: VoidFunctio
.click('#menuitemdelete') .click('#menuitemdelete')
.pause(2000) .pause(2000)
.perform(() => { .perform(() => {
if (path.indexOf('browser') !== -1) { console.log(path, 'to remove')
browser.waitForElementVisible('[data-id="browser-modal-footer-ok-react"]') browser.waitForElementVisible('.modal-ok')
.click('[data-id="browser-modal-footer-ok-react"]') .click('.modal-ok')
.waitForElementNotPresent('[data-path="' + path + '"]') .waitForElementNotPresent('[data-path="' + path + '"]')
} else if (path.indexOf('localhost') !== -1) {
browser.waitForElementVisible('[data-id="localhost-modal-footer-ok-react"]')
.click('[data-id="localhost-modal-footer-ok-react"]')
.waitForElementNotPresent('[data-path="' + path + '"]')
}
done() done()
}) })
}) })
......
...@@ -42,7 +42,7 @@ function renamePath (browser: NightwatchBrowser, path: string, newFileName: stri ...@@ -42,7 +42,7 @@ function renamePath (browser: NightwatchBrowser, path: string, newFileName: stri
}) })
}) })
.pause(1000) .pause(1000)
.click('li[data-id="treeViewLitreeViewItembrowser/README.txt"]') // focus on root directory .click('div[data-id="remixIdeMainPanel"]') // focus out to save
.pause(2000) .pause(2000)
.waitForElementNotPresent('[data-path="' + path + '"]') .waitForElementNotPresent('[data-path="' + path + '"]')
.waitForElementPresent('[data-path="' + renamedPath + '"]') .waitForElementPresent('[data-path="' + renamedPath + '"]')
......
...@@ -12,59 +12,68 @@ class TestFunction extends EventEmitter { ...@@ -12,59 +12,68 @@ class TestFunction extends EventEmitter {
} }
browser browser
.waitForElementVisible(`[data-id="block_tx${txHash}"]`) .perform((done) => {
.click(`[data-id="block_tx${txHash}"]`) browser.getLastTransactionHash((hash) => {
.waitForElementVisible(`*[data-id="txLoggerTable${txHash}"]`) if (txHash === 'last') {
console.log(hash)
// fetch and format transaction logs as key => pair object txHash = hash
.elements('css selector', `*[data-shared="key_${txHash}"]`, (res) => { }
Array.isArray(res.value) && res.value.forEach(function (jsonWebElement) { done()
const jsonWebElementId: string = jsonWebElement.ELEMENT || jsonWebElement[Object.keys(jsonWebElement)[0]]
browser.elementIdText(jsonWebElementId, (jsonElement) => {
const key = typeof jsonElement.value === 'string' ? jsonElement.value.trim() : null
logs[key] = null
})
}) })
}) })
.elements('css selector', `*[data-shared="pair_${txHash}"]`, (res) => { .perform((done) => {
Array.isArray(res.value) && res.value.forEach(function (jsonWebElement, index) { browser.waitForElementVisible(`[data-id="block_tx${txHash}"]`)
const jsonWebElementId = jsonWebElement.ELEMENT || jsonWebElement[Object.keys(jsonWebElement)[0]] .click(`[data-id="block_tx${txHash}"]`)
.waitForElementVisible(`*[data-id="txLoggerTable${txHash}"]`)
// fetch and format transaction logs as key => pair object
.elements('css selector', `*[data-shared="key_${txHash}"]`, (res) => {
Array.isArray(res.value) && res.value.forEach(function (jsonWebElement) {
const jsonWebElementId: string = jsonWebElement.ELEMENT || jsonWebElement[Object.keys(jsonWebElement)[0]]
browser.elementIdText(jsonWebElementId, (jsonElement) => { browser.elementIdText(jsonWebElementId, (jsonElement) => {
let value = jsonElement.value const key = typeof jsonElement.value === 'string' ? jsonElement.value.trim() : null
try { logs[key] = null
value = JSON.parse(<string>jsonElement.value) })
setLog(index, <string>value) })
} catch (e) {
setLog(index, <string>value)
}
}) })
}) .elements('css selector', `*[data-shared="pair_${txHash}"]`, (res) => {
}) Array.isArray(res.value) && res.value.forEach(function (jsonWebElement, index) {
const jsonWebElementId = jsonWebElement.ELEMENT || jsonWebElement[Object.keys(jsonWebElement)[0]]
browser.elementIdText(jsonWebElementId, (jsonElement) => {
let value = jsonElement.value
browser.perform(() => { try {
Object.keys(expectedValue).forEach(key => { value = JSON.parse(<string>jsonElement.value)
let equal = false setLog(index, <string>value)
} catch (e) {
setLog(index, <string>value)
}
})
})
}).perform(() => done())
})
.perform(() => {
Object.keys(expectedValue).forEach(key => {
let equal = false
try { try {
const receivedValue = JSON.parse(logs[key]) const receivedValue = JSON.parse(logs[key])
equal = deepequal(receivedValue, expectedValue[key]) equal = deepequal(receivedValue, expectedValue[key])
} catch (err) { } catch (err) {
equal = deepequal(logs[key], expectedValue[key]) equal = deepequal(logs[key], expectedValue[key])
} }
if (!equal) { if (!equal) {
browser.assert.fail(`Expected ${JSON.stringify(expectedValue[key])} but got ${JSON.stringify(logs[key])}`) browser.assert.fail(`Expected ${JSON.stringify(expectedValue[key])} but got ${JSON.stringify(logs[key])}`)
} else { } else {
browser.assert.ok(true, `Expected value matched returned value ${JSON.stringify(expectedValue[key])}`) browser.assert.ok(true, `Expected value matched returned value ${JSON.stringify(expectedValue[key])}`)
} }
})
this.emit('complete')
}) })
this.emit('complete')
})
return this return this
} }
} }
......
...@@ -6,7 +6,7 @@ import sauce from './sauce' ...@@ -6,7 +6,7 @@ import sauce from './sauce'
import examples from '../examples/example-contracts' import examples from '../examples/example-contracts'
const sources = [ const sources = [
{ 'browser/Untitled.sol': { content: examples.ballot.content } } { 'Untitled.sol': { content: examples.ballot.content } }
] ]
module.exports = { module.exports = {
...@@ -20,7 +20,7 @@ module.exports = { ...@@ -20,7 +20,7 @@ module.exports = {
browser browser
.waitForElementVisible('*[data-id="remixIdeIconPanel"]', 10000) .waitForElementVisible('*[data-id="remixIdeIconPanel"]', 10000)
.clickLaunchIcon('solidity') .clickLaunchIcon('solidity')
.testContracts('Untitled.sol', sources[0]['browser/Untitled.sol'], ['Ballot']) .testContracts('Untitled.sol', sources[0]['Untitled.sol'], ['Ballot'])
.clickLaunchIcon('udapp') .clickLaunchIcon('udapp')
.selectAccount('0xCA35b7d915458EF540aDe6068dFe2F44E8fa733c') .selectAccount('0xCA35b7d915458EF540aDe6068dFe2F44E8fa733c')
.setValue('input[placeholder="bytes32[] proposalNames"]', '["0x48656c6c6f20576f726c64210000000000000000000000000000000000000000"]') .setValue('input[placeholder="bytes32[] proposalNames"]', '["0x48656c6c6f20576f726c64210000000000000000000000000000000000000000"]')
...@@ -28,10 +28,9 @@ module.exports = { ...@@ -28,10 +28,9 @@ module.exports = {
.waitForElementPresent('*[data-id="universalDappUiContractActionWrapper"]') .waitForElementPresent('*[data-id="universalDappUiContractActionWrapper"]')
.click('*[data-id="universalDappUiTitleExpander"]') .click('*[data-id="universalDappUiTitleExpander"]')
.clickFunction('delegate - transact (not payable)', { types: 'address to', values: '"0x4b0897b0513fdc7c541b6d9d7e929c4e5364d2db"' }) .clickFunction('delegate - transact (not payable)', { types: 'address to', values: '"0x4b0897b0513fdc7c541b6d9d7e929c4e5364d2db"' })
.testFunction('0x41fab8ea5b1d9fba5e0a6545ca1a2d62fff518578802c033c2b9a031a01c31b3', .testFunction('last',
{ {
status: 'true Transaction mined and execution succeed', status: 'true Transaction mined and execution succeed',
'transaction hash': '0x41fab8ea5b1d9fba5e0a6545ca1a2d62fff518578802c033c2b9a031a01c31b3',
'decoded input': { 'address to': '0x4B0897b0513fdC7C541B6d9D7E929C4e5364D2dB' } 'decoded input': { 'address to': '0x4B0897b0513fdC7C541B6d9D7E929C4e5364D2dB' }
}) })
}, },
...@@ -61,10 +60,9 @@ module.exports = { ...@@ -61,10 +60,9 @@ module.exports = {
.waitForElementPresent('*[data-id="universalDappUiContractActionWrapper"]') .waitForElementPresent('*[data-id="universalDappUiContractActionWrapper"]')
.click('*[data-id="universalDappUiTitleExpander"]') .click('*[data-id="universalDappUiTitleExpander"]')
.clickFunction('delegate - transact (not payable)', { types: 'address to', values: '"0x4b0897b0513fdc7c541b6d9d7e929c4e5364d2db"' }) .clickFunction('delegate - transact (not payable)', { types: 'address to', values: '"0x4b0897b0513fdc7c541b6d9d7e929c4e5364d2db"' })
.testFunction('0xca58080c8099429caeeffe43b8104df919c2c543dceb9edf9242fa55f045c803', .testFunction('last',
{ {
status: 'false Transaction mined but execution failed', status: 'false Transaction mined but execution failed',
'transaction hash': '0xca58080c8099429caeeffe43b8104df919c2c543dceb9edf9242fa55f045c803',
'decoded input': { 'address to': '0x4B0897b0513fdC7C541B6d9D7E929C4e5364D2dB' } 'decoded input': { 'address to': '0x4B0897b0513fdC7C541B6d9D7E929C4e5364D2dB' }
}) })
}, },
...@@ -74,7 +72,7 @@ module.exports = { ...@@ -74,7 +72,7 @@ module.exports = {
.click('*[data-id="settingsWeb3Mode"]') .click('*[data-id="settingsWeb3Mode"]')
.modalFooterOKClick() .modalFooterOKClick()
.clickLaunchIcon('solidity') .clickLaunchIcon('solidity')
.testContracts('Untitled.sol', sources[0]['browser/Untitled.sol'], ['Ballot']) .testContracts('Untitled.sol', sources[0]['Untitled.sol'], ['Ballot'])
.clickLaunchIcon('udapp') .clickLaunchIcon('udapp')
.setValue('input[placeholder="bytes32[] proposalNames"]', '["0x48656c6c6f20576f726c64210000000000000000000000000000000000000000"]') .setValue('input[placeholder="bytes32[] proposalNames"]', '["0x48656c6c6f20576f726c64210000000000000000000000000000000000000000"]')
.click('*[data-id="Deploy - transact (not payable)"]') .click('*[data-id="Deploy - transact (not payable)"]')
......
...@@ -6,7 +6,7 @@ import sauce from './sauce' ...@@ -6,7 +6,7 @@ import sauce from './sauce'
import examples from '../examples/example-contracts' import examples from '../examples/example-contracts'
const sources = [ const sources = [
{ 'browser/Untitled.sol': { content: examples.ballot_0_4_11.content } } { 'Untitled.sol': { content: examples.ballot_0_4_11.content } }
] ]
module.exports = { module.exports = {
...@@ -24,12 +24,12 @@ module.exports = { ...@@ -24,12 +24,12 @@ module.exports = {
.waitForElementVisible('[for="autoCompile"]') .waitForElementVisible('[for="autoCompile"]')
.click('[for="autoCompile"]') .click('[for="autoCompile"]')
.verify.elementPresent('[data-id="compilerContainerAutoCompile"]:checked') .verify.elementPresent('[data-id="compilerContainerAutoCompile"]:checked')
.testContracts('Untitled.sol', sources[0]['browser/Untitled.sol'], ['Ballot']) .testContracts('Untitled.sol', sources[0]['Untitled.sol'], ['Ballot'])
}, },
'Deploy Ballot': function (browser: NightwatchBrowser) { 'Deploy Ballot': function (browser: NightwatchBrowser) {
browser.pause(500) browser.pause(500)
.testContracts('Untitled.sol', sources[0]['browser/Untitled.sol'], ['Ballot']) .testContracts('Untitled.sol', sources[0]['Untitled.sol'], ['Ballot'])
.clickLaunchIcon('udapp') .clickLaunchIcon('udapp')
.selectAccount('0xCA35b7d915458EF540aDe6068dFe2F44E8fa733c') .selectAccount('0xCA35b7d915458EF540aDe6068dFe2F44E8fa733c')
.setValue('input[placeholder="uint8 _numProposals"]', '2') .setValue('input[placeholder="uint8 _numProposals"]', '2')
...@@ -37,10 +37,9 @@ module.exports = { ...@@ -37,10 +37,9 @@ module.exports = {
.waitForElementPresent('*[data-id="universalDappUiContractActionWrapper"]') .waitForElementPresent('*[data-id="universalDappUiContractActionWrapper"]')
.click('*[data-id="universalDappUiTitleExpander"]') .click('*[data-id="universalDappUiTitleExpander"]')
.clickFunction('delegate - transact (not payable)', { types: 'address to', values: '"0x4b0897b0513fdc7c541b6d9d7e929c4e5364d2db"' }) .clickFunction('delegate - transact (not payable)', { types: 'address to', values: '"0x4b0897b0513fdc7c541b6d9d7e929c4e5364d2db"' })
.testFunction('0x41fab8ea5b1d9fba5e0a6545ca1a2d62fff518578802c033c2b9a031a01c31b3', .testFunction('last',
{ {
status: 'true Transaction mined and execution succeed', status: 'true Transaction mined and execution succeed',
'transaction hash': '0x41fab8ea5b1d9fba5e0a6545ca1a2d62fff518578802c033c2b9a031a01c31b3',
'decoded input': { 'address to': '0x4B0897b0513fdC7C541B6d9D7E929C4e5364D2dB' } 'decoded input': { 'address to': '0x4B0897b0513fdC7C541B6d9D7E929C4e5364D2dB' }
}) })
}, },
...@@ -69,10 +68,9 @@ module.exports = { ...@@ -69,10 +68,9 @@ module.exports = {
.waitForElementPresent('*[data-id="universalDappUiContractActionWrapper"]') .waitForElementPresent('*[data-id="universalDappUiContractActionWrapper"]')
.click('*[data-id="universalDappUiTitleExpander"]') .click('*[data-id="universalDappUiTitleExpander"]')
.clickFunction('delegate - transact (not payable)', { types: 'address to', values: '"0x4b0897b0513fdc7c541b6d9d7e929c4e5364d2db"' }) .clickFunction('delegate - transact (not payable)', { types: 'address to', values: '"0x4b0897b0513fdc7c541b6d9d7e929c4e5364d2db"' })
.testFunction('0xca58080c8099429caeeffe43b8104df919c2c543dceb9edf9242fa55f045c803', .testFunction('last',
{ {
status: 'true Transaction mined and execution succeed', status: 'true Transaction mined and execution succeed',
'transaction hash': '0xca58080c8099429caeeffe43b8104df919c2c543dceb9edf9242fa55f045c803',
'decoded input': { 'address to': '0x4B0897b0513fdC7C541B6d9D7E929C4e5364D2dB' } 'decoded input': { 'address to': '0x4B0897b0513fdC7C541B6d9D7E929C4e5364D2dB' }
}) })
}, },
...@@ -82,7 +80,7 @@ module.exports = { ...@@ -82,7 +80,7 @@ module.exports = {
.click('*[data-id="settingsWeb3Mode"]') .click('*[data-id="settingsWeb3Mode"]')
.modalFooterOKClick() .modalFooterOKClick()
.clickLaunchIcon('solidity') .clickLaunchIcon('solidity')
.testContracts('Untitled.sol', sources[0]['browser/Untitled.sol'], ['Ballot']) .testContracts('Untitled.sol', sources[0]['Untitled.sol'], ['Ballot'])
.clickLaunchIcon('udapp') .clickLaunchIcon('udapp')
.setValue('input[placeholder="uint8 _numProposals"]', '2') .setValue('input[placeholder="uint8 _numProposals"]', '2')
.click('*[data-id="Deploy - transact (not payable)"]') .click('*[data-id="Deploy - transact (not payable)"]')
......
...@@ -6,7 +6,7 @@ import sauce from './sauce' ...@@ -6,7 +6,7 @@ import sauce from './sauce'
import examples from '../examples/example-contracts' import examples from '../examples/example-contracts'
const sources = [ const sources = [
{ 'browser/Untitled.sol': { content: examples.ballot.content } } { 'Untitled.sol': { content: examples.ballot.content } }
] ]
module.exports = { module.exports = {
...@@ -24,6 +24,7 @@ module.exports = { ...@@ -24,6 +24,7 @@ module.exports = {
.executeScript('remix.exeCurrent()') .executeScript('remix.exeCurrent()')
.pause(5000) .pause(5000)
.journalChildIncludes('"languageversion": "0.6.8+commit.0bbfe453"') .journalChildIncludes('"languageversion": "0.6.8+commit.0bbfe453"')
.click('*[data-id="terminalClearConsole"]')
}, },
'Should compile using "compileWithParamaters" API with optimization On': function (browser: NightwatchBrowser) { 'Should compile using "compileWithParamaters" API with optimization On': function (browser: NightwatchBrowser) {
...@@ -32,6 +33,7 @@ module.exports = { ...@@ -32,6 +33,7 @@ module.exports = {
.executeScript('remix.exeCurrent()') .executeScript('remix.exeCurrent()')
.pause(10000) .pause(10000)
.journalChildIncludes('\\"optimizer\\":{\\"enabled\\":true,\\"runs\\":300}') .journalChildIncludes('\\"optimizer\\":{\\"enabled\\":true,\\"runs\\":300}')
.click('*[data-id="terminalClearConsole"]')
}, },
'Should compile using "compileWithParamaters" API with optimization off check default runs': function (browser: NightwatchBrowser) { 'Should compile using "compileWithParamaters" API with optimization off check default runs': function (browser: NightwatchBrowser) {
...@@ -40,6 +42,7 @@ module.exports = { ...@@ -40,6 +42,7 @@ module.exports = {
.executeScript('remix.exeCurrent()') .executeScript('remix.exeCurrent()')
.pause(10000) .pause(10000)
.journalChildIncludes('\\"optimizer\\":{\\"enabled\\":false,\\"runs\\":200}') .journalChildIncludes('\\"optimizer\\":{\\"enabled\\":false,\\"runs\\":200}')
.click('*[data-id="terminalClearConsole"]')
}, },
'Should update the compiler configuration with "setCompilerConfig" API': function (browser: NightwatchBrowser) { 'Should update the compiler configuration with "setCompilerConfig" API': function (browser: NightwatchBrowser) {
...@@ -55,7 +58,7 @@ module.exports = { ...@@ -55,7 +58,7 @@ module.exports = {
tearDown: sauce tearDown: sauce
} }
const simpleContract = `pragma solidity >=0.4.22 <0.7.0; const simpleContract = `pragma solidity >=0.4.22 <0.8.1;
/** /**
* @title Storage * @title Storage
......
...@@ -14,7 +14,7 @@ module.exports = { ...@@ -14,7 +14,7 @@ module.exports = {
}, },
'Should launch debugger': function (browser: NightwatchBrowser) { 'Should launch debugger': function (browser: NightwatchBrowser) {
browser.addFile('blah.sol', sources[0]['browser/blah.sol']) browser.addFile('blah.sol', sources[0]['blah.sol'])
.clickLaunchIcon('udapp') .clickLaunchIcon('udapp')
.waitForElementPresent('*[title="Deploy - transact (not payable)"]', 65000) .waitForElementPresent('*[title="Deploy - transact (not payable)"]', 65000)
.click('*[title="Deploy - transact (not payable)"]') .click('*[title="Deploy - transact (not payable)"]')
...@@ -80,7 +80,7 @@ module.exports = { ...@@ -80,7 +80,7 @@ module.exports = {
'Should display solidity imported code while debugging github import': function (browser: NightwatchBrowser) { 'Should display solidity imported code while debugging github import': function (browser: NightwatchBrowser) {
browser browser
.clickLaunchIcon('solidity') .clickLaunchIcon('solidity')
.testContracts('externalImport.sol', sources[1]['browser/externalImport.sol'], ['ERC20']) .testContracts('externalImport.sol', sources[1]['externalImport.sol'], ['ERC20'])
.clickLaunchIcon('udapp') .clickLaunchIcon('udapp')
.waitForElementPresent('*[title="Deploy - transact (not payable)"]', 35000) .waitForElementPresent('*[title="Deploy - transact (not payable)"]', 35000)
.selectContract('ERC20') .selectContract('ERC20')
...@@ -108,8 +108,8 @@ module.exports = { ...@@ -108,8 +108,8 @@ module.exports = {
.clickLaunchIcon('solidity') .clickLaunchIcon('solidity')
.setSolidityCompilerVersion('soljson-v0.6.12+commit.27d51765.js') .setSolidityCompilerVersion('soljson-v0.6.12+commit.27d51765.js')
.clickLaunchIcon('fileExplorers') .clickLaunchIcon('fileExplorers')
.click('li[data-id="treeViewLitreeViewItembrowser/externalImport.sol"') .click('li[data-id="treeViewLitreeViewItemexternalImport.sol"')
.testContracts('withABIEncoderV2.sol', sources[2]['browser/withABIEncoderV2.sol'], ['test']) .testContracts('withABIEncoderV2.sol', sources[2]['withABIEncoderV2.sol'], ['test'])
.clickLaunchIcon('udapp') .clickLaunchIcon('udapp')
.selectContract('test') .selectContract('test')
.createContract('') .createContract('')
...@@ -142,7 +142,7 @@ module.exports = { ...@@ -142,7 +142,7 @@ module.exports = {
'Should load more solidity locals array': function (browser: NightwatchBrowser) { 'Should load more solidity locals array': function (browser: NightwatchBrowser) {
browser browser
.clickLaunchIcon('solidity') .clickLaunchIcon('solidity')
.testContracts('locals.sol', sources[3]['browser/locals.sol'], ['testLocals']) .testContracts('locals.sol', sources[3]['locals.sol'], ['testLocals'])
.clickLaunchIcon('udapp') .clickLaunchIcon('udapp')
.waitForElementPresent('*[title="Deploy - transact (not payable)"]', 40000) .waitForElementPresent('*[title="Deploy - transact (not payable)"]', 40000)
.createContract('') .createContract('')
...@@ -167,7 +167,7 @@ module.exports = { ...@@ -167,7 +167,7 @@ module.exports = {
browser browser
.clickLaunchIcon('solidity') .clickLaunchIcon('solidity')
.pause(2000) .pause(2000)
.testContracts('withGeneratedSources.sol', sources[4]['browser/withGeneratedSources.sol'], ['A']) .testContracts('withGeneratedSources.sol', sources[4]['withGeneratedSources.sol'], ['A'])
.clickLaunchIcon('udapp') .clickLaunchIcon('udapp')
.createContract('') .createContract('')
.clickInstance(4) .clickInstance(4)
...@@ -217,7 +217,7 @@ module.exports = { ...@@ -217,7 +217,7 @@ module.exports = {
const sources = [ const sources = [
{ {
'browser/blah.sol': { 'blah.sol': {
content: ` content: `
pragma solidity >=0.7.0 <0.9.0; pragma solidity >=0.7.0 <0.9.0;
...@@ -250,10 +250,10 @@ const sources = [ ...@@ -250,10 +250,10 @@ const sources = [
} }
}, },
{ {
'browser/externalImport.sol': { content: 'import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/ERC20.sol"; contract test7 {}' } 'externalImport.sol': { content: 'import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/ERC20.sol"; contract test7 {}' }
}, },
{ {
'browser/withABIEncoderV2.sol': { 'withABIEncoderV2.sol': {
content: ` content: `
pragma experimental ABIEncoderV2; pragma experimental ABIEncoderV2;
...@@ -277,7 +277,7 @@ const sources = [ ...@@ -277,7 +277,7 @@ const sources = [
} }
}, },
{ {
'browser/locals.sol': { 'locals.sol': {
content: ` content: `
pragma solidity ^0.8.0; pragma solidity ^0.8.0;
contract testLocals { contract testLocals {
...@@ -292,7 +292,7 @@ const sources = [ ...@@ -292,7 +292,7 @@ const sources = [
} }
}, },
{ {
'browser/withGeneratedSources.sol': { 'withGeneratedSources.sol': {
content: ` content: `
// SPDX-License-Identifier: GPL-3.0 // SPDX-License-Identifier: GPL-3.0
pragma experimental ABIEncoderV2; pragma experimental ABIEncoderV2;
......
...@@ -20,10 +20,10 @@ module.exports = { ...@@ -20,10 +20,10 @@ module.exports = {
browser.waitForElementVisible('div[data-id="remixIdeSidePanel"]') browser.waitForElementVisible('div[data-id="remixIdeSidePanel"]')
.assert.containsText('h6[data-id="sidePanelSwapitTitle"]', 'FILE EXPLORERS') .assert.containsText('h6[data-id="sidePanelSwapitTitle"]', 'FILE EXPLORERS')
.waitForElementVisible('div[data-id="filePanelFileExplorerTree"]') .waitForElementVisible('div[data-id="filePanelFileExplorerTree"]')
.waitForElementVisible('[data-id="treeViewLitreeViewItembrowser/contracts"]') .waitForElementVisible('[data-id="treeViewLitreeViewItemcontracts"]')
.waitForElementVisible('[data-id="treeViewLitreeViewItembrowser/scripts"]') .waitForElementVisible('[data-id="treeViewLitreeViewItemscripts"]')
.waitForElementVisible('[data-id="treeViewLitreeViewItembrowser/tests"]') .waitForElementVisible('[data-id="treeViewLitreeViewItemtests"]')
.waitForElementVisible('[data-id="treeViewLitreeViewItembrowser/README.txt"]') .waitForElementVisible('[data-id="treeViewLitreeViewItemREADME.txt"]')
}, },
'Loads Main View': function (browser: NightwatchBrowser) { 'Loads Main View': function (browser: NightwatchBrowser) {
...@@ -61,19 +61,19 @@ module.exports = { ...@@ -61,19 +61,19 @@ module.exports = {
'Toggles File Explorer Browser': function (browser: NightwatchBrowser) { 'Toggles File Explorer Browser': function (browser: NightwatchBrowser) {
browser browser
.waitForElementVisible('div[data-id="filePanelFileExplorerTree"]') .waitForElementVisible('div[data-id="filePanelFileExplorerTree"]')
.waitForElementPresent('[data-id="treeViewLitreeViewItembrowser/contracts"]') .waitForElementPresent('[data-id="treeViewLitreeViewItemcontracts"]')
.click('[data-path="browser"]') .click('[data-path="default_workspace"]')
.waitForElementNotPresent('[data-id="treeViewLitreeViewItembrowser/contracts"]') .waitForElementNotPresent('[data-id="treeViewLitreeViewItemcontracts"]')
.click('[data-path="browser"]') .click('[data-path="default_workspace"]')
.waitForElementPresent('[data-id="treeViewLitreeViewItembrowser/contracts"]') .waitForElementPresent('[data-id="treeViewLitreeViewItemcontracts"]')
}, },
'Switch Tabs using tabs icon': function (browser: NightwatchBrowser) { 'Switch Tabs using tabs icon': function (browser: NightwatchBrowser) {
browser browser
.waitForElementVisible('div[data-id="filePanelFileExplorerTree"]') .waitForElementVisible('div[data-id="filePanelFileExplorerTree"]')
.click('[data-id="treeViewLitreeViewItembrowser/contracts"]') .click('[data-id="treeViewLitreeViewItemcontracts"]')
.openFile('browser/contracts/3_Ballot.sol') .openFile('contracts/3_Ballot.sol')
.assert.containsText('div[title="browser/contracts/3_Ballot.sol"]', '3_Ballot.sol') .assert.containsText('div[title="contracts/3_Ballot.sol"]', '3_Ballot.sol')
.click('span[class^=dropdownCaret]') .click('span[class^=dropdownCaret]')
.click('#homeItem') .click('#homeItem')
.assert.containsText('div[title="home"]', 'Home') .assert.containsText('div[title="home"]', 'Home')
......
...@@ -14,7 +14,8 @@ module.exports = { ...@@ -14,7 +14,8 @@ module.exports = {
browser.waitForElementVisible('div[data-id="mainPanelPluginsContainer"]') browser.waitForElementVisible('div[data-id="mainPanelPluginsContainer"]')
.clickLaunchIcon('fileExplorers') .clickLaunchIcon('fileExplorers')
.waitForElementVisible('div[data-id="filePanelFileExplorerTree"]') .waitForElementVisible('div[data-id="filePanelFileExplorerTree"]')
.openFile('browser/contracts/1_Storage.sol') .openFile('contracts')
.openFile('contracts/1_Storage.sol')
.waitForElementVisible('*[data-id="editorInput"]') .waitForElementVisible('*[data-id="editorInput"]')
.checkElementStyle('*[data-id="editorInput"]', 'font-size', '12px') .checkElementStyle('*[data-id="editorInput"]', 'font-size', '12px')
.click('*[data-id="tabProxyZoomIn"]') .click('*[data-id="tabProxyZoomIn"]')
...@@ -89,7 +90,7 @@ module.exports = { ...@@ -89,7 +90,7 @@ module.exports = {
.addFile('sourcehighlight.js', sourcehighlightScript) .addFile('sourcehighlight.js', sourcehighlightScript)
.addFile('removeSourcehighlightScript.js', removeSourcehighlightScript) .addFile('removeSourcehighlightScript.js', removeSourcehighlightScript)
.addFile('removeAllSourcehighlightScript.js', removeAllSourcehighlightScript) .addFile('removeAllSourcehighlightScript.js', removeAllSourcehighlightScript)
.openFile('browser/sourcehighlight.js') .openFile('sourcehighlight.js')
.executeScript('remix.exeCurrent()') .executeScript('remix.exeCurrent()')
.editorScroll('down', 60) .editorScroll('down', 60)
.waitForElementPresent('.highlightLine32') .waitForElementPresent('.highlightLine32')
...@@ -101,26 +102,26 @@ module.exports = { ...@@ -101,26 +102,26 @@ module.exports = {
}, },
'Should remove 1 highlight from source code': function (browser: NightwatchBrowser) { 'Should remove 1 highlight from source code': function (browser: NightwatchBrowser) {
browser.waitForElementVisible('li[data-id="treeViewLitreeViewItembrowser/removeSourcehighlightScript.js"]') browser.waitForElementVisible('li[data-id="treeViewLitreeViewItemremoveSourcehighlightScript.js"]')
.click('li[data-id="treeViewLitreeViewItembrowser/removeSourcehighlightScript.js"]') .click('li[data-id="treeViewLitreeViewItemremoveSourcehighlightScript.js"]')
.pause(2000) .pause(2000)
.executeScript('remix.exeCurrent()') .executeScript('remix.exeCurrent()')
.waitForElementVisible('li[data-id="treeViewLitreeViewItembrowser/contracts"]') .waitForElementVisible('li[data-id="treeViewLitreeViewItemcontracts"]')
.click('li[data-id="treeViewLitreeViewItembrowser/contracts"]') .click('li[data-id="treeViewLitreeViewItemcontracts"]')
.waitForElementVisible('li[data-id="treeViewLitreeViewItembrowser/contracts/3_Ballot.sol"]') .waitForElementVisible('li[data-id="treeViewLitreeViewItemcontracts/3_Ballot.sol"]')
.click('li[data-id="treeViewLitreeViewItembrowser/contracts/3_Ballot.sol"]') .click('li[data-id="treeViewLitreeViewItemcontracts/3_Ballot.sol"]')
.waitForElementNotPresent('.highlightLine32') .waitForElementNotPresent('.highlightLine32')
.checkElementStyle('.highlightLine40', 'background-color', 'rgb(8, 108, 181)') .checkElementStyle('.highlightLine40', 'background-color', 'rgb(8, 108, 181)')
.checkElementStyle('.highlightLine50', 'background-color', 'rgb(8, 108, 181)') .checkElementStyle('.highlightLine50', 'background-color', 'rgb(8, 108, 181)')
}, },
'Should remove all highlights from source code': function (browser: NightwatchBrowser) { 'Should remove all highlights from source code': function (browser: NightwatchBrowser) {
browser.waitForElementVisible('li[data-id="treeViewLitreeViewItembrowser/removeAllSourcehighlightScript.js"]') browser.waitForElementVisible('li[data-id="treeViewLitreeViewItemremoveAllSourcehighlightScript.js"]')
.click('li[data-id="treeViewLitreeViewItembrowser/removeAllSourcehighlightScript.js"]') .click('li[data-id="treeViewLitreeViewItemremoveAllSourcehighlightScript.js"]')
.pause(2000) .pause(2000)
.executeScript('remix.exeCurrent()') .executeScript('remix.exeCurrent()')
.waitForElementVisible('li[data-id="treeViewLitreeViewItembrowser/contracts/3_Ballot.sol"]') .waitForElementVisible('li[data-id="treeViewLitreeViewItemcontracts/3_Ballot.sol"]')
.click('li[data-id="treeViewLitreeViewItembrowser/contracts/3_Ballot.sol"]') .click('li[data-id="treeViewLitreeViewItemcontracts/3_Ballot.sol"]')
.pause(2000) .pause(2000)
.waitForElementNotPresent('.highlightLine32') .waitForElementNotPresent('.highlightLine32')
.waitForElementNotPresent('.highlightLine40') .waitForElementNotPresent('.highlightLine40')
...@@ -160,7 +161,7 @@ const sourcehighlightScript = { ...@@ -160,7 +161,7 @@ const sourcehighlightScript = {
column: 20 column: 20
} }
} }
await remix.call('editor', 'highlight', pos, 'browser/contracts/3_Ballot.sol') await remix.call('editor', 'highlight', pos, 'contracts/3_Ballot.sol')
const pos2 = { const pos2 = {
start: { start: {
...@@ -172,7 +173,7 @@ const sourcehighlightScript = { ...@@ -172,7 +173,7 @@ const sourcehighlightScript = {
column: 20 column: 20
} }
} }
await remix.call('editor', 'highlight', pos2, 'browser/contracts/3_Ballot.sol') await remix.call('editor', 'highlight', pos2, 'contracts/3_Ballot.sol')
const pos3 = { const pos3 = {
start: { start: {
...@@ -184,7 +185,7 @@ const sourcehighlightScript = { ...@@ -184,7 +185,7 @@ const sourcehighlightScript = {
column: 20 column: 20
} }
} }
await remix.call('editor', 'highlight', pos3, 'browser/contracts/3_Ballot.sol') await remix.call('editor', 'highlight', pos3, 'contracts/3_Ballot.sol')
} catch (e) { } catch (e) {
console.log(e.message) console.log(e.message)
} }
...@@ -196,7 +197,7 @@ const removeSourcehighlightScript = { ...@@ -196,7 +197,7 @@ const removeSourcehighlightScript = {
content: ` content: `
(async () => { (async () => {
try { try {
await remix.call('editor', 'discardHighlightAt', 32, 'browser/contracts/3_Ballot.sol') await remix.call('editor', 'discardHighlightAt', 32, 'contracts/3_Ballot.sol')
} catch (e) { } catch (e) {
console.log(e.message) console.log(e.message)
} }
......
...@@ -20,59 +20,63 @@ module.exports = { ...@@ -20,59 +20,63 @@ module.exports = {
browser.waitForElementVisible('div[data-id="remixIdeSidePanel"]') browser.waitForElementVisible('div[data-id="remixIdeSidePanel"]')
.clickLaunchIcon('fileExplorers') .clickLaunchIcon('fileExplorers')
.assert.containsText('h6[data-id="sidePanelSwapitTitle"]', 'FILE EXPLORERS') .assert.containsText('h6[data-id="sidePanelSwapitTitle"]', 'FILE EXPLORERS')
.click('li[data-id="treeViewLitreeViewItemREADME.txt"]') // focus on root directory
.click('*[data-id="fileExplorerNewFilecreateNewFile"]') .click('*[data-id="fileExplorerNewFilecreateNewFile"]')
.pause(1000) .pause(1000)
.waitForElementVisible('*[data-id="treeViewLitreeViewItembrowser/blank"]') .waitForElementVisible('*[data-id="treeViewLitreeViewItem/blank"]')
.sendKeys('*[data-id="treeViewLitreeViewItembrowser/blank"] .remixui_items', '5_New_contract.sol') .sendKeys('*[data-id="treeViewLitreeViewItem/blank"] .remixui_items', '5_New_contract.sol')
.sendKeys('*[data-id="treeViewLitreeViewItembrowser/blank"] .remixui_items', browser.Keys.ENTER) .sendKeys('*[data-id="treeViewLitreeViewItem/blank"] .remixui_items', browser.Keys.ENTER)
.waitForElementVisible('*[data-id="treeViewLitreeViewItembrowser/5_New_contract.sol"]', 7000) .waitForElementVisible('*[data-id="treeViewLitreeViewItem5_New_contract.sol"]', 7000)
}, },
'Should rename `5_New_contract.sol` to 5_Renamed_Contract.sol': function (browser: NightwatchBrowser) { 'Should rename `5_New_contract.sol` to 5_Renamed_Contract.sol': function (browser: NightwatchBrowser) {
browser browser
.waitForElementVisible('*[data-id="treeViewLitreeViewItembrowser/5_New_contract.sol"]') .waitForElementVisible('*[data-id="treeViewLitreeViewItem5_New_contract.sol"]')
.renamePath('browser/5_New_contract.sol', '5_Renamed_Contract.sol', 'browser/5_Renamed_Contract.sol') .click('*[data-id="treeViewLitreeViewItem5_New_contract.sol"]')
.waitForElementVisible('*[data-id="treeViewLitreeViewItembrowser/5_Renamed_Contract.sol"]') .renamePath('5_New_contract.sol', '5_Renamed_Contract.sol', '5_Renamed_Contract.sol')
.waitForElementVisible('*[data-id="treeViewLitreeViewItem5_Renamed_Contract.sol"]')
}, },
'Should delete file `5_Renamed_Contract.sol` from file explorer': function (browser: NightwatchBrowser) { 'Should delete file `5_Renamed_Contract.sol` from file explorer': function (browser: NightwatchBrowser) {
browser browser
.waitForElementVisible('*[data-id="treeViewLitreeViewItembrowser/5_Renamed_Contract.sol"]') .waitForElementVisible('*[data-id="treeViewLitreeViewItem5_Renamed_Contract.sol"]')
.rightClick('[data-path="browser/5_Renamed_Contract.sol"]') .rightClick('[data-path="5_Renamed_Contract.sol"]')
.click('*[id="menuitemdelete"]') .click('*[id="menuitemdelete"]')
.waitForElementVisible('*[data-id="browserModalDialogContainer-react"]') .waitForElementVisible('*[data-id="default_workspaceModalDialogContainer-react"]')
.pause(2000) .pause(2000)
.click('.modal-ok') .click('.modal-ok')
.waitForElementNotPresent('*[data-id="treeViewLitreeViewItembrowser/5_Renamed_Contract.sol"') .waitForElementNotPresent('*[data-id="treeViewLitreeViewItem5_Renamed_Contract.sol"')
}, },
'Should create a new folder': function (browser: NightwatchBrowser) { 'Should create a new folder': function (browser: NightwatchBrowser) {
browser browser
.waitForElementVisible('*[data-id="treeViewLitreeViewItembrowser/README.txt"]') .waitForElementVisible('*[data-id="treeViewLitreeViewItemREADME.txt"]')
.click('li[data-id="treeViewLitreeViewItemREADME.txt"]') // focus on root directory
.click('[data-id="fileExplorerNewFilecreateNewFolder"]') .click('[data-id="fileExplorerNewFilecreateNewFolder"]')
.pause(1000) .pause(1000)
.waitForElementVisible('*[data-id="treeViewLitreeViewItembrowser/blank"]') .waitForElementVisible('*[data-id="treeViewLitreeViewItem/blank"]')
.sendKeys('*[data-id="treeViewLitreeViewItembrowser/blank"] .remixui_items', 'Browser_Tests') .sendKeys('*[data-id="treeViewLitreeViewItem/blank"] .remixui_items', 'Browser_Tests')
.sendKeys('*[data-id="treeViewLitreeViewItembrowser/blank"] .remixui_items', browser.Keys.ENTER) .sendKeys('*[data-id="treeViewLitreeViewItem/blank"] .remixui_items', browser.Keys.ENTER)
.waitForElementVisible('*[data-id="treeViewLitreeViewItembrowser/Browser_Tests"]') .waitForElementVisible('*[data-id="treeViewLitreeViewItemBrowser_Tests"]')
}, },
'Should rename Browser_Tests folder to Browser_E2E_Tests': function (browser: NightwatchBrowser) { 'Should rename Browser_Tests folder to Browser_E2E_Tests': function (browser: NightwatchBrowser) {
browser browser
.waitForElementVisible('*[data-id="treeViewLitreeViewItembrowser/Browser_Tests"]') .waitForElementVisible('*[data-id="treeViewLitreeViewItemBrowser_Tests"]')
.renamePath('browser/Browser_Tests', 'Browser_E2E_Tests', 'browser/Browser_E2E_Tests') .click('*[data-id="treeViewLitreeViewItemBrowser_Tests"]')
.waitForElementVisible('*[data-id="treeViewLitreeViewItembrowser/Browser_E2E_Tests"]') .renamePath('Browser_Tests', 'Browser_E2E_Tests', 'Browser_E2E_Tests')
.waitForElementVisible('*[data-id="treeViewLitreeViewItemBrowser_E2E_Tests"]')
}, },
'Should delete Browser_E2E_Tests folder': function (browser: NightwatchBrowser) { 'Should delete Browser_E2E_Tests folder': function (browser: NightwatchBrowser) {
browser browser
.waitForElementVisible('*[data-id="treeViewLitreeViewItembrowser/Browser_E2E_Tests"]') .waitForElementVisible('*[data-id="treeViewLitreeViewItemBrowser_E2E_Tests"]')
.rightClick('[data-path="browser/Browser_E2E_Tests"]') .rightClick('[data-path="Browser_E2E_Tests"]')
.click('*[id="menuitemdelete"]') .click('*[id="menuitemdelete"]')
.waitForElementVisible('*[data-id="browserModalDialogContainer-react"]') .waitForElementVisible('*[data-id="default_workspaceModalDialogContainer-react"]')
.pause(2000) .pause(2000)
.click('.modal-ok') .click('.modal-ok')
.waitForElementNotPresent('*[data-id="treeViewLitreeViewItembrowser/Browser_E2E_Tests"]') .waitForElementNotPresent('*[data-id="treeViewLitreeViewItemBrowser_E2E_Tests"]')
}, },
'Should publish all explorer files to github gist': function (browser: NightwatchBrowser) { 'Should publish all explorer files to github gist': function (browser: NightwatchBrowser) {
...@@ -82,11 +86,11 @@ module.exports = { ...@@ -82,11 +86,11 @@ module.exports = {
.pause(10000) .pause(10000)
.waitForElementVisible('*[data-id="fileExplorerNewFilepublishToGist"]') .waitForElementVisible('*[data-id="fileExplorerNewFilepublishToGist"]')
.click('*[data-id="fileExplorerNewFilepublishToGist"]') .click('*[data-id="fileExplorerNewFilepublishToGist"]')
.waitForElementVisible('*[data-id="browserModalDialogContainer-react"]') .waitForElementVisible('*[data-id="default_workspaceModalDialogContainer-react"]')
.pause(2000) .pause(2000)
.click('.modal-ok') .click('.modal-ok')
.pause(2000) .pause(2000)
.waitForElementVisible('*[data-id="browserModalDialogContainer-react"]') .waitForElementVisible('*[data-id="default_workspaceModalDialogContainer-react"]')
.pause(2000) .pause(2000)
.click('.modal-ok') .click('.modal-ok')
.pause(2000) .pause(2000)
...@@ -105,9 +109,9 @@ module.exports = { ...@@ -105,9 +109,9 @@ module.exports = {
.setValue('*[data-id="fileExplorerFileUpload"]', testData.testFile1) .setValue('*[data-id="fileExplorerFileUpload"]', testData.testFile1)
.setValue('*[data-id="fileExplorerFileUpload"]', testData.testFile2) .setValue('*[data-id="fileExplorerFileUpload"]', testData.testFile2)
.setValue('*[data-id="fileExplorerFileUpload"]', testData.testFile3) .setValue('*[data-id="fileExplorerFileUpload"]', testData.testFile3)
.waitForElementVisible('[data-id="treeViewLitreeViewItembrowser/editor.test.js"]') .waitForElementVisible('[data-id="treeViewLitreeViewItemeditor.test.js"]')
.waitForElementVisible('[data-id="treeViewLitreeViewItembrowser/fileExplorer.test.js"]') .waitForElementVisible('[data-id="treeViewLitreeViewItemfileExplorer.test.js"]')
.waitForElementVisible('[data-id="treeViewLitreeViewItembrowser/generalSettings.test.js"]') .waitForElementVisible('[data-id="treeViewLitreeViewItemgeneralSettings.test.js"]')
.end() .end()
}, },
......
...@@ -13,7 +13,7 @@ module.exports = { ...@@ -13,7 +13,7 @@ module.exports = {
.addFile('file.js', { content: executeFile }) .addFile('file.js', { content: executeFile })
.executeScript('remix.exeCurrent()') .executeScript('remix.exeCurrent()')
.pause(5000) .pause(5000)
.journalLastChildIncludes('browser/file.js') .journalLastChildIncludes('file.js')
}, },
'Should execute `exists` api from file manager external api': function (browser: NightwatchBrowser) { 'Should execute `exists` api from file manager external api': function (browser: NightwatchBrowser) {
...@@ -21,8 +21,8 @@ module.exports = { ...@@ -21,8 +21,8 @@ module.exports = {
.addFile('exists.js', { content: executeExists }) .addFile('exists.js', { content: executeExists })
.executeScript('remix.exeCurrent()') .executeScript('remix.exeCurrent()')
.pause(2000) .pause(2000)
.journalChildIncludes('browser/exists.js true') .journalChildIncludes('exists.js true')
.journalChildIncludes('browser/non-exists.js false') .journalChildIncludes('non-exists.js false')
}, },
'Should execute `open` api from file manager external api': function (browser: NightwatchBrowser) { 'Should execute `open` api from file manager external api': function (browser: NightwatchBrowser) {
...@@ -30,7 +30,7 @@ module.exports = { ...@@ -30,7 +30,7 @@ module.exports = {
.addFile('open.js', { content: executeOpen }) .addFile('open.js', { content: executeOpen })
.executeScript('remix.exeCurrent()') .executeScript('remix.exeCurrent()')
.pause(2000) .pause(2000)
.journalLastChildIncludes('browser/contracts/3_Ballot.sol') .journalLastChildIncludes('contracts/3_Ballot.sol')
}, },
'Should execute `writeFile` api from file manager external api': function (browser: NightwatchBrowser) { 'Should execute `writeFile` api from file manager external api': function (browser: NightwatchBrowser) {
...@@ -38,7 +38,7 @@ module.exports = { ...@@ -38,7 +38,7 @@ module.exports = {
.addFile('writeFile.js', { content: executeWriteFile }) .addFile('writeFile.js', { content: executeWriteFile })
.executeScript('remix.exeCurrent()') .executeScript('remix.exeCurrent()')
.pause(2000) .pause(2000)
.openFile('browser/new_contract.sol') .openFile('new_contract.sol')
.assert.containsText('[data-id="editorInput"]', 'pragma solidity ^0.6.0') .assert.containsText('[data-id="editorInput"]', 'pragma solidity ^0.6.0')
}, },
...@@ -63,7 +63,7 @@ module.exports = { ...@@ -63,7 +63,7 @@ module.exports = {
.addFile('renameFile.js', { content: executeRename }) .addFile('renameFile.js', { content: executeRename })
.executeScript('remix.exeCurrent()') .executeScript('remix.exeCurrent()')
.pause(2000) .pause(2000)
.waitForElementPresent('[data-id="treeViewLitreeViewItembrowser/old_contract.sol"]') .waitForElementPresent('[data-id="treeViewLitreeViewItemold_contract.sol"]')
}, },
'Should execute `mkdir` api from file manager external api': function (browser: NightwatchBrowser) { 'Should execute `mkdir` api from file manager external api': function (browser: NightwatchBrowser) {
...@@ -71,7 +71,7 @@ module.exports = { ...@@ -71,7 +71,7 @@ module.exports = {
.addFile('mkdirFile.js', { content: executeMkdir }) .addFile('mkdirFile.js', { content: executeMkdir })
.executeScript('remix.exeCurrent()') .executeScript('remix.exeCurrent()')
.pause(2000) .pause(2000)
.waitForElementPresent('[data-id="treeViewLitreeViewItembrowser/Test_Folder"]') .waitForElementPresent('[data-id="treeViewLitreeViewItemTest_Folder"]')
}, },
'Should execute `readdir` api from file manager external api': function (browser: NightwatchBrowser) { 'Should execute `readdir` api from file manager external api': function (browser: NightwatchBrowser) {
...@@ -87,16 +87,16 @@ module.exports = { ...@@ -87,16 +87,16 @@ module.exports = {
.addFile('removeFile.js', { content: executeRemove }) .addFile('removeFile.js', { content: executeRemove })
.executeScript('remix.exeCurrent()') .executeScript('remix.exeCurrent()')
.pause(2000) .pause(2000)
.waitForElementNotPresent('[data-id="treeViewLitreeViewItembrowser/old_contract.sol"]') .waitForElementNotPresent('[data-id="treeViewLitreeViewItemold_contract.sol"]')
}, },
// TODO: Fix remove root directory prefix for browser and localhost // TODO: Fix remove root directory prefix for browser and localhost
'Should execute `remove` api from file manager external api on a folder': '' + function (browser: NightwatchBrowser) { 'Should execute `remove` api from file manager external api on a folder': function (browser: NightwatchBrowser) {
browser browser
.addFile('test_jsRemoveFolder.js', { content: executeRemoveOnFolder }) .addFile('test_jsRemoveFolder.js', { content: executeRemoveOnFolder })
.executeScript('remix.exeCurrent()') .executeScript('remix.exeCurrent()')
.pause(2000) .pause(2000)
.waitForElementNotPresent('[data-id="treeViewLitreeViewItembrowser/tests"]') .waitForElementNotPresent('[data-id="treeViewLitreeViewItemTest_Folder"]')
.end() .end()
}, },
...@@ -115,11 +115,11 @@ const executeFile = ` ...@@ -115,11 +115,11 @@ const executeFile = `
const executeExists = ` const executeExists = `
const run = async () => { const run = async () => {
const result1 = await remix.call('fileManager', 'exists', 'browser/exists.js') const result1 = await remix.call('fileManager', 'exists', 'exists.js')
const result2 = await remix.call('fileManager', 'exists', 'browser/non-exists.js') const result2 = await remix.call('fileManager', 'exists', 'non-exists.js')
console.log('browser/exists.js ' + result1) console.log('exists.js ' + result1)
console.log('browser/non-exists.js ' + result2) console.log('non-exists.js ' + result2)
} }
run() run()
...@@ -127,7 +127,7 @@ const executeExists = ` ...@@ -127,7 +127,7 @@ const executeExists = `
const executeOpen = ` const executeOpen = `
const run = async () => { const run = async () => {
await remix.call('fileManager', 'open', 'browser/contracts/3_Ballot.sol') await remix.call('fileManager', 'open', 'contracts/3_Ballot.sol')
const result = await remix.call('fileManager', 'file') const result = await remix.call('fileManager', 'file')
console.log(result) console.log(result)
...@@ -138,7 +138,7 @@ const executeOpen = ` ...@@ -138,7 +138,7 @@ const executeOpen = `
const executeWriteFile = ` const executeWriteFile = `
const run = async () => { const run = async () => {
await remix.call('fileManager', 'writeFile', 'browser/new_contract.sol', 'pragma solidity ^0.6.0') await remix.call('fileManager', 'writeFile', 'new_contract.sol', 'pragma solidity ^0.6.0')
} }
run() run()
...@@ -146,7 +146,7 @@ const executeWriteFile = ` ...@@ -146,7 +146,7 @@ const executeWriteFile = `
const executeReadFile = ` const executeReadFile = `
const run = async () => { const run = async () => {
const result = await remix.call('fileManager', 'readFile', 'browser/new_contract.sol') const result = await remix.call('fileManager', 'readFile', 'new_contract.sol')
console.log(result) console.log(result)
} }
...@@ -156,8 +156,8 @@ const executeReadFile = ` ...@@ -156,8 +156,8 @@ const executeReadFile = `
const executeCopyFile = ` const executeCopyFile = `
const run = async () => { const run = async () => {
await remix.call('fileManager', 'copyFile', 'browser/contracts/3_Ballot.sol', 'browser/new_contract.sol') await remix.call('fileManager', 'copyFile', 'contracts/3_Ballot.sol', 'new_contract.sol')
const result = await remix.call('fileManager', 'readFile', 'browser/new_contract.sol') const result = await remix.call('fileManager', 'readFile', 'new_contract.sol')
console.log(result) console.log(result)
} }
...@@ -167,7 +167,7 @@ const executeCopyFile = ` ...@@ -167,7 +167,7 @@ const executeCopyFile = `
const executeRename = ` const executeRename = `
const run = async () => { const run = async () => {
await remix.call('fileManager', 'rename', 'browser/new_contract.sol', 'browser/old_contract.sol') await remix.call('fileManager', 'rename', 'new_contract.sol', 'old_contract.sol')
} }
run() run()
...@@ -175,7 +175,7 @@ const executeRename = ` ...@@ -175,7 +175,7 @@ const executeRename = `
const executeMkdir = ` const executeMkdir = `
const run = async () => { const run = async () => {
await remix.call('fileManager', 'mkdir', 'browser/Test_Folder/') await remix.call('fileManager', 'mkdir', 'Test_Folder/')
} }
run() run()
...@@ -183,7 +183,7 @@ const executeMkdir = ` ...@@ -183,7 +183,7 @@ const executeMkdir = `
const executeReaddir = ` const executeReaddir = `
const run = async () => { const run = async () => {
const result = await remix.call('fileManager', 'readdir', 'browser/') const result = await remix.call('fileManager', 'readdir', '/')
console.log('Test_Folder isDirectory ', result["Test_Folder"].isDirectory) console.log('Test_Folder isDirectory ', result["Test_Folder"].isDirectory)
} }
...@@ -193,7 +193,7 @@ const executeReaddir = ` ...@@ -193,7 +193,7 @@ const executeReaddir = `
const executeRemove = ` const executeRemove = `
const run = async () => { const run = async () => {
await remix.call('fileManager', 'remove', 'browser/old_contract.sol') await remix.call('fileManager', 'remove', 'old_contract.sol')
} }
run() run()
...@@ -201,7 +201,7 @@ const executeRemove = ` ...@@ -201,7 +201,7 @@ const executeRemove = `
const executeRemoveOnFolder = `(async () => { const executeRemoveOnFolder = `(async () => {
try { try {
await remix.call('fileManager', 'remove', 'browser') await remix.call('fileManager', 'remove', 'Test_Folder')
} catch (e) { } catch (e) {
console.log(e.message) console.log(e.message)
} }
......
...@@ -20,15 +20,15 @@ module.exports = { ...@@ -20,15 +20,15 @@ module.exports = {
browser.waitForElementVisible('*[data-id="remixIdeSidePanel"]', 5000) browser.waitForElementVisible('*[data-id="remixIdeSidePanel"]', 5000)
.waitForElementVisible('*[data-id="settingsTabGenerateContractMetadataLabel"]', 5000) .waitForElementVisible('*[data-id="settingsTabGenerateContractMetadataLabel"]', 5000)
.click('*[data-id="verticalIconsFileExplorerIcons"]') .click('*[data-id="verticalIconsFileExplorerIcons"]')
.click('[data-id="treeViewLitreeViewItembrowser/contracts"]') .click('[data-id="treeViewLitreeViewItemcontracts"]')
.openFile('browser/contracts/3_Ballot.sol') .openFile('contracts/3_Ballot.sol')
.click('*[data-id="verticalIconsKindsolidity"]') .click('*[data-id="verticalIconsKindsolidity"]')
.pause(2000) .pause(2000)
.click('*[data-id="compilerContainerCompileBtn"]') .click('*[data-id="compilerContainerCompileBtn"]')
.pause(3000) .pause(3000)
.click('*[data-id="verticalIconsKindfileExplorers"]') .click('*[data-id="verticalIconsKindfileExplorers"]')
.openFile('browser/contracts/artifacts/Ballot.json') .openFile('contracts/artifacts/Ballot.json')
.openFile('browser/contracts/artifacts/Ballot_metadata.json') .openFile('contracts/artifacts/Ballot_metadata.json')
.getEditorValue((content) => { .getEditorValue((content) => {
const metadata = JSON.parse(content) const metadata = JSON.parse(content)
browser.assert.equal(metadata.language, 'Solidity') browser.assert.equal(metadata.language, 'Solidity')
......
...@@ -21,25 +21,26 @@ module.exports = { ...@@ -21,25 +21,26 @@ module.exports = {
- switch to a file in the new gist - switch to a file in the new gist
*/ */
console.log('token', process.env.gist_token) console.log('token', process.env.gist_token)
const runtimeBrowser = browser.options.desiredCapabilities.browserName
browser browser
.refresh() .refresh()
.pause(10000) .pause(10000)
.waitForElementVisible('*[data-id="remixIdeIconPanel"]', 10000) .waitForElementVisible('*[data-id="remixIdeIconPanel"]', 10000)
.click('li[data-id="treeViewLitreeViewItemREADME.txt"]') // focus on root directory
.waitForElementVisible('*[data-id="fileExplorerNewFilecreateNewFolder"]')
.click('[data-id="fileExplorerNewFilecreateNewFolder"]') .click('[data-id="fileExplorerNewFilecreateNewFolder"]')
.pause(1000) .pause(1000)
.waitForElementVisible('*[data-id="treeViewLitreeViewItembrowser/blank"]') .waitForElementVisible('*[data-id="treeViewLitreeViewItem/blank"]')
.sendKeys('*[data-id="treeViewLitreeViewItembrowser/blank"] .remixui_items', 'Browser_Tests') .sendKeys('*[data-id="treeViewLitreeViewItem/blank"] .remixui_items', 'Browser_Tests')
.sendKeys('*[data-id="treeViewLitreeViewItembrowser/blank"] .remixui_items', browser.Keys.ENTER) .sendKeys('*[data-id="treeViewLitreeViewItem/blank"] .remixui_items', browser.Keys.ENTER)
.waitForElementVisible('*[data-id="treeViewLitreeViewItembrowser/Browser_Tests"]') .waitForElementVisible('*[data-id="treeViewLitreeViewItemBrowser_Tests"]')
.addFile('File.sol', { content: '' }) .addFile('File.sol', { content: '' })
.click('*[data-id="fileExplorerNewFilepublishToGist"]') .click('*[data-id="fileExplorerNewFilepublishToGist"]')
.waitForElementVisible('*[data-id="browserModalDialogContainer-react"]')
.pause(2000) .pause(2000)
.waitForElementVisible('*[data-id="default_workspaceModalDialogContainer-react"]')
.click('.modal-ok') .click('.modal-ok')
.pause(10000) .pause(10000)
.getText('[data-id="browserModalDialogModalBody-react"]', (result) => { .getText('[data-id="default_workspaceModalDialogModalBody-react"]', (result) => {
console.log(result) console.log(result)
const value = typeof result.value === 'string' ? result.value : null const value = typeof result.value === 'string' ? result.value : null
const reg = /gist.github.com\/([^.]+)/ const reg = /gist.github.com\/([^.]+)/
...@@ -51,12 +52,12 @@ module.exports = { ...@@ -51,12 +52,12 @@ module.exports = {
} else { } else {
const gistid = id[1] const gistid = id[1]
browser browser
.click('[data-id="browser-modal-footer-cancel-react"]') .click('[data-id="default_workspace-modal-footer-cancel-react"]')
.executeScript(`remix.loadgist('${gistid}')`) .executeScript(`remix.loadgist('${gistid}')`)
.perform((done) => { if (runtimeBrowser === 'chrome') { browser.openFile('browser/gists') } done() }) // .perform((done) => { if (runtimeBrowser === 'chrome') { browser.openFile('gists') } done() })
.waitForElementVisible(`[data-id="treeViewLitreeViewItembrowser/gists/${gistid}"]`) .waitForElementVisible(`[data-id="treeViewLitreeViewItem${gistid}"]`)
.click(`[data-id="treeViewLitreeViewItembrowser/gists/${gistid}"]`) .click(`[data-id="treeViewLitreeViewItem${gistid}"]`)
.openFile(`browser/gists/${gistid}/README.txt`) .openFile(`${gistid}/README.txt`)
} }
}) })
}, },
...@@ -96,14 +97,14 @@ module.exports = { ...@@ -96,14 +97,14 @@ module.exports = {
.clickLaunchIcon('fileExplorers') .clickLaunchIcon('fileExplorers')
.waitForElementVisible('*[data-id="fileExplorerNewFilepublishToGist"]') .waitForElementVisible('*[data-id="fileExplorerNewFilepublishToGist"]')
.click('*[data-id="fileExplorerNewFilepublishToGist"]') .click('*[data-id="fileExplorerNewFilepublishToGist"]')
.waitForElementVisible('*[data-id="browserModalDialogContainer-react"]') .waitForElementVisible('*[data-id="default_workspaceModalDialogContainer-react"]')
.pause(2000) .pause(2000)
.click('.modal-ok') .click('.modal-ok')
.pause(10000) .pause(10000)
.getText('[data-id="browserModalDialogModalBody-react"]', (result) => { .getText('[data-id="default_workspaceModalDialogModalBody-react"]', (result) => {
browser.assert.ok(result.value === 'Remix requires an access token (which includes gists creation permission). Please go to the settings tab to create one.', 'Assert failed. Gist token error message not displayed.') browser.assert.ok(result.value === 'Remix requires an access token (which includes gists creation permission). Please go to the settings tab to create one.', 'Assert failed. Gist token error message not displayed.')
}) })
.click('[data-id="browser-modal-footer-ok-react"]') .click('[data-id="default_workspace-modal-footer-ok-react"]')
}, },
'Import From Gist For Valid Gist ID': function (browser: NightwatchBrowser) { 'Import From Gist For Valid Gist ID': function (browser: NightwatchBrowser) {
...@@ -118,9 +119,9 @@ module.exports = { ...@@ -118,9 +119,9 @@ module.exports = {
.waitForElementVisible('*[data-id="modalDialogCustomPromptText"]') .waitForElementVisible('*[data-id="modalDialogCustomPromptText"]')
.setValue('*[data-id="modalDialogCustomPromptText"]', testData.validGistId) .setValue('*[data-id="modalDialogCustomPromptText"]', testData.validGistId)
.modalFooterOKClick() .modalFooterOKClick()
.openFile(`browser/gists/${testData.validGistId}/ApplicationRegistry`) .openFile(`${testData.validGistId}/ApplicationRegistry`)
.waitForElementVisible(`div[title='browser/gists/${testData.validGistId}/ApplicationRegistry']`) .waitForElementVisible(`div[title='${testData.validGistId}/ApplicationRegistry']`)
.assert.containsText(`div[title='browser/gists/${testData.validGistId}/ApplicationRegistry'] > span`, 'ApplicationRegistry') .assert.containsText(`div[title='${testData.validGistId}/ApplicationRegistry'] > span`, 'ApplicationRegistry')
.end() .end()
}, },
......
...@@ -13,7 +13,7 @@ module.exports = { ...@@ -13,7 +13,7 @@ module.exports = {
}, },
'Add Lib Test File': function (browser: NightwatchBrowser) { 'Add Lib Test File': function (browser: NightwatchBrowser) {
browser.addFile('Untitled5.sol', sources[0]['browser/Untitled5.sol']) browser.addFile('Untitled5.sol', sources[0]['Untitled5.sol'])
.clickLaunchIcon('udapp') .clickLaunchIcon('udapp')
.selectAccount('0xCA35b7d915458EF540aDe6068dFe2F44E8fa733c') // this account will be used for this test suite .selectAccount('0xCA35b7d915458EF540aDe6068dFe2F44E8fa733c') // this account will be used for this test suite
}, },
...@@ -67,7 +67,7 @@ module.exports = { ...@@ -67,7 +67,7 @@ module.exports = {
function checkDeployShouldFail (browser: NightwatchBrowser, callback: VoidFunction) { function checkDeployShouldFail (browser: NightwatchBrowser, callback: VoidFunction) {
let config let config
browser.openFile('browser/artifacts').openFile('browser/artifacts/test.json') browser.openFile('artifacts/test.json')
.getEditorValue((content) => { .getEditorValue((content) => {
config = JSON.parse(content) config = JSON.parse(content)
config.deploy['VM:-'].autoDeployLib = false config.deploy['VM:-'].autoDeployLib = false
...@@ -75,7 +75,7 @@ function checkDeployShouldFail (browser: NightwatchBrowser, callback: VoidFuncti ...@@ -75,7 +75,7 @@ function checkDeployShouldFail (browser: NightwatchBrowser, callback: VoidFuncti
.perform(() => { .perform(() => {
browser.setEditorValue(JSON.stringify(config)) browser.setEditorValue(JSON.stringify(config))
}) })
.openFile('browser/Untitled5.sol') .openFile('Untitled5.sol')
.clickLaunchIcon('udapp') .clickLaunchIcon('udapp')
.selectContract('test') // deploy lib .selectContract('test') // deploy lib
.createContract('') .createContract('')
...@@ -89,16 +89,16 @@ function checkDeployShouldFail (browser: NightwatchBrowser, callback: VoidFuncti ...@@ -89,16 +89,16 @@ function checkDeployShouldFail (browser: NightwatchBrowser, callback: VoidFuncti
function checkDeployShouldSucceed (browser: NightwatchBrowser, address: string, callback: VoidFunction) { function checkDeployShouldSucceed (browser: NightwatchBrowser, address: string, callback: VoidFunction) {
let addressRef: string let addressRef: string
let config let config
browser.openFile('browser/artifacts').openFile('browser/artifacts/test.json') browser.openFile('artifacts/test.json')
.getEditorValue((content) => { .getEditorValue((content) => {
config = JSON.parse(content) config = JSON.parse(content)
config.deploy['VM:-'].autoDeployLib = false config.deploy['VM:-'].autoDeployLib = false
config.deploy['VM:-'].linkReferences['browser/Untitled5.sol'].lib = address config.deploy['VM:-'].linkReferences['Untitled5.sol'].lib = address
}) })
.perform(() => { .perform(() => {
browser.setEditorValue(JSON.stringify(config)) browser.setEditorValue(JSON.stringify(config))
}) })
.openFile('browser/Untitled5.sol') .openFile('Untitled5.sol')
.clickLaunchIcon('udapp') .clickLaunchIcon('udapp')
.selectContract('test') // deploy lib .selectContract('test') // deploy lib
.createContract('') .createContract('')
...@@ -116,7 +116,7 @@ function checkDeployShouldSucceed (browser: NightwatchBrowser, address: string, ...@@ -116,7 +116,7 @@ function checkDeployShouldSucceed (browser: NightwatchBrowser, address: string,
const sources = [ const sources = [
{ {
'browser/Untitled5.sol': { 'Untitled5.sol': {
content: `library lib { content: `library lib {
function getInt () public view returns (uint) { function getInt () public view returns (uint) {
return 45; return 45;
......
...@@ -72,7 +72,7 @@ module.exports = { ...@@ -72,7 +72,7 @@ module.exports = {
.assert.containsText('*[data-id="pluginManagerSettingsPermissionForm"]', 'No Permission requested yet') .assert.containsText('*[data-id="pluginManagerSettingsPermissionForm"]', 'No Permission requested yet')
.modalFooterOKClick() .modalFooterOKClick()
.click('*[data-id="verticalIconsFileExplorerIcons"]') .click('*[data-id="verticalIconsFileExplorerIcons"]')
.openFile('browser/3_Ballot.sol') .openFile('3_Ballot.sol')
.click('*[plugin="ZoKrates"]') .click('*[plugin="ZoKrates"]')
.pause(5000) .pause(5000)
.frame(0) .frame(0)
......
...@@ -16,8 +16,8 @@ module.exports = { ...@@ -16,8 +16,8 @@ module.exports = {
browser browser
.waitForElementVisible('#icon-panel', 10000) .waitForElementVisible('#icon-panel', 10000)
.clickLaunchIcon('fileExplorers') .clickLaunchIcon('fileExplorers')
.click('[data-id="treeViewLitreeViewItembrowser/contracts"]') .click('[data-id="treeViewLitreeViewItemcontracts"]')
.openFile('browser/contracts/3_Ballot.sol') .openFile('contracts/3_Ballot.sol')
.verifyContracts(['Ballot']) .verifyContracts(['Ballot'])
.click('#publishOnIpfs') .click('#publishOnIpfs')
.pause(8000) .pause(8000)
...@@ -45,7 +45,7 @@ module.exports = { ...@@ -45,7 +45,7 @@ module.exports = {
browser browser
.waitForElementVisible('#icon-panel') .waitForElementVisible('#icon-panel')
.clickLaunchIcon('fileExplorers') .clickLaunchIcon('fileExplorers')
.openFile('browser/contracts/1_Storage.sol') .openFile('contracts/1_Storage.sol')
.clickLaunchIcon('udapp') .clickLaunchIcon('udapp')
.waitForElementPresent('*[data-id="contractDropdownIpfsCheckbox"]') .waitForElementPresent('*[data-id="contractDropdownIpfsCheckbox"]')
.click('*[data-id="contractDropdownIpfsCheckbox"]') .click('*[data-id="contractDropdownIpfsCheckbox"]')
...@@ -61,9 +61,9 @@ module.exports = { ...@@ -61,9 +61,9 @@ module.exports = {
'Should remember choice after page refresh': function (browser: NightwatchBrowser) { 'Should remember choice after page refresh': function (browser: NightwatchBrowser) {
browser browser
.refresh() .refresh()
.waitForElementVisible('[data-id="treeViewLitreeViewItembrowser/contracts"]') .waitForElementVisible('[data-id="treeViewLitreeViewItemcontracts"]')
.click('[data-id="treeViewLitreeViewItembrowser/contracts"]') .click('[data-id="treeViewLitreeViewItemcontracts"]')
.openFile('browser/contracts/1_Storage.sol') .openFile('contracts/1_Storage.sol')
.clickLaunchIcon('udapp') .clickLaunchIcon('udapp')
.waitForElementPresent('*[data-id="contractDropdownIpfsCheckbox"]') .waitForElementPresent('*[data-id="contractDropdownIpfsCheckbox"]')
.verify.elementPresent('*[data-id="contractDropdownIpfsCheckbox"]:checked') .verify.elementPresent('*[data-id="contractDropdownIpfsCheckbox"]:checked')
......
...@@ -37,7 +37,7 @@ module.exports = { ...@@ -37,7 +37,7 @@ module.exports = {
.perform(() => done()) .perform(() => done())
}) })
.click('*[data-id="deployAndRunClearInstances"]') .click('*[data-id="deployAndRunClearInstances"]')
.testContracts('testRecorder.sol', sources[0]['browser/testRecorder.sol'], ['testRecorder']) .testContracts('testRecorder.sol', sources[0]['testRecorder.sol'], ['testRecorder'])
.clickLaunchIcon('udapp') .clickLaunchIcon('udapp')
.createContract('12') .createContract('12')
.waitForElementPresent('.instance:nth-of-type(2)') .waitForElementPresent('.instance:nth-of-type(2)')
...@@ -64,7 +64,7 @@ module.exports = { ...@@ -64,7 +64,7 @@ module.exports = {
// deploy 2 contracts (2 different ABIs), save the record, reexecute and test one of the function. // deploy 2 contracts (2 different ABIs), save the record, reexecute and test one of the function.
browser browser
.click('*[data-id="deployAndRunClearInstances"]') .click('*[data-id="deployAndRunClearInstances"]')
.testContracts('multipleContracts.sol', sources[1]['browser/multipleContracts.sol'], ['t1est', 't2est']) .testContracts('multipleContracts.sol', sources[1]['multipleContracts.sol'], ['t1est', 't2est'])
.clickLaunchIcon('udapp') .clickLaunchIcon('udapp')
.selectContract('t1est') .selectContract('t1est')
.pause(1000) .pause(1000)
...@@ -81,10 +81,9 @@ module.exports = { ...@@ -81,10 +81,9 @@ module.exports = {
.clickInstance(1) .clickInstance(1)
.pause(1000) .pause(1000)
.clickFunction('set2 - transact (not payable)', { types: 'uint256 _po', values: '10' }) .clickFunction('set2 - transact (not payable)', { types: 'uint256 _po', values: '10' })
.testFunction('0xa88bf726e706480f61f04a066452929030c0a0216cc6923106f863963339bdb7', .testFunction('last',
{ {
status: 'true Transaction mined and execution succeed', status: 'true Transaction mined and execution succeed',
'transaction hash': '0xa88bf726e706480f61f04a066452929030c0a0216cc6923106f863963339bdb7',
'decoded input': { 'uint256 _po': { type: 'BigNumber', hex: '0x0a' } } 'decoded input': { 'uint256 _po': { type: 'BigNumber', hex: '0x0a' } }
}) })
.end() .end()
...@@ -93,7 +92,7 @@ module.exports = { ...@@ -93,7 +92,7 @@ module.exports = {
} }
const sources = [{ const sources = [{
'browser/testRecorder.sol': { 'testRecorder.sol': {
content: `contract testRecorder { content: `contract testRecorder {
constructor(uint p) public { constructor(uint p) public {
...@@ -105,7 +104,7 @@ const sources = [{ ...@@ -105,7 +104,7 @@ const sources = [{
} }
}, },
{ {
'browser/multipleContracts.sol': { 'multipleContracts.sol': {
content: `contract t1est { content: `contract t1est {
uint p; uint p;
t2est t; t2est t;
...@@ -163,7 +162,7 @@ const records = `{ ...@@ -163,7 +162,7 @@ const records = `{
"contractName": "test", "contractName": "test",
"bytecode": "60606040526040516020806102b183398101604052808051906020019091905050806000819055505061027a806100376000396000f300606060405260043610610062576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680632f30c6f61461006757806338cc48311461009e57806362738998146100f357806387cc10e11461011c575b600080fd5b61009c600480803590602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610145565b005b34156100a957600080fd5b6100b1610191565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156100fe57600080fd5b6101066101bb565b6040518082815260200191505060405180910390f35b341561012757600080fd5b61012f6101c4565b6040518082815260200191505060405180910390f35b8160008190555080600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505050565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60008054905090565b600073__browser/ballot.sol:testLib____________636d4ce63c6000604051602001526040518163ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040160206040518083038186803b151561022e57600080fd5b6102c65a03f4151561023f57600080fd5b505050604051805190509050905600a165627a7a72305820e0b2510bb2890a0334bfe5613d96db3e72442e63b514cdeaee8fc2c6bbd19d3a0029", "bytecode": "60606040526040516020806102b183398101604052808051906020019091905050806000819055505061027a806100376000396000f300606060405260043610610062576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680632f30c6f61461006757806338cc48311461009e57806362738998146100f357806387cc10e11461011c575b600080fd5b61009c600480803590602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610145565b005b34156100a957600080fd5b6100b1610191565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156100fe57600080fd5b6101066101bb565b6040518082815260200191505060405180910390f35b341561012757600080fd5b61012f6101c4565b6040518082815260200191505060405180910390f35b8160008190555080600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505050565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60008054905090565b600073__browser/ballot.sol:testLib____________636d4ce63c6000604051602001526040518163ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040160206040518083038186803b151561022e57600080fd5b6102c65a03f4151561023f57600080fd5b505050604051805190509050905600a165627a7a72305820e0b2510bb2890a0334bfe5613d96db3e72442e63b514cdeaee8fc2c6bbd19d3a0029",
"linkReferences": { "linkReferences": {
"browser/ballot.sol": { "ballot.sol": {
"testLib": [ "testLib": [
{ {
"length": 20, "length": 20,
......
...@@ -31,10 +31,10 @@ const sources = [ ...@@ -31,10 +31,10 @@ const sources = [
'localhost/src/gmbh/contract.sol': { content: gmbhTestContract } 'localhost/src/gmbh/contract.sol': { content: gmbhTestContract }
}, },
{ {
'browser/test_import_node_modules.sol': { content: 'import "openzeppelin-solidity/contracts/math/SafeMath.sol";' } 'test_import_node_modules.sol': { content: 'import "openzeppelin-solidity/contracts/math/SafeMath.sol";' }
}, },
{ {
'browser/test_import_node_modules_with_github_import.sol': { content: 'import "openzeppelin-solidity/contracts/sample.sol";' } 'test_import_node_modules_with_github_import.sol': { content: 'import "openzeppelin-solidity/contracts/sample.sol";' }
} }
] ]
...@@ -57,18 +57,20 @@ module.exports = { ...@@ -57,18 +57,20 @@ module.exports = {
*/ */
browser.waitForElementVisible('#icon-panel', 2000) browser.waitForElementVisible('#icon-panel', 2000)
.clickLaunchIcon('fileExplorers') // .clickLaunchIcon('fileExplorers')
.addFile('test_import_node_modules.sol', sources[3]['browser/test_import_node_modules.sol']) .click('[data-path="ballot.sol"]')
.addFile('test_import_node_modules.sol', sources[3]['test_import_node_modules.sol'])
.clickLaunchIcon('solidity') .clickLaunchIcon('solidity')
.testContracts('test_import_node_modules.sol', sources[3]['browser/test_import_node_modules.sol'], ['SafeMath']) .setSolidityCompilerVersion('soljson-v0.5.0+commit.1d4f565a.js')
.testContracts('test_import_node_modules.sol', sources[3]['test_import_node_modules.sol'], ['SafeMath'])
}, },
'Import from node_modules and reference a github import': function (browser) { 'Import from node_modules and reference a github import': function (browser) {
browser.waitForElementVisible('#icon-panel', 2000) browser.waitForElementVisible('#icon-panel', 2000)
.clickLaunchIcon('fileExplorers') .clickLaunchIcon('fileExplorers')
.addFile('test_import_node_modules_with_github_import.sol', sources[4]['browser/test_import_node_modules_with_github_import.sol']) .addFile('test_import_node_modules_with_github_import.sol', sources[4]['test_import_node_modules_with_github_import.sol'])
.clickLaunchIcon('solidity') .clickLaunchIcon('solidity')
.setSolidityCompilerVersion('soljson-v0.8.0+commit.c7dfd78e.js') // open-zeppelin moved to pragma ^0.8.0 .setSolidityCompilerVersion('soljson-v0.8.0+commit.c7dfd78e.js') // open-zeppelin moved to pragma ^0.8.0
.testContracts('test_import_node_modules_with_github_import.sol', sources[4]['browser/test_import_node_modules_with_github_import.sol'], ['ERC20', 'test11']) .testContracts('test_import_node_modules_with_github_import.sol', sources[4]['test_import_node_modules_with_github_import.sol'], ['ERC20', 'test11'])
}, },
'Run git status': function (browser) { 'Run git status': function (browser) {
...@@ -104,48 +106,48 @@ function runTests (browser: NightwatchBrowser) { ...@@ -104,48 +106,48 @@ function runTests (browser: NightwatchBrowser) {
.pause(2000) .pause(2000)
.click('#modal-footer-ok') .click('#modal-footer-ok')
.clickLaunchIcon('fileExplorers') .clickLaunchIcon('fileExplorers')
.waitForElementVisible('[data-path="localhost/folder1"]') .waitForElementVisible('[data-path="folder1"]')
.click('[data-path="localhost/folder1"]') .click('[data-path="folder1"]')
.waitForElementVisible('[data-path="localhost/contract1.sol"]') .waitForElementVisible('[data-path="contract1.sol"]')
.assert.containsText('[data-path="localhost/contract1.sol"]', 'contract1.sol') .assert.containsText('[data-path="contract1.sol"]', 'contract1.sol')
.assert.containsText('[data-path="localhost/contract2.sol"]', 'contract2.sol') .assert.containsText('[data-path="contract2.sol"]', 'contract2.sol')
.waitForElementVisible('[data-path="localhost/folder1/contract1.sol"]') .waitForElementVisible('[data-path="folder1/contract1.sol"]')
.assert.containsText('[data-path="localhost/folder1/contract1.sol"]', 'contract1.sol') .assert.containsText('[data-path="folder1/contract1.sol"]', 'contract1.sol')
.assert.containsText('[data-path="localhost/folder1/contract2.sol"]', 'contract2.sol') // load and test sub folder .assert.containsText('[data-path="folder1/contract2.sol"]', 'contract2.sol') // load and test sub folder
.click('[data-path="localhost/folder1/contract2.sol"]') .click('[data-path="folder1/contract2.sol"]')
.click('[data-path="localhost/folder1/contract1.sol"]') // open localhost/folder1/contract1.sol .click('[data-path="folder1/contract1.sol"]') // open localhost/folder1/contract1.sol
.pause(1000) .pause(1000)
.testEditorValue('contract test1 { function get () returns (uint) { return 10; }}') // check the content and replace by another .testEditorValue('contract test1 { function get () returns (uint) { return 10; }}') // check the content and replace by another
.setEditorValue('contract test1Changed { function get () returns (uint) { return 10; }}') .setEditorValue('contract test1Changed { function get () returns (uint) { return 10; }}')
.testEditorValue('contract test1Changed { function get () returns (uint) { return 10; }}') .testEditorValue('contract test1Changed { function get () returns (uint) { return 10; }}')
.setEditorValue('contract test1 { function get () returns (uint) { return 10; }}') .setEditorValue('contract test1 { function get () returns (uint) { return 10; }}')
.click('[data-path="localhost/folder1/contract_' + browserName + '.sol"]') // rename a file and check .click('[data-path="folder1/contract_' + browserName + '.sol"]') // rename a file and check
.pause(1000) .pause(1000)
.renamePath('localhost/folder1/contract_' + browserName + '.sol', 'renamed_contract_' + browserName + '.sol', 'localhost/folder1/renamed_contract_' + browserName + '.sol') .renamePath('folder1/contract_' + browserName + '.sol', 'renamed_contract_' + browserName + '.sol', 'folder1/renamed_contract_' + browserName + '.sol')
.pause(1000) .pause(1000)
.removeFile('localhost/folder1/contract_' + browserName + '_toremove.sol') .removeFile('folder1/contract_' + browserName + '_toremove.sol')
.perform(function (done) { .perform(function (done) {
testImportFromRemixd(browser, () => { done() }) testImportFromRemixd(browser, () => { done() })
}) })
.clickLaunchIcon('fileExplorers') .clickLaunchIcon('fileExplorers')
.waitForElementVisible('[data-path="localhost/folder1"]') .waitForElementVisible('[data-path="folder1"]')
.click('[data-path="localhost/folder1"]') .click('[data-path="folder1"]')
.click('[data-path="localhost/folder1"]') // click twice because remixd does not return nested folder details after update .click('[data-path="folder1"]') // click twice because remixd does not return nested folder details after update
.waitForElementVisible('[data-path="localhost/folder1/contract1.sol"]') .waitForElementVisible('[data-path="folder1/contract1.sol"]')
.waitForElementVisible('[data-path="localhost/folder1/renamed_contract_' + browserName + '.sol"]') // check if renamed file is preset .waitForElementVisible('[data-path="folder1/renamed_contract_' + browserName + '.sol"]') // check if renamed file is preset
.waitForElementNotPresent('[data-path="localhost/folder1/contract_' + browserName + '.sol"]') // check if renamed (old) file is not present .waitForElementNotPresent('[data-path="folder1/contract_' + browserName + '.sol"]') // check if renamed (old) file is not present
.waitForElementNotPresent('[data-path="localhost/folder1/contract_' + browserName + '_toremove.sol"]') // check if removed (old) file is not present .waitForElementNotPresent('[data-path="folder1/contract_' + browserName + '_toremove.sol"]') // check if removed (old) file is not present
.click('[data-path="localhost/folder1/renamed_contract_' + browserName + '.sol"]') // .click('[data-path="folder1/renamed_contract_' + browserName + '.sol"]')
} }
function testImportFromRemixd (browser: NightwatchBrowser, callback: VoidFunction) { function testImportFromRemixd (browser: NightwatchBrowser, callback: VoidFunction) {
browser browser
.waitForElementVisible('[data-path="localhost/src"]', 100000) .waitForElementVisible('[data-path="src"]', 100000)
.click('[data-path="localhost/src"]') .click('[data-path="src"]')
.waitForElementVisible('[data-path="localhost/src/gmbh"]', 100000) .waitForElementVisible('[data-path="src/gmbh"]', 100000)
.click('[data-path="localhost/src/gmbh"]') .click('[data-path="src/gmbh"]')
.waitForElementVisible('[data-path="localhost/src/gmbh/company.sol"]', 100000) .waitForElementVisible('[data-path="src/gmbh/company.sol"]', 100000)
.click('[data-path="localhost/src/gmbh/company.sol"]') .click('[data-path="src/gmbh/company.sol"]')
.pause(1000) .pause(1000)
.verifyContracts(['Assets', 'gmbh']) .verifyContracts(['Assets', 'gmbh'])
.perform(() => { callback() }) .perform(() => { callback() })
......
...@@ -49,15 +49,14 @@ module.exports = { ...@@ -49,15 +49,14 @@ module.exports = {
'Should deploy contract on JavascriptVM': function (browser: NightwatchBrowser) { 'Should deploy contract on JavascriptVM': function (browser: NightwatchBrowser) {
browser.waitForElementPresent('*[data-id="remixIdeSidePanel"]') browser.waitForElementPresent('*[data-id="remixIdeSidePanel"]')
.clickLaunchIcon('fileExplorers') .clickLaunchIcon('fileExplorers')
.addFile('Greet.sol', sources[0]['browser/Greet.sol']) .addFile('Greet.sol', sources[0]['Greet.sol'])
.clickLaunchIcon('udapp') .clickLaunchIcon('udapp')
.selectAccount('0xCA35b7d915458EF540aDe6068dFe2F44E8fa733c') .selectAccount('0xCA35b7d915458EF540aDe6068dFe2F44E8fa733c')
.waitForElementPresent('*[data-id="Deploy - transact (not payable)"]', 45000) .waitForElementPresent('*[data-id="Deploy - transact (not payable)"]', 45000)
.click('*[data-id="Deploy - transact (not payable)"]') .click('*[data-id="Deploy - transact (not payable)"]')
.pause(5000) .pause(5000)
.testFunction('0xcc391e151ace69f4cfb51cda42fb6c2e1092f28c8c2757af20b1aae5ec076ead', { .testFunction('last', {
status: 'true Transaction mined and execution succeed', status: 'true Transaction mined and execution succeed'
'transaction hash': '0xcc391e151ace69f4cfb51cda42fb6c2e1092f28c8c2757af20b1aae5ec076ead'
}) })
}, },
...@@ -68,9 +67,8 @@ module.exports = { ...@@ -68,9 +67,8 @@ module.exports = {
.waitForElementPresent('*[data-id="pluginManagerSettingsDeployAndRunLLTxSendTransaction"]') .waitForElementPresent('*[data-id="pluginManagerSettingsDeployAndRunLLTxSendTransaction"]')
.click('*[data-id="pluginManagerSettingsDeployAndRunLLTxSendTransaction"]') .click('*[data-id="pluginManagerSettingsDeployAndRunLLTxSendTransaction"]')
.pause(5000) .pause(5000)
.testFunction('0xfe718871ee0b4d03cdcac0e12e5b164efaf7e23ba952c07db76e62692867019b', { .testFunction('last', {
status: 'true Transaction mined and execution succeed', status: 'true Transaction mined and execution succeed'
'transaction hash': '0xfe718871ee0b4d03cdcac0e12e5b164efaf7e23ba952c07db76e62692867019b'
}) })
.end() .end()
}, },
...@@ -99,7 +97,7 @@ module.exports = { ...@@ -99,7 +97,7 @@ module.exports = {
'Should deploy contract on Goerli Test Network using MetaMask': '' + function (browser: NightwatchBrowser) { 'Should deploy contract on Goerli Test Network using MetaMask': '' + function (browser: NightwatchBrowser) {
browser.waitForElementPresent('*[data-id="runTabSelectAccount"] option') browser.waitForElementPresent('*[data-id="runTabSelectAccount"] option')
.clickLaunchIcon('fileExplorers') .clickLaunchIcon('fileExplorers')
.openFile('browser/Greet.sol') .openFile('Greet.sol')
.clickLaunchIcon('udapp') .clickLaunchIcon('udapp')
.waitForElementPresent('*[data-id="Deploy - transact (not payable)"]') .waitForElementPresent('*[data-id="Deploy - transact (not payable)"]')
.click('*[data-id="Deploy - transact (not payable)"]') .click('*[data-id="Deploy - transact (not payable)"]')
...@@ -151,7 +149,7 @@ module.exports = { ...@@ -151,7 +149,7 @@ module.exports = {
'Should deploy contract on Ethereum Main Network using MetaMask': '' + function (browser: NightwatchBrowser) { 'Should deploy contract on Ethereum Main Network using MetaMask': '' + function (browser: NightwatchBrowser) {
browser.waitForElementPresent('*[data-id="runTabSelectAccount"] option') browser.waitForElementPresent('*[data-id="runTabSelectAccount"] option')
.clickLaunchIcon('fileExplorers') .clickLaunchIcon('fileExplorers')
.openFile('browser/Greet.sol') .openFile('Greet.sol')
.clickLaunchIcon('udapp') .clickLaunchIcon('udapp')
.waitForElementPresent('*[data-id="Deploy - transact (not payable)"]') .waitForElementPresent('*[data-id="Deploy - transact (not payable)"]')
.click('*[data-id="Deploy - transact (not payable)"]') .click('*[data-id="Deploy - transact (not payable)"]')
...@@ -205,7 +203,7 @@ module.exports = { ...@@ -205,7 +203,7 @@ module.exports = {
const sources = [ const sources = [
{ {
'browser/Greet.sol': { 'Greet.sol': {
content: content:
` `
pragma solidity ^0.8.0; pragma solidity ^0.8.0;
......
...@@ -25,8 +25,8 @@ module.exports = { ...@@ -25,8 +25,8 @@ module.exports = {
browser.assert.ok(typeof hash.value === 'string', 'type of hash.value must be String') browser.assert.ok(typeof hash.value === 'string', 'type of hash.value must be String')
browser.assert.ok(typeof signature.value === 'string', 'type of signature.value must be String') browser.assert.ok(typeof signature.value === 'string', 'type of signature.value must be String')
}) })
.addFile('signMassage.sol', sources[0]['browser/signMassage.sol']) .addFile('signMassage.sol', sources[0]['signMassage.sol'])
.openFile('browser/signMassage.sol') .openFile('signMassage.sol')
.clickLaunchIcon('solidity') .clickLaunchIcon('solidity')
.click('*[data-id="compilerContainerCompileBtn"]') .click('*[data-id="compilerContainerCompileBtn"]')
.clickLaunchIcon('udapp') .clickLaunchIcon('udapp')
...@@ -57,7 +57,7 @@ module.exports = { ...@@ -57,7 +57,7 @@ module.exports = {
const sources = [ const sources = [
{ {
'browser/signMassage.sol': { 'signMassage.sol': {
content: ` content: `
pragma solidity >=0.4.22 <0.9.0; pragma solidity >=0.4.22 <0.9.0;
contract SignMassageTest { contract SignMassageTest {
......
...@@ -13,26 +13,26 @@ module.exports = { ...@@ -13,26 +13,26 @@ module.exports = {
}, },
'Test Simple Contract': function (browser: NightwatchBrowser) { 'Test Simple Contract': function (browser: NightwatchBrowser) {
browser.testContracts('Untitled.sol', sources[0]['browser/Untitled.sol'], ['test1', 'test2']) browser.testContracts('Untitled.sol', sources[0]['Untitled.sol'], ['test1', 'test2'])
}, },
'Test Success Import': function (browser: NightwatchBrowser) { 'Test Success Import': function (browser: NightwatchBrowser) {
browser.addFile('Untitled1.sol', sources[1]['browser/Untitled1.sol']) browser.addFile('Untitled1.sol', sources[1]['Untitled1.sol'])
.addFile('Untitled2.sol', sources[1]['browser/Untitled2.sol']) .addFile('Untitled2.sol', sources[1]['Untitled2.sol'])
.openFile('browser/Untitled1.sol') .openFile('Untitled1.sol')
.verifyContracts(['test6', 'test4', 'test5']) .verifyContracts(['test6', 'test4', 'test5'])
}, },
'Test Failed Import': function (browser: NightwatchBrowser) { 'Test Failed Import': function (browser: NightwatchBrowser) {
browser.addFile('Untitled3.sol', sources[2]['browser/Untitled3.sol']) browser.addFile('Untitled3.sol', sources[2]['Untitled3.sol'])
.clickLaunchIcon('solidity') .clickLaunchIcon('solidity')
.assert.containsText('#compileTabView .error pre', 'not found browser/Untitled11.sol') .assert.containsText('#compileTabView .error pre', 'not found Untitled11.sol')
}, },
'Test Github Import - from master branch': function (browser: NightwatchBrowser) { 'Test Github Import - from master branch': function (browser: NightwatchBrowser) {
browser browser
.setSolidityCompilerVersion('soljson-v0.8.0+commit.c7dfd78e.js') // open-zeppelin moved to pragma ^0.8.0 (master branch) .setSolidityCompilerVersion('soljson-v0.8.0+commit.c7dfd78e.js') // open-zeppelin moved to pragma ^0.8.0 (master branch)
.addFile('Untitled4.sol', sources[3]['browser/Untitled4.sol']) .addFile('Untitled4.sol', sources[3]['Untitled4.sol'])
.clickLaunchIcon('fileExplorers') .clickLaunchIcon('fileExplorers')
.verifyContracts(['test7', 'ERC20'], { wait: 10000 }) .verifyContracts(['test7', 'ERC20'], { wait: 10000 })
}, },
...@@ -40,7 +40,7 @@ module.exports = { ...@@ -40,7 +40,7 @@ module.exports = {
'Test Github Import - from other branch': function (browser: NightwatchBrowser) { 'Test Github Import - from other branch': function (browser: NightwatchBrowser) {
browser browser
.setSolidityCompilerVersion('soljson-v0.5.0+commit.1d4f565a.js') // switch back to 0.5.0 : release-v2.3.0 branch is not solidity 0.6 compliant .setSolidityCompilerVersion('soljson-v0.5.0+commit.1d4f565a.js') // switch back to 0.5.0 : release-v2.3.0 branch is not solidity 0.6 compliant
.addFile('Untitled5.sol', sources[4]['browser/Untitled5.sol']) .addFile('Untitled5.sol', sources[4]['Untitled5.sol'])
.clickLaunchIcon('fileExplorers') .clickLaunchIcon('fileExplorers')
.verifyContracts(['test8', 'ERC20', 'SafeMath'], { wait: 10000 }) .verifyContracts(['test8', 'ERC20', 'SafeMath'], { wait: 10000 })
}, },
...@@ -49,8 +49,8 @@ module.exports = { ...@@ -49,8 +49,8 @@ module.exports = {
browser browser
.setSolidityCompilerVersion('soljson-v0.8.0+commit.c7dfd78e.js') // open-zeppelin moved to pragma ^0.8.0 (master branch) .setSolidityCompilerVersion('soljson-v0.8.0+commit.c7dfd78e.js') // open-zeppelin moved to pragma ^0.8.0 (master branch)
.clickLaunchIcon('fileExplorers') .clickLaunchIcon('fileExplorers')
.click('li[data-id="treeViewLitreeViewItembrowser/README.txt"') .click('li[data-id="treeViewLitreeViewItemREADME.txt"')
.addFile('Untitled6.sol', sources[5]['browser/Untitled6.sol']) .addFile('Untitled6.sol', sources[5]['Untitled6.sol'])
.clickLaunchIcon('fileExplorers') .clickLaunchIcon('fileExplorers')
.verifyContracts(['test10', 'ERC20'], { wait: 10000 }) .verifyContracts(['test10', 'ERC20'], { wait: 10000 })
}, },
...@@ -58,8 +58,8 @@ module.exports = { ...@@ -58,8 +58,8 @@ module.exports = {
'Test Github Import - raw URL': function (browser: NightwatchBrowser) { 'Test Github Import - raw URL': function (browser: NightwatchBrowser) {
browser browser
.clickLaunchIcon('fileExplorers') .clickLaunchIcon('fileExplorers')
.click('li[data-id="treeViewLitreeViewItembrowser/README.txt"') .click('li[data-id="treeViewLitreeViewItemREADME.txt"')
.addFile('Untitled7.sol', sources[6]['browser/Untitled7.sol']) .addFile('Untitled7.sol', sources[6]['Untitled7.sol'])
.clickLaunchIcon('fileExplorers') .clickLaunchIcon('fileExplorers')
.verifyContracts(['test11', 'ERC20'], { wait: 10000 }) .verifyContracts(['test11', 'ERC20'], { wait: 10000 })
}, },
...@@ -68,8 +68,8 @@ module.exports = { ...@@ -68,8 +68,8 @@ module.exports = {
browser browser
.setSolidityCompilerVersion('soljson-v0.7.4+commit.3f05b770.js') .setSolidityCompilerVersion('soljson-v0.7.4+commit.3f05b770.js')
.clickLaunchIcon('fileExplorers') .clickLaunchIcon('fileExplorers')
.click('li[data-id="treeViewLitreeViewItembrowser/README.txt"') .click('li[data-id="treeViewLitreeViewItemREADME.txt"')
.addFile('Untitled8.sol', sources[7]['browser/Untitled8.sol']) .addFile('Untitled8.sol', sources[7]['Untitled8.sol'])
.clickLaunchIcon('fileExplorers') .clickLaunchIcon('fileExplorers')
.clickLaunchIcon('solidity') .clickLaunchIcon('solidity')
.waitForElementPresent('[data-id="compiledErrors"] div:nth-child(3)', 45000) .waitForElementPresent('[data-id="compiledErrors"] div:nth-child(3)', 45000)
...@@ -85,8 +85,8 @@ module.exports = { ...@@ -85,8 +85,8 @@ module.exports = {
browser browser
// .setSolidityCompilerVersion('soljson-v0.8.0+commit.c7dfd78e.js') // .setSolidityCompilerVersion('soljson-v0.8.0+commit.c7dfd78e.js')
.clickLaunchIcon('fileExplorers') .clickLaunchIcon('fileExplorers')
.click('li[data-id="treeViewLitreeViewItembrowser/README.txt"') .click('li[data-id="treeViewLitreeViewItemREADME.txt"')
.addFile('Untitled9.sol', sources[8]['browser/Untitled9.sol']) .addFile('Untitled9.sol', sources[8]['Untitled9.sol'])
.clickLaunchIcon('fileExplorers') .clickLaunchIcon('fileExplorers')
.verifyContracts(['test13', 'ERC20', 'SafeMath'], { wait: 30000 }) .verifyContracts(['test13', 'ERC20', 'SafeMath'], { wait: 30000 })
.end() .end()
...@@ -96,31 +96,31 @@ module.exports = { ...@@ -96,31 +96,31 @@ module.exports = {
const sources = [ const sources = [
{ {
'browser/Untitled.sol': { content: 'contract test1 {} contract test2 {}' } 'Untitled.sol': { content: 'contract test1 {} contract test2 {}' }
}, },
{ {
'browser/Untitled1.sol': { content: 'import "./Untitled2.sol"; contract test6 {}' }, 'Untitled1.sol': { content: 'import "./Untitled2.sol"; contract test6 {}' },
'browser/Untitled2.sol': { content: 'contract test4 {} contract test5 {}' } 'Untitled2.sol': { content: 'contract test4 {} contract test5 {}' }
}, },
{ {
'browser/Untitled3.sol': { content: 'import "./Untitled11.sol"; contract test6 {}' } 'Untitled3.sol': { content: 'import "./Untitled11.sol"; contract test6 {}' }
}, },
{ {
'browser/Untitled4.sol': { content: 'import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/ERC20.sol"; contract test7 {}' } 'Untitled4.sol': { content: 'import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/ERC20.sol"; contract test7 {}' }
}, },
{ {
'browser/Untitled5.sol': { content: 'import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v2.3.0/contracts/token/ERC20/ERC20.sol"; contract test8 {}' } 'Untitled5.sol': { content: 'import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v2.3.0/contracts/token/ERC20/ERC20.sol"; contract test8 {}' }
}, },
{ {
'browser/Untitled6.sol': { content: 'import "https://github.com/OpenZeppelin/openzeppelin-contracts/contracts/token/ERC20/ERC20.sol"; contract test10 {}' } 'Untitled6.sol': { content: 'import "https://github.com/OpenZeppelin/openzeppelin-contracts/contracts/token/ERC20/ERC20.sol"; contract test10 {}' }
}, },
{ {
'browser/Untitled7.sol': { content: 'import "https://raw.githubusercontent.com/OpenZeppelin/openzeppelin-contracts/master/contracts/token/ERC20/ERC20.sol"; contract test11 {}' } 'Untitled7.sol': { content: 'import "https://raw.githubusercontent.com/OpenZeppelin/openzeppelin-contracts/master/contracts/token/ERC20/ERC20.sol"; contract test11 {}' }
}, },
{ {
'browser/Untitled8.sol': { content: 'import "https://raw.githubusercontent.com/OpenZeppelin/openzeppelin-contracts/master/contracts/token/ERC20/ERC20.sol"; contract test12 {}' } 'Untitled8.sol': { content: 'import "https://raw.githubusercontent.com/OpenZeppelin/openzeppelin-contracts/master/contracts/token/ERC20/ERC20.sol"; contract test12 {}' }
}, },
{ {
'browser/Untitled9.sol': { content: 'pragma solidity >=0.6.0 <0.8.0; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; contract test13 {}' } 'Untitled9.sol': { content: 'pragma solidity >=0.6.0 <0.8.0; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; contract test13 {}' }
} }
] ]
...@@ -20,7 +20,7 @@ module.exports = { ...@@ -20,7 +20,7 @@ module.exports = {
'Use special functions receive/fallback - both are declared, sending data': function (browser: NightwatchBrowser) { 'Use special functions receive/fallback - both are declared, sending data': function (browser: NightwatchBrowser) {
browser.waitForElementVisible('#icon-panel', 10000) browser.waitForElementVisible('#icon-panel', 10000)
.testContracts('receiveAndFallback.sol', sources[0]['browser/receiveAndFallback.sol'], ['CheckSpecials']) // compile .testContracts('receiveAndFallback.sol', sources[0]['receiveAndFallback.sol'], ['CheckSpecials']) // compile
.clickLaunchIcon('udapp') .clickLaunchIcon('udapp')
.selectAccount('0xCA35b7d915458EF540aDe6068dFe2F44E8fa733c') // this account will be used for this test suite .selectAccount('0xCA35b7d915458EF540aDe6068dFe2F44E8fa733c') // this account will be used for this test suite
.selectContract('CheckSpecials') .selectContract('CheckSpecials')
...@@ -89,7 +89,7 @@ module.exports = { ...@@ -89,7 +89,7 @@ module.exports = {
}, },
'Use special functions receive/fallback - only receive is declared, sending wei': function (browser: NightwatchBrowser) { 'Use special functions receive/fallback - only receive is declared, sending wei': function (browser: NightwatchBrowser) {
browser.waitForElementVisible('#icon-panel', 10000) browser.waitForElementVisible('#icon-panel', 10000)
.testContracts('receiveOnly.sol', sources[1]['browser/receiveOnly.sol'], ['CheckSpecials']) .testContracts('receiveOnly.sol', sources[1]['receiveOnly.sol'], ['CheckSpecials'])
.clickLaunchIcon('udapp') .clickLaunchIcon('udapp')
.selectContract('CheckSpecials') .selectContract('CheckSpecials')
.createContract('') .createContract('')
...@@ -119,7 +119,7 @@ module.exports = { ...@@ -119,7 +119,7 @@ module.exports = {
}, },
'Use special functions receive/fallback - only fallback declared and is payable, sending wei': function (browser: NightwatchBrowser) { 'Use special functions receive/fallback - only fallback declared and is payable, sending wei': function (browser: NightwatchBrowser) {
browser.waitForElementVisible('#icon-panel', 10000) browser.waitForElementVisible('#icon-panel', 10000)
.testContracts('fallbackOnlyPayable.sol', sources[2]['browser/fallbackOnlyPayable.sol'], ['CheckSpecials']) .testContracts('fallbackOnlyPayable.sol', sources[2]['fallbackOnlyPayable.sol'], ['CheckSpecials'])
.clickLaunchIcon('udapp') .clickLaunchIcon('udapp')
.selectContract('CheckSpecials') .selectContract('CheckSpecials')
.createContract('') .createContract('')
...@@ -150,7 +150,7 @@ module.exports = { ...@@ -150,7 +150,7 @@ module.exports = {
}, },
'Use special functions receive/fallback - only fallback is declared, fallback should fail cause not payable, sending wei': function (browser: NightwatchBrowser) { 'Use special functions receive/fallback - only fallback is declared, fallback should fail cause not payable, sending wei': function (browser: NightwatchBrowser) {
browser.waitForElementVisible('#icon-panel', 10000) browser.waitForElementVisible('#icon-panel', 10000)
.testContracts('fallbackOnlyNotPayable.sol', sources[3]['browser/fallbackOnlyNotPayable.sol'], ['CheckSpecials']) .testContracts('fallbackOnlyNotPayable.sol', sources[3]['fallbackOnlyNotPayable.sol'], ['CheckSpecials'])
.clickLaunchIcon('udapp') .clickLaunchIcon('udapp')
.selectContract('CheckSpecials') .selectContract('CheckSpecials')
.createContract('') .createContract('')
...@@ -167,7 +167,7 @@ module.exports = { ...@@ -167,7 +167,7 @@ module.exports = {
}, },
'Use special functions receive/fallback - receive and fallback are declared, sending data and wei': function (browser: NightwatchBrowser) { 'Use special functions receive/fallback - receive and fallback are declared, sending data and wei': function (browser: NightwatchBrowser) {
browser.waitForElementVisible('#icon-panel', 10000) browser.waitForElementVisible('#icon-panel', 10000)
.testContracts('receiveAndFallbackBothPayable.sol', sources[4]['browser/receiveAndFallbackBothPayable.sol'], ['CheckSpecials']) .testContracts('receiveAndFallbackBothPayable.sol', sources[4]['receiveAndFallbackBothPayable.sol'], ['CheckSpecials'])
.clickLaunchIcon('udapp') .clickLaunchIcon('udapp')
.selectContract('CheckSpecials') .selectContract('CheckSpecials')
.waitForElementVisible('#value') .waitForElementVisible('#value')
...@@ -201,7 +201,7 @@ module.exports = { ...@@ -201,7 +201,7 @@ module.exports = {
}, },
'Use special functions receive/fallback - receive and fallback are not declared, sending nothing': function (browser: NightwatchBrowser) { 'Use special functions receive/fallback - receive and fallback are not declared, sending nothing': function (browser: NightwatchBrowser) {
browser.waitForElementVisible('#icon-panel', 10000) browser.waitForElementVisible('#icon-panel', 10000)
.testContracts('notSpecial.sol', sources[5]['browser/notSpecial.sol'], ['CheckSpecials']) .testContracts('notSpecial.sol', sources[5]['notSpecial.sol'], ['CheckSpecials'])
.clickLaunchIcon('udapp') .clickLaunchIcon('udapp')
.selectContract('CheckSpecials') .selectContract('CheckSpecials')
.waitForElementVisible('#value') .waitForElementVisible('#value')
...@@ -226,7 +226,7 @@ module.exports = { ...@@ -226,7 +226,7 @@ module.exports = {
const sources = [ const sources = [
{ {
'browser/receiveAndFallback.sol': { 'receiveAndFallback.sol': {
content: ` content: `
contract CheckSpecials { contract CheckSpecials {
receive() payable external{} receive() payable external{}
...@@ -236,7 +236,7 @@ const sources = [ ...@@ -236,7 +236,7 @@ const sources = [
} }
}, },
{ {
'browser/receiveOnly.sol': { 'receiveOnly.sol': {
content: ` content: `
contract CheckSpecials { contract CheckSpecials {
receive() payable external {} receive() payable external {}
...@@ -245,7 +245,7 @@ const sources = [ ...@@ -245,7 +245,7 @@ const sources = [
} }
}, },
{ {
'browser/fallbackOnlyPayable.sol': { 'fallbackOnlyPayable.sol': {
content: ` content: `
contract CheckSpecials { contract CheckSpecials {
fallback() payable external {} fallback() payable external {}
...@@ -254,7 +254,7 @@ const sources = [ ...@@ -254,7 +254,7 @@ const sources = [
} }
}, },
{ {
'browser/fallbackOnlyNotPayable.sol': { 'fallbackOnlyNotPayable.sol': {
content: ` content: `
contract CheckSpecials { contract CheckSpecials {
fallback() external {} fallback() external {}
...@@ -263,7 +263,7 @@ const sources = [ ...@@ -263,7 +263,7 @@ const sources = [
} }
}, },
{ {
'browser/receiveAndFallbackBothPayable.sol': { 'receiveAndFallbackBothPayable.sol': {
content: ` content: `
contract CheckSpecials { contract CheckSpecials {
receive() payable external {} receive() payable external {}
...@@ -273,7 +273,7 @@ const sources = [ ...@@ -273,7 +273,7 @@ const sources = [
} }
}, },
{ {
'browser/notSpecial.sol': { 'notSpecial.sol': {
content: ` content: `
contract CheckSpecials { contract CheckSpecials {
function otherFallback() payable external {} function otherFallback() payable external {}
......
...@@ -5,7 +5,7 @@ import sauce from './sauce' ...@@ -5,7 +5,7 @@ import sauce from './sauce'
const sources = [ const sources = [
{ {
'browser/Untitled.sol': { 'Untitled.sol': {
content: ` content: `
pragma solidity >=0.6.0 <0.8.0; pragma solidity >=0.6.0 <0.8.0;
contract test1 { address test = tx.origin; } contract test1 { address test = tx.origin; }
...@@ -40,7 +40,7 @@ function runTests (browser: NightwatchBrowser) { ...@@ -40,7 +40,7 @@ function runTests (browser: NightwatchBrowser) {
.waitForElementVisible('#icon-panel', 10000) .waitForElementVisible('#icon-panel', 10000)
.clickLaunchIcon('solidity') .clickLaunchIcon('solidity')
.pause(10000) .pause(10000)
.testContracts('Untitled.sol', sources[0]['browser/Untitled.sol'], ['TooMuchGas', 'test1', 'test2']) .testContracts('Untitled.sol', sources[0]['Untitled.sol'], ['TooMuchGas', 'test1', 'test2'])
.clickLaunchIcon('solidityStaticAnalysis') .clickLaunchIcon('solidityStaticAnalysis')
.click('#staticanalysisView button') .click('#staticanalysisView button')
.waitForElementPresent('#staticanalysisresult .warning', 2000, true, function () { .waitForElementPresent('#staticanalysisresult .warning', 2000, true, function () {
......
...@@ -45,8 +45,8 @@ module.exports = { ...@@ -45,8 +45,8 @@ module.exports = {
'Async/Await Script': function (browser: NightwatchBrowser) { 'Async/Await Script': function (browser: NightwatchBrowser) {
browser browser
.addFile('asyncAwait.js', { content: asyncAwait }) .addFile('asyncAwait.js', { content: asyncAwait })
.openFile('browser/asyncAwait.js') .openFile('asyncAwait.js')
.executeScript('remix.execute(\'browser/asyncAwait.js\')') .executeScript('remix.execute(\'asyncAwait.js\')')
.journalLastChild('Waiting Promise') .journalLastChild('Waiting Promise')
.pause(5500) .pause(5500)
.journalLastChild('result - Promise Resolved') .journalLastChild('result - Promise Resolved')
...@@ -55,9 +55,9 @@ module.exports = { ...@@ -55,9 +55,9 @@ module.exports = {
'Call Remix File Manager from a script': function (browser: NightwatchBrowser) { 'Call Remix File Manager from a script': function (browser: NightwatchBrowser) {
browser browser
.addFile('asyncAwaitWithFileManagerAccess.js', { content: asyncAwaitWithFileManagerAccess }) .addFile('asyncAwaitWithFileManagerAccess.js', { content: asyncAwaitWithFileManagerAccess })
.openFile('browser/asyncAwaitWithFileManagerAccess.js') .openFile('asyncAwaitWithFileManagerAccess.js')
.pause(5000) .pause(5000)
.executeScript('remix.execute(\'browser/asyncAwaitWithFileManagerAccess.js\')') .executeScript('remix.execute(\'asyncAwaitWithFileManagerAccess.js\')')
.pause(6000) .pause(6000)
.journalLastChildIncludes('contract Ballot {') .journalLastChildIncludes('contract Ballot {')
}, },
...@@ -86,21 +86,21 @@ module.exports = { ...@@ -86,21 +86,21 @@ module.exports = {
browser browser
.click('*[data-id="terminalClearConsole"]') // clear the terminal .click('*[data-id="terminalClearConsole"]') // clear the terminal
.addFile('resolveExternalUrlAndSave.js', { content: resolveExternalUrlAndSave }) .addFile('resolveExternalUrlAndSave.js', { content: resolveExternalUrlAndSave })
.openFile('browser/resolveExternalUrlAndSave.js') .openFile('resolveExternalUrlAndSave.js')
.pause(1000) .pause(1000)
.executeScript('remix.execute(\'browser/resolveExternalUrlAndSave.js\')') .executeScript('remix.execute(\'resolveExternalUrlAndSave.js\')')
.pause(6000) .pause(6000)
.journalLastChildIncludes('Implementation of the {IERC20} interface.') .journalLastChildIncludes('Implementation of the {IERC20} interface.')
.openFile('browser/github/OpenZeppelin/openzeppelin-contracts/contracts/token/ERC20/ERC20.sol') .openFile('github/OpenZeppelin/openzeppelin-contracts/contracts/token/ERC20/ERC20.sol')
}, },
'Call Remix File Resolver (internal URL) from a script': function (browser: NightwatchBrowser) { 'Call Remix File Resolver (internal URL) from a script': function (browser: NightwatchBrowser) {
browser browser
.click('*[data-id="terminalClearConsole"]') // clear the terminal .click('*[data-id="terminalClearConsole"]') // clear the terminal
.addFile('resolveUrl.js', { content: resolveUrl }) .addFile('resolveUrl.js', { content: resolveUrl })
.openFile('browser/resolveUrl.js') .openFile('resolveUrl.js')
.pause(1000) .pause(1000)
.executeScript('remix.execute(\'browser/resolveUrl.js\')') .executeScript('remix.execute(\'resolveUrl.js\')')
.pause(6000) .pause(6000)
.journalLastChildIncludes('contract Ballot {') .journalLastChildIncludes('contract Ballot {')
}, },
...@@ -109,12 +109,12 @@ module.exports = { ...@@ -109,12 +109,12 @@ module.exports = {
browser browser
.click('*[data-id="terminalClearConsole"]') // clear the terminal .click('*[data-id="terminalClearConsole"]') // clear the terminal
.addFile('resolveExternalUrlAndSaveToaPath.js', { content: resolveExternalUrlAndSaveToaPath }) .addFile('resolveExternalUrlAndSaveToaPath.js', { content: resolveExternalUrlAndSaveToaPath })
.openFile('browser/resolveExternalUrlAndSaveToaPath.js') .openFile('resolveExternalUrlAndSaveToaPath.js')
.pause(1000) .pause(1000)
.executeScript('remix.execute(\'browser/resolveExternalUrlAndSaveToaPath.js\')') .executeScript('remix.execute(\'resolveExternalUrlAndSaveToaPath.js\')')
.pause(6000) .pause(6000)
.journalLastChildIncludes('abstract contract ERC20Burnable') .journalLastChildIncludes('abstract contract ERC20Burnable')
.openFile('browser/github/newFile.sol') .openFile('github/newFile.sol')
.end() .end()
}, },
...@@ -151,7 +151,7 @@ const asyncAwaitWithFileManagerAccess = ` ...@@ -151,7 +151,7 @@ const asyncAwaitWithFileManagerAccess = `
var run = async () => { var run = async () => {
console.log('Waiting Promise') console.log('Waiting Promise')
var result = await p() var result = await p()
let text = await remix.call('fileManager', 'readFile', 'browser/contracts/3_Ballot.sol') let text = await remix.call('fileManager', 'readFile', 'contracts/3_Ballot.sol')
console.log('result - ', text) console.log('result - ', text)
} }
...@@ -184,7 +184,7 @@ const resolveUrl = ` ...@@ -184,7 +184,7 @@ const resolveUrl = `
(async () => { (async () => {
try { try {
console.log('start') console.log('start')
console.log(await remix.call('contentImport', 'resolveAndSave', 'browser/contracts/3_Ballot.sol')) console.log(await remix.call('contentImport', 'resolveAndSave', 'contracts/3_Ballot.sol'))
} catch (e) { } catch (e) {
console.log(e.message) console.log(e.message)
} }
......
...@@ -12,7 +12,7 @@ module.exports = { ...@@ -12,7 +12,7 @@ module.exports = {
}, },
'Execute Simple Contract and Test Terminal': function (browser: NightwatchBrowser) { 'Execute Simple Contract and Test Terminal': function (browser: NightwatchBrowser) {
browser.testContracts('Untitled.sol', sources[0]['browser/Untitled.sol'], ['TestContract']) browser.testContracts('Untitled.sol', sources[0]['Untitled.sol'], ['TestContract'])
.clickLaunchIcon('udapp') .clickLaunchIcon('udapp')
.selectAccount('0xCA35b7d915458EF540aDe6068dFe2F44E8fa733c') // this account will be used for this test suite .selectAccount('0xCA35b7d915458EF540aDe6068dFe2F44E8fa733c') // this account will be used for this test suite
.click('#runTabView button[class^="instanceButton"]') .click('#runTabView button[class^="instanceButton"]')
...@@ -21,19 +21,17 @@ module.exports = { ...@@ -21,19 +21,17 @@ module.exports = {
.click('#runTabView .instance div[class^="title"]') .click('#runTabView .instance div[class^="title"]')
.click('#runTabView .instance div[class^="title"]') .click('#runTabView .instance div[class^="title"]')
.clickFunction('f - transact (not payable)') .clickFunction('f - transact (not payable)')
.testFunction('0x38bb944fa4709ed9e163d6c670259f97284b4defd916d512a2fcc3f35bb53e03', .testFunction('last',
{ {
status: 'true Transaction mined and execution succeed', status: 'true Transaction mined and execution succeed',
'transaction hash': '0x38bb944fa4709ed9e163d6c670259f97284b4defd916d512a2fcc3f35bb53e03',
'decoded output': { 0: 'uint256: 8' } 'decoded output': { 0: 'uint256: 8' }
}) })
.pause(500) .pause(500)
.checkTerminalFilter('0x12332162e2e31397dc1e07ed0a1cf08f728e9b4487c6f9ed79d2f39410c92782', '') .checkTerminalFilter('0x12332162e2e31397dc1e07ed0a1cf08f728e9b4487c6f9ed79d2f39410c92782', '')
.clickFunction('g - transact (not payable)') .clickFunction('g - transact (not payable)')
.testFunction('0xab4f794ca0b531f27fc6eace623666b440facbf20e77615a057d728c67b500f0', .testFunction('last',
{ {
status: 'true Transaction mined and execution succeed', status: 'true Transaction mined and execution succeed',
'transaction hash': '0xab4f794ca0b531f27fc6eace623666b440facbf20e77615a057d728c67b500f0',
'decoded output': { 'decoded output': {
0: 'uint256: 345', 0: 'uint256: 345',
1: 'string: comment_comment_', 1: 'string: comment_comment_',
...@@ -45,16 +43,15 @@ module.exports = { ...@@ -45,16 +43,15 @@ module.exports = {
}, },
'Test Complex Return Values': function (browser: NightwatchBrowser) { 'Test Complex Return Values': function (browser: NightwatchBrowser) {
browser.testContracts('returnValues.sol', sources[1]['browser/returnValues.sol'], ['testReturnValues']) browser.testContracts('returnValues.sol', sources[1]['returnValues.sol'], ['testReturnValues'])
.clickLaunchIcon('udapp') .clickLaunchIcon('udapp')
.click('#runTabView button[class^="instanceButton"]') .click('#runTabView button[class^="instanceButton"]')
.waitForElementPresent('.instance:nth-of-type(2)') .waitForElementPresent('.instance:nth-of-type(2)')
.click('.instance:nth-of-type(2) > div > button') .click('.instance:nth-of-type(2) > div > button')
.clickFunction('retunValues1 - transact (not payable)') .clickFunction('retunValues1 - transact (not payable)')
.testFunction('0x09c6716a67f0f8c7a0ca2b3ddf59c25982da856a95aefd640b767f9b9feee39d', .testFunction('last',
{ {
status: 'true Transaction mined and execution succeed', status: 'true Transaction mined and execution succeed',
'transaction hash': '0x09c6716a67f0f8c7a0ca2b3ddf59c25982da856a95aefd640b767f9b9feee39d',
'decoded output': { 'decoded output': {
0: 'bool: _b true', 0: 'bool: _b true',
1: 'uint256: _u 345', 1: 'uint256: _u 345',
...@@ -63,10 +60,9 @@ module.exports = { ...@@ -63,10 +60,9 @@ module.exports = {
} }
}) })
.clickFunction('retunValues2 - transact (not payable)') .clickFunction('retunValues2 - transact (not payable)')
.testFunction('0xe884953e0695399d60914af3e1ea2dad59fe41f3c0c20665c130fa40dd0fb6bf', .testFunction('last',
{ {
status: 'true Transaction mined and execution succeed', status: 'true Transaction mined and execution succeed',
'transaction hash': '0xe884953e0695399d60914af3e1ea2dad59fe41f3c0c20665c130fa40dd0fb6bf',
'decoded output': { 'decoded output': {
0: 'bytes1: _b 0x12', 0: 'bytes1: _b 0x12',
1: 'bytes2: _b2 0x1223', 1: 'bytes2: _b2 0x1223',
...@@ -81,10 +77,9 @@ module.exports = { ...@@ -81,10 +77,9 @@ module.exports = {
} }
}).pause(500) }).pause(500)
.clickFunction('retunValues3 - transact (not payable)') .clickFunction('retunValues3 - transact (not payable)')
.testFunction('0xb4108649d5e65a4a0776d6ac98c2c356540a7e99d641705a82352a845d467eb5', .testFunction('last',
{ {
status: 'true Transaction mined and execution succeed', status: 'true Transaction mined and execution succeed',
'transaction hash': '0xb4108649d5e65a4a0776d6ac98c2c356540a7e99d641705a82352a845d467eb5',
'decoded output': { 'decoded output': {
0: 'uint8: _en 2', 0: 'uint8: _en 2',
1: 'int256[5][]: _a1 1,-45,-78,56,60,-1,42,334,-45455,-446,1,10,-5435,45,-7' 1: 'int256[5][]: _a1 1,-45,-78,56,60,-1,42,334,-45455,-446,1,10,-5435,45,-7'
...@@ -93,16 +88,15 @@ module.exports = { ...@@ -93,16 +88,15 @@ module.exports = {
}, },
'Test Complex Input Values': function (browser: NightwatchBrowser) { 'Test Complex Input Values': function (browser: NightwatchBrowser) {
browser.testContracts('inputValues.sol', sources[2]['browser/inputValues.sol'], ['test']) browser.testContracts('inputValues.sol', sources[2]['inputValues.sol'], ['test'])
.clickLaunchIcon('udapp') .clickLaunchIcon('udapp')
.click('#runTabView button[class^="instanceButton"]') .click('#runTabView button[class^="instanceButton"]')
.waitForElementPresent('.instance:nth-of-type(2)') .waitForElementPresent('.instance:nth-of-type(2)')
.click('.instance:nth-of-type(2) > div > button') .click('.instance:nth-of-type(2) > div > button')
.clickFunction('inputValue1 - transact (not payable)', { types: 'uint256 _u, int256 _i, string _str', values: '"2343242", "-4324324", "string _ string _ string _ string _ string _ string _ string _ string _ string _ string _"' }) .clickFunction('inputValue1 - transact (not payable)', { types: 'uint256 _u, int256 _i, string _str', values: '"2343242", "-4324324", "string _ string _ string _ string _ string _ string _ string _ string _ string _ string _"' })
.testFunction('0xe9678b5486674a0425301a1d7e925c22cfb9f7f7ec6242697d742009f7ef5b97', .testFunction('last',
{ {
status: 'true Transaction mined and execution succeed', status: 'true Transaction mined and execution succeed',
'transaction hash': '0xe9678b5486674a0425301a1d7e925c22cfb9f7f7ec6242697d742009f7ef5b97',
'decoded output': { 'decoded output': {
0: 'uint256: _uret 2343242', 0: 'uint256: _uret 2343242',
1: 'int256: _iret -4324324', 1: 'int256: _iret -4324324',
...@@ -111,9 +105,8 @@ module.exports = { ...@@ -111,9 +105,8 @@ module.exports = {
}) })
.pause(500) .pause(500)
.clickFunction('inputValue2 - transact (not payable)', { types: 'uint256[3] _n, bytes8[4] _b8', values: '[1,2,3], ["0x1234000000000000", "0x1234000000000000","0x1234000000000000","0x1234000000000000"]' }) .clickFunction('inputValue2 - transact (not payable)', { types: 'uint256[3] _n, bytes8[4] _b8', values: '[1,2,3], ["0x1234000000000000", "0x1234000000000000","0x1234000000000000","0x1234000000000000"]' })
.testFunction('0x21724b08c3699bda8375803f8dc842194aea370f2aac284e55144b452dca321f', { .testFunction('last', {
status: 'true Transaction mined and execution succeed', status: 'true Transaction mined and execution succeed',
'transaction hash': '0x21724b08c3699bda8375803f8dc842194aea370f2aac284e55144b452dca321f',
'decoded output': { 'decoded output': {
0: 'uint256[3]: _nret 1,2,3', 0: 'uint256[3]: _nret 1,2,3',
1: 'bytes8[4]: _b8ret 0x1234000000000000,0x1234000000000000,0x1234000000000000,0x1234000000000000' 1: 'bytes8[4]: _b8ret 0x1234000000000000,0x1234000000000000,0x1234000000000000,0x1234000000000000'
...@@ -140,7 +133,7 @@ module.exports = { ...@@ -140,7 +133,7 @@ module.exports = {
}, },
'Should Compile and Deploy a contract which has an event declaring a function as parameter': function (browser: NightwatchBrowser) { 'Should Compile and Deploy a contract which has an event declaring a function as parameter': function (browser: NightwatchBrowser) {
browser.testContracts('eventFunctionInput.sol', sources[3]['browser/eventFunctionInput.sol'], ['C']) browser.testContracts('eventFunctionInput.sol', sources[3]['eventFunctionInput.sol'], ['C'])
.clickLaunchIcon('udapp') .clickLaunchIcon('udapp')
.selectAccount('0xCA35b7d915458EF540aDe6068dFe2F44E8fa733c') // this account will be used for this test suite .selectAccount('0xCA35b7d915458EF540aDe6068dFe2F44E8fa733c') // this account will be used for this test suite
.click('#runTabView button[class^="instanceButton"]') .click('#runTabView button[class^="instanceButton"]')
...@@ -155,7 +148,7 @@ module.exports = { ...@@ -155,7 +148,7 @@ module.exports = {
const sources = [ const sources = [
{ {
'browser/Untitled.sol': { 'Untitled.sol': {
content: ` content: `
contract TestContract { function f() public returns (uint) { return 8; } contract TestContract { function f() public returns (uint) { return 8; }
function g() public returns (uint, string memory, bool, uint) { function g() public returns (uint, string memory, bool, uint) {
...@@ -167,7 +160,7 @@ const sources = [ ...@@ -167,7 +160,7 @@ const sources = [
} }
}, },
{ {
'browser/returnValues.sol': { 'returnValues.sol': {
content: ` content: `
contract testReturnValues { contract testReturnValues {
enum ActionChoices { GoLeft, GoRight, GoStraight, SitStill } enum ActionChoices { GoLeft, GoRight, GoStraight, SitStill }
...@@ -202,7 +195,7 @@ const sources = [ ...@@ -202,7 +195,7 @@ const sources = [
} }
}, },
{ {
'browser/inputValues.sol': { 'inputValues.sol': {
content: ` content: `
contract test { contract test {
event event1(int _i, uint indexed _u, string indexed _str, bytes4 _b, string _notIndexed); event event1(int _i, uint indexed _u, string indexed _str, bytes4 _b, string _notIndexed);
...@@ -221,7 +214,7 @@ const sources = [ ...@@ -221,7 +214,7 @@ const sources = [
}, },
// https://github.com/ethereum/remix-project/issues/404 // https://github.com/ethereum/remix-project/issues/404
{ {
'browser/eventFunctionInput.sol': { 'eventFunctionInput.sol': {
content: ` content: `
pragma solidity >= 0.7.0; pragma solidity >= 0.7.0;
contract C { contract C {
......
...@@ -5,8 +5,8 @@ import sauce from './sauce' ...@@ -5,8 +5,8 @@ import sauce from './sauce'
import examples from '../examples/example-contracts' import examples from '../examples/example-contracts'
const sources = [ const sources = [
{ 'browser/Untitled.sol': { content: examples.ballot.content } }, { 'Untitled.sol': { content: examples.ballot.content } },
{ 'browser/Untitled1.sol': { content: 'contract test {}' } } { 'Untitled1.sol': { content: 'contract test {}' } }
] ]
module.exports = { module.exports = {
...@@ -21,7 +21,7 @@ module.exports = { ...@@ -21,7 +21,7 @@ module.exports = {
browser browser
.waitForElementVisible('*[data-id="remixIdeIconPanel"]', 10000) .waitForElementVisible('*[data-id="remixIdeIconPanel"]', 10000)
.clickLaunchIcon('solidity') .clickLaunchIcon('solidity')
.testContracts('Untitled.sol', sources[0]['browser/Untitled.sol'], ['Ballot']) .testContracts('Untitled.sol', sources[0]['Untitled.sol'], ['Ballot'])
.clickLaunchIcon('udapp') .clickLaunchIcon('udapp')
.selectAccount('0xCA35b7d915458EF540aDe6068dFe2F44E8fa733c') .selectAccount('0xCA35b7d915458EF540aDe6068dFe2F44E8fa733c')
.setValue('input[placeholder="bytes32[] proposalNames"]', '["0x48656c6c6f20576f726c64210000000000000000000000000000000000000000"]') .setValue('input[placeholder="bytes32[] proposalNames"]', '["0x48656c6c6f20576f726c64210000000000000000000000000000000000000000"]')
...@@ -29,21 +29,19 @@ module.exports = { ...@@ -29,21 +29,19 @@ module.exports = {
.waitForElementPresent('*[data-id="universalDappUiContractActionWrapper"]') .waitForElementPresent('*[data-id="universalDappUiContractActionWrapper"]')
.click('*[data-id="universalDappUiTitleExpander"]') .click('*[data-id="universalDappUiTitleExpander"]')
.clickFunction('delegate - transact (not payable)', { types: 'address to', values: '"0x4b0897b0513fdc7c541b6d9d7e929c4e5364d2db"' }) .clickFunction('delegate - transact (not payable)', { types: 'address to', values: '"0x4b0897b0513fdc7c541b6d9d7e929c4e5364d2db"' })
.testFunction('0x41fab8ea5b1d9fba5e0a6545ca1a2d62fff518578802c033c2b9a031a01c31b3', .testFunction('last',
{ {
status: 'true Transaction mined and execution succeed', status: 'true Transaction mined and execution succeed',
'transaction hash': '0x41fab8ea5b1d9fba5e0a6545ca1a2d62fff518578802c033c2b9a031a01c31b3',
'decoded input': { 'address to': '0x4B0897b0513fdC7C541B6d9D7E929C4e5364D2dB' } 'decoded input': { 'address to': '0x4B0897b0513fdC7C541B6d9D7E929C4e5364D2dB' }
}) })
.clickLaunchIcon('solidity') .clickLaunchIcon('solidity')
.testContracts('Untitled1.sol', sources[1]['browser/Untitled1.sol'], ['test']) .testContracts('Untitled1.sol', sources[1]['Untitled1.sol'], ['test'])
.clickLaunchIcon('udapp') .clickLaunchIcon('udapp')
.clickFunction('delegate - transact (not payable)', { types: 'address to', values: '' }) .clickFunction('delegate - transact (not payable)', { types: 'address to', values: '' })
.pause(5000) .pause(5000)
.testFunction('0xca58080c8099429caeeffe43b8104df919c2c543dceb9edf9242fa55f045c803', .testFunction('last',
{ {
status: 'false Transaction mined but execution failed', status: 'false Transaction mined but execution failed',
'transaction hash': '0xca58080c8099429caeeffe43b8104df919c2c543dceb9edf9242fa55f045c803',
'decoded input': { 'address to': '0x4B0897b0513fdC7C541B6d9D7E929C4e5364D2dB' } 'decoded input': { 'address to': '0x4B0897b0513fdC7C541B6d9D7E929C4e5364D2dB' }
}) })
.end() .end()
......
...@@ -6,7 +6,7 @@ import sauce from './sauce' ...@@ -6,7 +6,7 @@ import sauce from './sauce'
import examples from '../examples/example-contracts' import examples from '../examples/example-contracts'
const sources = [ const sources = [
{ 'browser/Untitled.sol': { content: examples.ballot.content } } { 'Untitled.sol': { content: examples.ballot.content } }
] ]
module.exports = { module.exports = {
......
...@@ -5,7 +5,7 @@ import sauce from './sauce' ...@@ -5,7 +5,7 @@ import sauce from './sauce'
const sources = [ const sources = [
{ {
'browser/basic.sol': { 'basic.sol': {
content: content:
`pragma solidity >=0.2.0 <0.7.0; `pragma solidity >=0.2.0 <0.7.0;
...@@ -31,7 +31,7 @@ module.exports = { ...@@ -31,7 +31,7 @@ module.exports = {
browser browser
.waitForElementVisible('*[data-id="remixIdeIconPanel"]', 10000) .waitForElementVisible('*[data-id="remixIdeIconPanel"]', 10000)
.clickLaunchIcon('fileExplorers') .clickLaunchIcon('fileExplorers')
.addFile('basic.sol', sources[0]['browser/basic.sol']) .addFile('basic.sol', sources[0]['basic.sol'])
.clickLaunchIcon('solidity') .clickLaunchIcon('solidity')
.execute(function () { .execute(function () {
const elem = document.getElementById('nightlies') as HTMLInputElement const elem = document.getElementById('nightlies') as HTMLInputElement
......
...@@ -26,6 +26,30 @@ module.exports = { ...@@ -26,6 +26,30 @@ module.exports = {
'Home page should be deactivated': function (browser: NightwatchBrowser) { 'Home page should be deactivated': function (browser: NightwatchBrowser) {
browser browser
.waitForElementNotPresent('[data-id="landingPageHomeContainer"]') .waitForElementNotPresent('[data-id="landingPageHomeContainer"]')
},
'Should create two workspace and switch to the first one': function (browser: NightwatchBrowser) {
browser
.clickLaunchIcon('fileExplorers')
.click('*[data-id="workspaceCreate"]') // create workspace_name
.waitForElementVisible('*[data-id="modalDialogCustomPromptText"]')
.clearValue('*[data-id="modalDialogCustomPromptText"]')
.setValue('*[data-id="modalDialogCustomPromptText"]', 'workspace_name')
.modalFooterOKClick()
.click('*[data-path="workspace_name"]')
.waitForElementVisible('*[data-id="treeViewLitreeViewItemtests"]')
.addFile('test.sol', { content: 'test' })
.waitForElementVisible('*[data-id="treeViewLitreeViewItemtest.sol"]')
.click('*[data-id="workspaceCreate"]') // create workspace_name_1
.waitForElementVisible('*[data-id="modalDialogCustomPromptText"]')
.clearValue('*[data-id="modalDialogCustomPromptText"]')
.setValue('*[data-id="modalDialogCustomPromptText"]', 'workspace_name_1')
.modalFooterOKClick()
.click('*[data-path="workspace_name_1"]')
.waitForElementVisible('*[data-id="treeViewLitreeViewItemtests"]')
.waitForElementNotPresent('*[data-id="treeViewLitreeViewItemtest.sol"]')
.click('*[data-id="workspacesSelect"] option[value="workspace_name"]')
.waitForElementVisible('*[data-id="treeViewLitreeViewItemtests"]')
.end() .end()
}, },
......
...@@ -55,6 +55,7 @@ declare module "nightwatch" { ...@@ -55,6 +55,7 @@ declare module "nightwatch" {
validateValueInput(selector: string, valueTosSet: string, expectedValue: string): NightwatchBrowser validateValueInput(selector: string, valueTosSet: string, expectedValue: string): NightwatchBrowser
checkAnnotations(type: string, line: number): NightwatchBrowser checkAnnotations(type: string, line: number): NightwatchBrowser
checkAnnotationsNotPresent(type: string): NightwatchBrowser checkAnnotationsNotPresent(type: string): NightwatchBrowser
getLastTransactionHash(callback: (hash: string) => void)
} }
export interface NightwatchBrowser { export interface NightwatchBrowser {
......
...@@ -140,6 +140,7 @@ export class Debugger { ...@@ -140,6 +140,7 @@ export class Debugger {
this.step_manager = new DebuggerStepManager(this.debugger, this.debugger.traceManager) this.step_manager = new DebuggerStepManager(this.debugger, this.debugger.traceManager)
this.debugger.codeManager.event.register('changed', this, (code, address, instIndex) => { this.debugger.codeManager.event.register('changed', this, (code, address, instIndex) => {
if (!this.debugger.solidityProxy.contracts) return
this.debugger.callTree.sourceLocationTracker.getValidSourceLocationFromVMTraceIndex(address, this.step_manager.currentStepIndex, this.debugger.solidityProxy.contracts).then((sourceLocation) => { this.debugger.callTree.sourceLocationTracker.getValidSourceLocationFromVMTraceIndex(address, this.step_manager.currentStepIndex, this.debugger.solidityProxy.contracts).then((sourceLocation) => {
this.vmDebuggerLogic.event.trigger('sourceLocationChanged', [sourceLocation]) this.vmDebuggerLogic.event.trigger('sourceLocationChanged', [sourceLocation])
}) })
......
...@@ -187,7 +187,7 @@ export const DebuggerUI = (props: DebuggerUIProps) => { ...@@ -187,7 +187,7 @@ export const DebuggerUI = (props: DebuggerUIProps) => {
const ret = await debuggerModule.fetchContractAndCompile(address, currentReceipt) const ret = await debuggerModule.fetchContractAndCompile(address, currentReceipt)
return ret return ret
} catch (e) { } catch (e) {
debuggerModule.showMessage('Debugging error', 'Unable to fetch a transaction.') // debuggerModule.showMessage('Debugging error', 'Unable to fetch a transaction.')
console.error(e) console.error(e)
} }
return null return null
......
...@@ -25,6 +25,7 @@ export const FileExplorer = (props: FileExplorerProps) => { ...@@ -25,6 +25,7 @@ export const FileExplorer = (props: FileExplorerProps) => {
focusPath: null, focusPath: null,
files: [], files: [],
fileManager: null, fileManager: null,
filesProvider,
ctrlKey: false, ctrlKey: false,
newFileName: '', newFileName: '',
actions: [], actions: [],
...@@ -122,7 +123,7 @@ export const FileExplorer = (props: FileExplorerProps) => { ...@@ -122,7 +123,7 @@ export const FileExplorer = (props: FileExplorerProps) => {
return { ...prevState, fileManager, files, actions } return { ...prevState, fileManager, files, actions }
}) })
})() })()
}, []) }, [name])
useEffect(() => { useEffect(() => {
if (state.fileManager) { if (state.fileManager) {
...@@ -219,7 +220,7 @@ export const FileExplorer = (props: FileExplorerProps) => { ...@@ -219,7 +220,7 @@ export const FileExplorer = (props: FileExplorerProps) => {
}, [state.modals]) }, [state.modals])
const resolveDirectory = async (folderPath, dir: File[], isChild = false): Promise<File[]> => { const resolveDirectory = async (folderPath, dir: File[], isChild = false): Promise<File[]> => {
if (!isChild && (state.focusEdit.element === `${name}/blank`) && state.focusEdit.isNew && (dir.findIndex(({ path }) => path === `${name}/blank`) === -1)) { if (!isChild && (state.focusEdit.element === '/blank') && state.focusEdit.isNew && (dir.findIndex(({ path }) => path === '/blank') === -1)) {
dir = state.focusEdit.type === 'file' ? [...dir, { dir = state.focusEdit.type === 'file' ? [...dir, {
path: state.focusEdit.element, path: state.focusEdit.element,
name: '', name: '',
...@@ -261,20 +262,21 @@ export const FileExplorer = (props: FileExplorerProps) => { ...@@ -261,20 +262,21 @@ export const FileExplorer = (props: FileExplorerProps) => {
return new Promise((resolve) => { return new Promise((resolve) => {
filesProvider.resolveDirectory(folderPath, (error, fileTree) => { filesProvider.resolveDirectory(folderPath, (error, fileTree) => {
if (error) console.error(error) if (error) console.error(error)
const files = normalize(folderPath, fileTree) const files = normalize(fileTree)
resolve(files) resolve(files)
}) })
}) })
} }
const normalize = (path, filesList): File[] => { const normalize = (filesList): File[] => {
const folders = [] const folders = []
const files = [] const files = []
const prefix = path.split('/')[0]
Object.keys(filesList || {}).forEach(key => { Object.keys(filesList || {}).forEach(key => {
const path = prefix + '/' + key key = key.replace(/^\/|\/$/g, '') // remove first and last slash
let path = key
path = path.replace(/^\/|\/$/g, '') // remove first and last slash
if (filesList[key].isDirectory) { if (filesList[key].isDirectory) {
folders.push({ folders.push({
...@@ -533,7 +535,7 @@ export const FileExplorer = (props: FileExplorerProps) => { ...@@ -533,7 +535,7 @@ export const FileExplorer = (props: FileExplorerProps) => {
} }
fileReader.readAsText(file) fileReader.readAsText(file)
} }
const name = filesProvider.type + '/' + file.name const name = file.name
filesProvider.exists(name, (error, exist) => { filesProvider.exists(name, (error, exist) => {
if (error) console.log(error) if (error) console.log(error)
...@@ -607,7 +609,7 @@ export const FileExplorer = (props: FileExplorerProps) => { ...@@ -607,7 +609,7 @@ export const FileExplorer = (props: FileExplorerProps) => {
} }
// If 'id' is not defined, it is not a gist update but a creation so we have to take the files from the browser explorer. // If 'id' is not defined, it is not a gist update but a creation so we have to take the files from the browser explorer.
const folder = id ? 'browser/gists/' + id : 'browser/' const folder = id ? '/gists/' + id : '/'
packageFiles(filesProvider, folder, async (error, packaged) => { packageFiles(filesProvider, folder, async (error, packaged) => {
if (error) { if (error) {
...@@ -809,7 +811,7 @@ export const FileExplorer = (props: FileExplorerProps) => { ...@@ -809,7 +811,7 @@ export const FileExplorer = (props: FileExplorerProps) => {
}, null) }, null)
} else { } else {
if (state.focusEdit.isNew) { if (state.focusEdit.isNew) {
state.focusEdit.type === 'file' ? createNewFile(parentFolder + '/' + content) : createNewFolder(parentFolder + '/' + content) state.focusEdit.type === 'file' ? createNewFile(joinPath(parentFolder, content)) : createNewFolder(joinPath(parentFolder, content))
const files = removePath(state.focusEdit.element, state.files) const files = removePath(state.focusEdit.element, state.files)
const updatedFiles = files.filter(file => file) const updatedFiles = files.filter(file => file)
...@@ -1100,3 +1102,9 @@ function packageFiles (filesProvider, directory, callback) { ...@@ -1100,3 +1102,9 @@ function packageFiles (filesProvider, directory, callback) {
} }
}) })
} }
function joinPath (...paths) {
paths = paths.filter((value) => value !== '').map((path) => path.replace(/^\/|\/$/g, '')) // remove first and last slash)
if (paths.length === 1) return paths[0]
return paths.join('/')
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment