pull/5370/head
filip mertens 1 year ago committed by Aniket
parent 841e76a0c8
commit a2e2a5212b
  1. 27
      apps/remix-ide-e2e/src/tests/fileManager_api.test.ts
  2. 2
      apps/remix-ide/src/app/files/fileManager.ts

@ -42,6 +42,25 @@ module.exports = {
})
},
'Should execute `writeMultipleFiles` api from file manager external api #group1': function (browser: NightwatchBrowser) {
browser
.addFile('writeMultipleFiles.js', { content: executeWriteMultipleFiles })
.executeScriptInTerminal('remix.exeCurrent()')
.pause(2000)
.openFile('new_contract_1.sol')
.getEditorValue((content) => {
browser.assert.ok(content.indexOf('pragma solidity ^0.6.0') !== -1, 'content does not contain "pragma solidity ^0.6.0"')
})
.openFile('new_contract_2.sol')
.getEditorValue((content) => {
browser.assert.ok(content.indexOf('pragma solidity ^0.8.0') !== -1, 'content does not contain "pragma solidity ^0.8.0"')
})
.openFile('testing.txt')
.getEditorValue((content) => {
browser.assert.ok(content.indexOf('test') !== -1, 'content does not contain "test"')
})
},
'Should execute `readFile` api from file manager external api #group2': function (browser: NightwatchBrowser) {
browser
.addFile('writeFile.js', { content: executeWriteFile })
@ -143,6 +162,14 @@ const executeWriteFile = `
run()
`
const executeWriteMultipleFiles = `
const run = async () => {
await remix.call('fileManager', 'writeMultipleFiles', ['new_contract_1.sol', 'new_contract_2.sol', 'testing.txt'], ['pragma solidity ^0.6.0', 'pragma solidity ^0.80', 'test'], '/')
}
run()
`
const executeReadFile = `
const run = async () => {
const result = await remix.call('fileManager', 'readFile', 'new_contract.sol')

@ -225,7 +225,7 @@ class FileManager extends Plugin {
* @param {string} folderPath base folder path
* @returns {void}
*/
async writeMultipleFiles(filePaths, fileData, folderPath) {
async writeMultipleFiles(filePaths: string[], fileData: string[], folderPath: string) {
if (this.currentRequest) {
const canCall = await this.askUserPermission(`writeFile`, `will write multiple files to ${folderPath}...`)
const required = this.appManager.isRequired(this.currentRequest.from)

Loading…
Cancel
Save