-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Filemanager external api e2e #2916
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,190 @@ | ||
'use strict' | ||
var init = require('../helpers/init') | ||
var sauce = require('./sauce') | ||
|
||
module.exports = { | ||
before: function (browser, done) { | ||
init(browser, done) | ||
}, | ||
|
||
'Should execute `file` api from file manager external api': function (browser) { | ||
browser | ||
.addFile('file.js', { content: executeFile }) | ||
.executeScript(`remix.exeCurrent()`) | ||
.pause(2000) | ||
.journalLastChildIncludes('browser/file.js') | ||
}, | ||
|
||
'Should execute `exists` api from file manager external api': function (browser) { | ||
browser | ||
.addFile('exists.js', { content: executeExists }) | ||
.executeScript(`remix.exeCurrent()`) | ||
.pause(2000) | ||
.journalChildIncludes('browser/exists.js true') | ||
.journalChildIncludes('browser/non-exists.js false') | ||
}, | ||
|
||
'Should execute `open` api from file manager external api': function (browser) { | ||
browser | ||
.addFile('open.js', { content: executeOpen }) | ||
.executeScript(`remix.exeCurrent()`) | ||
.pause(2000) | ||
.journalLastChildIncludes('browser/3_Ballot.sol') | ||
}, | ||
|
||
'Should execute `writeFile` api from file manager external api': function (browser) { | ||
browser | ||
.addFile('writeFile.js', { content: executeWriteFile }) | ||
.executeScript(`remix.exeCurrent()`) | ||
.pause(2000) | ||
.openFile('browser/new_contract.sol') | ||
.assert.containsText('[data-id="editorInput"]', 'pragma solidity ^0.6.0') | ||
}, | ||
|
||
'Should execute `readFile` api from file manager external api': function (browser) { | ||
browser | ||
.addFile('readFile.js', { content: executeReadFile }) | ||
.executeScript(`remix.exeCurrent()`) | ||
.pause(2000) | ||
.journalLastChildIncludes('pragma solidity ^0.6.0') | ||
}, | ||
|
||
'Should execute `copyFile` api from file manager external api': function (browser) { | ||
browser | ||
.addFile('copyFile.js', { content: executeCopyFile }) | ||
.executeScript(`remix.exeCurrent()`) | ||
.pause(2000) | ||
.journalLastChildIncludes('pragma solidity >=0.2.0 <0.7.0;') | ||
}, | ||
|
||
'Should execute `rename` api from file manager external api': function (browser) { | ||
browser | ||
.addFile('renameFile.js', { content: executeRename }) | ||
.executeScript(`remix.exeCurrent()`) | ||
.pause(2000) | ||
.waitForElementPresent('[data-id="treeViewLibrowser/old_contract.sol"]') | ||
}, | ||
|
||
'Should execute `mkdir` api from file manager external api': function (browser) { | ||
browser | ||
.addFile('mkdirFile.js', { content: executeMkdir }) | ||
.executeScript(`remix.exeCurrent()`) | ||
.pause(2000) | ||
.waitForElementPresent('[data-id="treeViewLibrowser/Test_Folder"]') | ||
}, | ||
|
||
'Should execute `readdir` api from file manager external api': function (browser) { | ||
browser | ||
.addFile('readdirFile.js', { content: executeReaddir }) | ||
.executeScript(`remix.exeCurrent()`) | ||
.pause(2000) | ||
.journalLastChildIncludes('Test_Folder isDirectory true') | ||
}, | ||
|
||
'Should execute `remove` api from file manager external api': function (browser) { | ||
browser | ||
.addFile('removeFile.js', { content: executeRemove }) | ||
.executeScript(`remix.exeCurrent()`) | ||
.pause(2000) | ||
.waitForElementNotVisible('[data-id="treeViewLibrowser/old_contract.sol"]') | ||
.end() | ||
}, | ||
|
||
tearDown: sauce | ||
} | ||
|
||
const executeFile = ` | ||
const run = async () => { | ||
const result = await remix.call('fileManager', 'file') | ||
|
||
console.log(result) | ||
} | ||
|
||
run() | ||
` | ||
|
||
const executeExists = ` | ||
const run = async () => { | ||
const result1 = await remix.call('fileManager', 'exists', 'browser/exists.js') | ||
const result2 = await remix.call('fileManager', 'exists', 'browser/non-exists.js') | ||
|
||
console.log('browser/exists.js ' + result1) | ||
console.log('browser/non-exists.js ' + result2) | ||
} | ||
|
||
run() | ||
` | ||
|
||
const executeOpen = ` | ||
const run = async () => { | ||
await remix.call('fileManager', 'open', 'browser/3_Ballot.sol') | ||
const result = await remix.call('fileManager', 'file') | ||
|
||
console.log(result) | ||
} | ||
|
||
run() | ||
` | ||
|
||
const executeWriteFile = ` | ||
const run = async () => { | ||
await remix.call('fileManager', 'writeFile', 'browser/new_contract.sol', 'pragma solidity ^0.6.0') | ||
} | ||
|
||
run() | ||
` | ||
|
||
const executeReadFile = ` | ||
const run = async () => { | ||
const result = await remix.call('fileManager', 'readFile', 'browser/new_contract.sol') | ||
|
||
console.log(result) | ||
} | ||
|
||
run() | ||
` | ||
|
||
const executeCopyFile = ` | ||
const run = async () => { | ||
await remix.call('fileManager', 'copyFile', 'browser/basic.sol', 'browser/new_contract.sol') | ||
const result = await remix.call('fileManager', 'readFile', 'browser/new_contract.sol') | ||
|
||
console.log(result) | ||
} | ||
|
||
run() | ||
` | ||
|
||
const executeRename = ` | ||
const run = async () => { | ||
await remix.call('fileManager', 'rename', 'browser/new_contract.sol', 'browser/old_contract.sol') | ||
} | ||
|
||
run() | ||
` | ||
|
||
const executeMkdir = ` | ||
const run = async () => { | ||
await remix.call('fileManager', 'mkdir', 'browser/Test_Folder/') | ||
} | ||
|
||
run() | ||
` | ||
|
||
const executeReaddir = ` | ||
const run = async () => { | ||
const result = await remix.call('fileManager', 'readdir', 'browser/') | ||
|
||
console.log('Test_Folder isDirectory ', result["Test_Folder"].isDirectory) | ||
} | ||
|
||
run() | ||
` | ||
|
||
const executeRemove = ` | ||
const run = async () => { | ||
await remix.call('fileManager', 'remove', 'browser/old_contract.sol') | ||
} | ||
|
||
run() | ||
` |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks like
fileRenameEvent
is not called and that the event located at https://github.com/ethereum/remix-ide/pull/2916/files#diff-f28e4232b4dbf7d53c7b5543bdc9ad4fR314 will never be trigerredThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fileRenamedEvent
is triggered after rename from provider.remix-ide/src/app/files/fileManager.js
Line 270 in 1b2bac5
So the changes are in order.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding a call to the
fileRenamedEvent
event in rename function triggers it twice. You can try it out locally.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does that mean it was actually a bug?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it was.