changed nightwatch switchFile command to openFile

pull/4/head
ioedeveloper 5 years ago
parent 10bb3a7fea
commit 2cf7ed5098
  1. 18
      src/app/files/fileManager.js
  2. 8
      test-browser/commands/openFile.js
  3. 2
      test-browser/tests/defaultLayout.test.js
  4. 12
      test-browser/tests/editor.test.js
  5. 6
      test-browser/tests/generalSettings.test.js
  6. 10
      test-browser/tests/gist.test.js
  7. 8
      test-browser/tests/libraryDeployment.test.js
  8. 2
      test-browser/tests/pluginManager.test.js
  9. 6
      test-browser/tests/publishContract.test.js
  10. 4
      test-browser/tests/runAndDeploy.js
  11. 2
      test-browser/tests/signingMessage.test.js
  12. 2
      test-browser/tests/solidityImport.test.js
  13. 10
      test-browser/tests/solidityUnittests.test.js
  14. 4
      test-browser/tests/terminal.test.js

@ -143,7 +143,7 @@ class FileManager extends Plugin {
async open (path) {
await this._handleExists(path, `Cannot open file ${path}`)
await this._handleIsFile(path, `Cannot open file ${path}`)
return this.switchFile(path)
return this.openFile(path)
}
/**
@ -274,7 +274,7 @@ class FileManager extends Plugin {
delete this.openedFiles[oldName]
this.openedFiles[newName] = newName
}
this.switchFile(newName)
this.openFile(newName)
} else {
var newFocus
for (var k in this.openedFiles) {
@ -288,7 +288,7 @@ class FileManager extends Plugin {
}
}
if (newFocus) {
this.switchFile(newFocus)
this.openFile(newFocus)
}
}
// TODO: Only keep `this.emit` (issue#2210)
@ -390,7 +390,7 @@ class FileManager extends Plugin {
copyName = path + '.' + this.currentRequest.from
}
this._setFileInternal(copyName, content)
this.switchFile(copyName)
this.openFile(copyName)
})
}
}
@ -413,7 +413,7 @@ class FileManager extends Plugin {
// TODO: Only keep `this.emit` (issue#2210)
this.emit('fileRemoved', path)
this.events.emit('fileRemoved', path)
this.switchFile()
this.openFile()
}
unselectCurrentFile () {
@ -424,8 +424,8 @@ class FileManager extends Plugin {
this.events.emit('noFileSelected')
}
switchFile (file) {
const _switchFile = (file) => {
openFile (file) {
const _openFile = (file) => {
this.saveCurrentFile()
this._deps.config.set('currentFile', file)
this.openedFiles[file] = file
@ -444,14 +444,14 @@ class FileManager extends Plugin {
}
})
}
if (file) return _switchFile(file)
if (file) return _openFile(file)
else {
var browserProvider = this._deps.filesProviders['browser']
browserProvider.resolveDirectory('browser', (error, filesProvider) => {
if (error) console.error(error)
var fileList = Object.keys(filesProvider)
if (fileList.length) {
_switchFile(browserProvider.type + '/' + fileList[0])
_openFile(browserProvider.type + '/' + fileList[0])
} else {
// TODO: Only keep `this.emit` (issue#2210)
this.emit('noFileSelected')

@ -1,9 +1,9 @@
const EventEmitter = require('events')
class SwitchFile extends EventEmitter {
class OpenFile extends EventEmitter {
command (name) {
this.api.perform((done) => {
switchFile(this.api, name, () => {
openFile(this.api, name, () => {
done()
this.emit('complete')
})
@ -13,7 +13,7 @@ class SwitchFile extends EventEmitter {
}
// click on fileExplorer can toggle it. We go through settings to be sure FE is open
function switchFile (browser, name, done) {
function openFile (browser, name, done) {
browser.clickLaunchIcon('settings').clickLaunchIcon('fileExplorers')
.waitForElementVisible('li[key="' + name + '"]')
.click('li[key="' + name + '"]')
@ -23,4 +23,4 @@ function switchFile (browser, name, done) {
})
}
module.exports = SwitchFile
module.exports = OpenFile

@ -66,7 +66,7 @@ module.exports = {
'Switch Tabs using tabs icon': function (browser) {
browser
.waitForElementVisible('div[data-id="filePanelFileExplorerTree"]')
.switchFile('browser/3_Ballot.sol')
.openFile('browser/3_Ballot.sol')
.assert.containsText('div[title="browser/3_Ballot.sol"]', '3_Ballot.sol')
.click('span[class^=dropdownCaret]')
.click('#homeItem')

@ -10,7 +10,7 @@ module.exports = {
'Should zoom in editor': function (browser) {
browser.waitForElementVisible('div[data-id="mainPanelPluginsContainer"]')
.switchFile('browser/1_Storage.sol')
.openFile('browser/1_Storage.sol')
.waitForElementVisible('*[data-id="editorInput"]')
.checkElementStyle('*[data-id="editorInput"]', 'font-size', '12px')
.click('*[data-id="tabProxyZoomIn"]')
@ -74,7 +74,7 @@ module.exports = {
'Should highlight source code': function (browser) {
browser.addFile('sourcehighlight.js', sourcehighlightScript)
.switchFile('browser/sourcehighlight.js')
.openFile('browser/sourcehighlight.js')
.executeScript('remix.exeCurrent()')
.editorScroll('down', 60)
.waitForElementPresent('.highlightLine32')
@ -87,9 +87,9 @@ module.exports = {
'Should remove 1 highlight from source code': function (browser) {
browser.addFile('removeSourcehighlightScript.js', removeSourcehighlightScript)
.switchFile('browser/removeSourcehighlightScript.js')
.openFile('browser/removeSourcehighlightScript.js')
.executeScript('remix.exeCurrent()')
.switchFile('browser/3_Ballot.sol')
.openFile('browser/3_Ballot.sol')
.editorScroll('down', 60)
.waitForElementNotPresent('.highlightLine32')
.checkElementStyle('.highlightLine40', 'background-color', 'rgb(8, 108, 181)')
@ -98,9 +98,9 @@ module.exports = {
'Should remove all highlights from source code': function (browser) {
browser.addFile('removeAllSourcehighlightScript.js', removeAllSourcehighlightScript)
.switchFile('browser/removeAllSourcehighlightScript.js')
.openFile('browser/removeAllSourcehighlightScript.js')
.executeScript('remix.exeCurrent()')
.switchFile('browser/3_Ballot.sol')
.openFile('browser/3_Ballot.sol')
.editorScroll('down', 60)
.waitForElementNotPresent('.highlightLine32')
.waitForElementNotPresent('.highlightLine40')

@ -31,14 +31,14 @@ module.exports = {
.waitForElementVisible('*[data-id="settingsTabGenerateContractMetadata"]', 5000)
.click('*[data-id="settingsTabGenerateContractMetadata"]')
.click('*[data-id="verticalIconsFileExplorerIcons"]')
.switchFile('browser/3_Ballot.sol')
.openFile('browser/3_Ballot.sol')
.click('*[data-id="verticalIconsKindsolidity"]')
.pause(2000)
.click('*[data-id="compilerContainerCompileBtn"]')
.pause(3000)
.click('*[data-id="verticalIconsKindfileExplorers"]')
.switchFile('browser/artifacts')
.switchFile('browser/artifacts/Ballot.json')
.openFile('browser/artifacts')
.openFile('browser/artifacts/Ballot.json')
},
'Should add new github access token': function (browser) {

@ -44,9 +44,9 @@ module.exports = {
browser
.modalFooterCancelClick()
.executeScript(`remix.loadgist('${gistid}')`)
.perform((done) => { if (runtimeBrowser === 'chrome') { browser.switchFile('browser/gists') } done() })
.switchFile(`browser/gists/${gistid}`)
.switchFile(`browser/gists/${gistid}/1_Storage.sol`)
.perform((done) => { if (runtimeBrowser === 'chrome') { browser.openFile('browser/gists') } done() })
.openFile(`browser/gists/${gistid}`)
.openFile(`browser/gists/${gistid}/1_Storage.sol`)
.perform(done)
}
})
@ -86,8 +86,8 @@ module.exports = {
.waitForElementVisible('*[data-id="modalDialogCustomPromptText"]')
.setValue('*[data-id="modalDialogCustomPromptText"]', testData.validGistId)
.modalFooterOKClick()
.switchFile(`browser/gists/${testData.validGistId}`)
.switchFile(`browser/gists/${testData.validGistId}/ApplicationRegistry`)
.openFile(`browser/gists/${testData.validGistId}`)
.openFile(`browser/gists/${testData.validGistId}/ApplicationRegistry`)
.waitForElementVisible(`div[title='browser/gists/${testData.validGistId}/ApplicationRegistry']`)
.assert.containsText(`div[title='browser/gists/${testData.validGistId}/ApplicationRegistry'] > span`, 'ApplicationRegistry')
.end()

@ -59,7 +59,7 @@ module.exports = {
function checkDeployShouldFail (browser, callback) {
let config
browser.switchFile('browser/artifacts').switchFile('browser/artifacts/test.json')
browser.openFile('browser/artifacts').openFile('browser/artifacts/test.json')
.getEditorValue((content) => {
config = JSON.parse(content)
config.deploy['VM:-'].autoDeployLib = false
@ -67,7 +67,7 @@ function checkDeployShouldFail (browser, callback) {
.perform(() => {
browser.setEditorValue(JSON.stringify(config))
})
.switchFile('browser/Untitled5.sol')
.openFile('browser/Untitled5.sol')
.selectContract('test') // deploy lib
.createContract('')
.assert.containsText('div[class^="terminal"]', '<address> is not a valid address')
@ -77,7 +77,7 @@ function checkDeployShouldFail (browser, callback) {
function checkDeployShouldSucceed (browser, address, callback) {
let addressRef
let config
browser.switchFile('browser/artifacts').switchFile('browser/artifacts/test.json')
browser.openFile('browser/artifacts').openFile('browser/artifacts/test.json')
.getEditorValue((content) => {
config = JSON.parse(content)
config.deploy['VM:-'].autoDeployLib = false
@ -86,7 +86,7 @@ function checkDeployShouldSucceed (browser, address, callback) {
.perform(() => {
browser.setEditorValue(JSON.stringify(config))
})
.switchFile('browser/Untitled5.sol')
.openFile('browser/Untitled5.sol')
.selectContract('test') // deploy lib
.createContract('')
.getAddressAtPosition(1, (address) => {

@ -66,7 +66,7 @@ module.exports = {
.assert.containsText('*[data-id="pluginManagerSettingsPermissionForm"]', 'No Permission requested yet')
.modalFooterOKClick()
.click('*[data-id="verticalIconsFileExplorerIcons"]')
.switchFile('browser/3_Ballot.sol')
.openFile('browser/3_Ballot.sol')
.click('*[plugin="ZoKrates"]')
.pause(5000)
.frame(0)

@ -13,7 +13,7 @@ module.exports = {
browser
.waitForElementVisible('#icon-panel', 10000)
.clickLaunchIcon('fileExplorers')
.switchFile('browser/3_Ballot.sol')
.openFile('browser/3_Ballot.sol')
.verifyContracts(['Ballot'])
.click('#publishOnIpfs')
.getModalBody((value, done) => {
@ -37,7 +37,7 @@ module.exports = {
browser
.waitForElementVisible('#icon-panel')
.clickLaunchIcon('fileExplorers')
.switchFile('browser/1_Storage.sol')
.openFile('browser/1_Storage.sol')
.clickLaunchIcon('udapp')
.waitForElementVisible('*[data-id="contractDropdownIpfsCheckbox"]')
.click('*[data-id="contractDropdownIpfsCheckbox"]')
@ -49,7 +49,7 @@ module.exports = {
'Should remember choice after page refresh': function (browser) {
browser
.refresh()
.switchFile('browser/1_Storage.sol')
.openFile('browser/1_Storage.sol')
.clickLaunchIcon('udapp')
.waitForElementVisible('*[data-id="contractDropdownIpfsCheckbox"]')
.verify.elementPresent('*[data-id="contractDropdownIpfsCheckbox"]:checked')

@ -90,7 +90,7 @@ module.exports = {
'Should deploy contract on Goerli Test Network using MetaMask': function (browser) {
browser.waitForElementPresent('*[data-id="runTabSelectAccount"] option')
.clickLaunchIcon('fileExplorers')
.switchFile('browser/Greet.sol')
.openFile('browser/Greet.sol')
.clickLaunchIcon('udapp')
.waitForElementPresent('*[data-id="Deploy - transact (not payable)"]')
.click('*[data-id="Deploy - transact (not payable)"]')
@ -141,7 +141,7 @@ module.exports = {
'Should deploy contract on Ethereum Main Network using MetaMask': function (browser) {
browser.waitForElementPresent('*[data-id="runTabSelectAccount"] option')
.clickLaunchIcon('fileExplorers')
.switchFile('browser/Greet.sol')
.openFile('browser/Greet.sol')
.clickLaunchIcon('udapp')
.waitForElementPresent('*[data-id="Deploy - transact (not payable)"]')
.click('*[data-id="Deploy - transact (not payable)"]')

@ -23,7 +23,7 @@ module.exports = {
browser.assert.ok(typeof signature.value === 'string', 'type of signature.value must be String')
})
.addFile('signMassage.sol', sources[0]['browser/signMassage.sol'])
.switchFile('browser/signMassage.sol')
.openFile('browser/signMassage.sol')
.pause(5000)
.selectContract('ECVerify')
.createContract('')

@ -15,7 +15,7 @@ module.exports = {
'Test Success Import': function (browser) {
browser.addFile('Untitled1.sol', sources[1]['browser/Untitled1.sol'])
.addFile('Untitled2.sol', sources[1]['browser/Untitled2.sol'])
.switchFile('browser/Untitled1.sol')
.openFile('browser/Untitled1.sol')
.verifyContracts(['test6', 'test4', 'test5'])
},

@ -27,7 +27,7 @@ module.exports = {
'Should generate test file': function (browser) {
browser.waitForElementPresent('*[data-id="verticalIconsKindfileExplorers"]')
.clickLaunchIcon('fileExplorers')
.switchFile('browser/simple_storage.sol')
.openFile('browser/simple_storage.sol')
.click('*[data-id="verticalIconsKindsolidityUnitTesting"]')
.waitForElementPresent('*[data-id="testTabGenerateTestFile"]')
.click('*[data-id="testTabGenerateTestFile"]')
@ -100,7 +100,7 @@ module.exports = {
browser.waitForElementPresent('*[data-id="verticalIconsKindfileExplorers"]')
.addFile('compilationError_test.sol', sources[0]['browser/compilationError_test.sol'])
.clickLaunchIcon('fileExplorers')
.switchFile('browser/compilationError_test.sol')
.openFile('browser/compilationError_test.sol')
.clickLaunchIcon('solidityUnitTesting')
.click('*[data-id="testTabCheckAllTests"]')
.clickElementAtPosition('.singleTestLabel', 3)
@ -115,7 +115,7 @@ module.exports = {
browser.waitForElementPresent('*[data-id="verticalIconsKindfileExplorers"]')
.addFile('deployError_test.sol', sources[0]['browser/deployError_test.sol'])
.clickLaunchIcon('fileExplorers')
.switchFile('browser/deployError_test.sol')
.openFile('browser/deployError_test.sol')
.clickLaunchIcon('solidityUnitTesting')
.click('*[data-id="testTabCheckAllTests"]')
.clickElementAtPosition('.singleTestLabel', 4)
@ -129,7 +129,7 @@ module.exports = {
browser.waitForElementPresent('*[data-id="verticalIconsKindfileExplorers"]')
.addFile('methodFailure_test.sol', sources[0]['browser/methodFailure_test.sol'])
.clickLaunchIcon('fileExplorers')
.switchFile('browser/methodFailure_test.sol')
.openFile('browser/methodFailure_test.sol')
.clickLaunchIcon('solidityUnitTesting')
.click('*[data-id="testTabCheckAllTests"]')
.clickElementAtPosition('.singleTestLabel', 5)
@ -150,7 +150,7 @@ function runTests (browser) {
browser
.waitForElementPresent('*[data-id="verticalIconsKindfileExplorers"]')
.clickLaunchIcon('fileExplorers')
.switchFile('browser/3_Ballot.sol')
.openFile('browser/3_Ballot.sol')
.clickLaunchIcon('solidityUnitTesting')
.pause(500)
.scrollAndClick('#runTestsTabRunAction')

@ -57,7 +57,7 @@ module.exports = {
'Async/Await Script': function (browser) {
browser
.addFile('asyncAwait.js', { content: asyncAwait })
.switchFile('browser/asyncAwait.js')
.openFile('browser/asyncAwait.js')
.executeScript(`remix.execute('browser/asyncAwait.js')`)
.journalLastChild('Waiting Promise')
.pause(5500)
@ -67,7 +67,7 @@ module.exports = {
'Call Remix File Manager from a script': function (browser) {
browser
.addFile('asyncAwaitWithFileManagerAccess.js', { content: asyncAwaitWithFileManagerAccess })
.switchFile('browser/asyncAwaitWithFileManagerAccess.js')
.openFile('browser/asyncAwaitWithFileManagerAccess.js')
.pause(5000)
.executeScript(`remix.execute('browser/asyncAwaitWithFileManagerAccess.js')`)
.pause(6000)

Loading…
Cancel
Save