Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 26 additions & 8 deletions apps/remix-ide-e2e/src/commands/openFile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class OpenFile extends EventEmitter {
this.api.perform((done) => {
openFile(this.api, name, () => {
done()
this.emit('complete')
this.api.pause(2000).perform(() => this.emit('complete'))
})
})
return this
Expand All @@ -31,15 +31,33 @@ function openFile (browser: NightwatchBrowser, name: string, done: VoidFunction)
done()
})
}

})
})
.waitForElementVisible('li[data-id="treeViewLitreeViewItem' + name + '"', 60000)
.click('li[data-id="treeViewLitreeViewItem' + name + '"')
.pause(2000)
.perform(() => {
done()
})
.perform(async () => {
if (await browser.isVisible({ selector: 'li[data-id="treeViewLitreeViewItem' + name + '"]', suppressNotFoundErrors: true})) {
browser.click('li[data-id="treeViewLitreeViewItem' + name + '"]')
done()
return
}
let it = 0
const split = name.split('/')
let current = split.splice(0, 1)
while (true) {
if (await browser.isVisible({ selector: 'li[data-id="treeViewLitreeViewItem' + current.join('/') + '"]', suppressNotFoundErrors: true }) &&
!await browser.isPresent({ selector: 'li[data-id="treeViewLitreeViewItem' + current.join('/') + '"] .fa-folder-open', suppressNotFoundErrors: true })) {
browser.click('li[data-id="treeViewLitreeViewItem' + current.join('/') + '"]')
}
if (current.join('/') === name) {
break
}
current.push(split.shift())
it++
if (it > 15) {
browser.assert.fail(name, current.join('/'), 'cannot open file ' + name)
}
}
done()
})
}

module.exports = OpenFile
1 change: 0 additions & 1 deletion apps/remix-ide-e2e/src/tests/ballot_0_4_14.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ module.exports = {
browser.pause(500)
.clickLaunchIcon('udapp')
.selectAccount('0xCA35b7d915458EF540aDe6068dFe2F44E8fa733c')
.pause()
.setValue('input[placeholder="uint8 _numProposals"]', '2')
.click('*[data-id="Deploy - transact (not payable)"]')
.waitForElementPresent('*[data-id="universalDappUiContractActionWrapper"]', 60000)
Expand Down
13 changes: 11 additions & 2 deletions apps/remix-ide-e2e/src/tests/circom.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,10 @@ module.exports = {
.waitForElementPresent('[data-id="verticalIconsKindcircuit-compiler"]')
.waitForElementVisible('[data-id="verticalIconsKindcircuit-compiler"]')
.click('[data-id="play-editor"]')
.waitForElementPresent('[data-id="treeViewLitreeViewItemcircuits/.bin/simple_js/simple.wasm"]')
.waitForElementVisible('[data-id="treeViewLitreeViewItemcircuits/.bin/simple_js/simple.wasm"]')
.waitForElementContainsText('*[data-id="terminalJournal"]', 'Everything went okay')
.waitForElementPresent('[data-id="treeViewLitreeViewItemcircuits/.bin/simple_js"]')
.openFile('circuits/.bin/simple_js')
.waitForElementPresent('[data-id="treeViewLitreeViewItemcircuits/.bin/simple_js/simple.wasm"]')
},
'Should compute a witness for a simple circuit #group1': function (browser: NightwatchBrowser) {
browser
Expand All @@ -55,6 +57,7 @@ module.exports = {
.click('[data-id="compute_witness_btn"]')
.frameParent()
.clickLaunchIcon('filePanel')
.openFile('circuits/.bin/simple_js/simple.wtn')
.waitForElementPresent('[data-id="treeViewLitreeViewItemcircuits/.bin/simple_js/simple.wtn"]')
.waitForElementVisible('[data-id="treeViewLitreeViewItemcircuits/.bin/simple_js/simple.wtn"]')
},
Expand All @@ -70,6 +73,7 @@ module.exports = {
.click('button[data-id="compile_circuit_btn"]')
.frameParent()
.clickLaunchIcon('filePanel')
.openFile('circuits/.bin/simple_js/simple.wasm')
.waitForElementPresent('[data-id="treeViewLitreeViewItemcircuits/.bin/simple_js/simple.wasm"]')
.waitForElementVisible('[data-id="treeViewLitreeViewItemcircuits/.bin/simple_js/simple.wasm"]')
},
Expand All @@ -88,6 +92,7 @@ module.exports = {
.waitForElementVisible('[data-id="setup_exports_toggler"] .fa-check-circle')
.frameParent()
.clickLaunchIcon('filePanel')
.openFile('circuits/groth16/zk/keys/verification_key.json')
.waitForElementVisible('*[data-id="treeViewLitreeViewItemcircuits/groth16/zk/keys/verification_key.json"]')
},
'Should run Plonk setup and export for a simple circuit using the GUI #group2': function (browser: NightwatchBrowser) {
Expand All @@ -102,6 +107,7 @@ module.exports = {
.waitForElementVisible('[data-id="setup_exports_toggler"] .fa-check-circle')
.frameParent()
.clickLaunchIcon('filePanel')
.openFile('circuits/plonk/zk/keys/verification_key.json')
.waitForElementVisible('*[data-id="treeViewLitreeViewItemcircuits/plonk/zk/keys/verification_key.json"]')
},
'Should compile a simple circuit using CTRL + S from the editor #group3': function (browser: NightwatchBrowser) {
Expand All @@ -116,6 +122,8 @@ module.exports = {

return actions.keyDown(this.Keys.CONTROL).sendKeys('s')
})
.pause(2000)
.openFile('circuits/.bin/simple_js/simple.wasm')
.waitForElementPresent('[data-id="treeViewLitreeViewItemcircuits/.bin/simple_js/simple.wasm"]')
.waitForElementVisible('[data-id="treeViewLitreeViewItemcircuits/.bin/simple_js/simple.wasm"]')
},
Expand Down Expand Up @@ -164,6 +172,7 @@ module.exports = {
.waitForElementNotPresent('[data-id="circuit_feedback"]')
.frameParent()
.clickLaunchIcon('filePanel')
.openFile('circuits/.bin/simple_js/simple.wasm')
.waitForElementPresent('[data-id="treeViewLitreeViewItemcircuits/.bin/simple_js/simple.wasm"]')
},
'Should create a new workspace using hash checker template #group5 #group6': function (browser: NightwatchBrowser) {
Expand Down
23 changes: 2 additions & 21 deletions apps/remix-ide-e2e/src/tests/erc721.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,29 +34,10 @@ module.exports = {
.pause(2000)
.click('[data-id="compilerContainerCompileBtn"]')
.clickLaunchIcon('filePanel')
.isVisible({
selector: '*[data-id="treeViewLitreeViewItem.deps/npm/@openzeppelin/contracts/utils/introspection/IERC165.sol"]',
timeout: 120000,
suppressNotFoundErrors: true
})
.clickLaunchIcon('solidity')
.click('[data-id="compilerContainerCompileBtn"]')
.clickLaunchIcon('filePanel')
.isVisible({
selector: '*[data-id="treeViewLitreeViewItem.deps/npm/@openzeppelin/contracts/utils/introspection/IERC165.sol"]',
timeout: 120000,
suppressNotFoundErrors: true
})
.clickLaunchIcon('solidity')
.click('[data-id="compilerContainerCompileBtn"]')
.clickLaunchIcon('filePanel')
.waitForElementVisible({
selector: '*[data-id="treeViewLitreeViewItem.deps/npm/@openzeppelin/contracts/utils/introspection/IERC165.sol"]',
timeout: 120000,
})
.clickLaunchIcon('udapp')
.verifyContracts(['MyToken'])
// deploy contract
.clickLaunchIcon('udapp')
// deploy contract
.selectContract('MyToken')
.createContract('')
.testFunction('last',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ module.exports = {
.dragAndDrop('li[data-id="treeViewLitreeViewItemcontracts/1_Storage.sol"]', id)
.waitForElementPresent({ selector: '[data-id="fileSystemModalDialogModalFooter-react"] .modal-ok', abortOnFailure: false })
.execute(function () { (document.querySelector('[data-id="fileSystemModalDialogModalFooter-react"] .modal-ok') as HTMLElement).click() })
.openFile('tests/1_Storage.sol')
.openFile('tests/2_Owner.sol')
.waitForElementVisible({ selector: 'li[data-id="treeViewLitreeViewItemtests/1_Storage.sol"]', abortOnFailure: false })
.waitForElementVisible({ selector: 'li[data-id="treeViewLitreeViewItemtests/2_Owner.sol"]', abortOnFailure: false })
.waitForElementNotPresent({ selector: 'li[data-id="treeViewLitreeViewItemcontracts/1_Storage.sol"]', abortOnFailure: false })
Expand Down Expand Up @@ -84,6 +86,7 @@ module.exports = {
.dragAndDrop('li[data-id="treeViewLitreeViewItemtests"]', id)
.waitForElementPresent({ selector: '[data-id="fileSystemModalDialogModalFooter-react"] .modal-ok', abortOnFailure: false })
.execute(function () { (document.querySelector('[data-id="fileSystemModalDialogModalFooter-react"] .modal-ok') as HTMLElement).click() })
.openFile('contracts/tests')
.waitForElementVisible({ selector: 'li[data-id="treeViewLitreeViewItemcontracts/tests"]', abortOnFailure: false })
.waitForElementVisible({ selector: 'li[data-id="treeViewLitreeViewItemcontracts/README.txt"]', abortOnFailure: false })
.waitForElementVisible({ selector: 'li[data-id="treeViewLitreeViewItemcontracts/scripts"]', abortOnFailure: false })
Expand Down
20 changes: 0 additions & 20 deletions apps/remix-ide-e2e/src/tests/proxy_oz_v4.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,26 +28,6 @@ module.exports = {
// because the compilatiom imports are slow and sometimes stop loading (not sure why, it's bug) we need to recompile and check to see if the files are really in de FS
.click('[data-id="compilerContainerCompileBtn"]')
.clickLaunchIcon('filePanel')
.isVisible({
selector: '*[data-id="treeViewDivtreeViewItem.deps/npm/@openzeppelin/contracts-upgradeable@4.8.3/proxy/beacon/IBeaconUpgradeable.sol"]',
timeout: 120000,
suppressNotFoundErrors: true
})
.clickLaunchIcon('solidity')
.click('[data-id="compilerContainerCompileBtn"]')
.clickLaunchIcon('filePanel')
.isVisible({
selector: '*[data-id="treeViewDivtreeViewItem.deps/npm/@openzeppelin/contracts-upgradeable@4.8.3/proxy/beacon/IBeaconUpgradeable.sol"]',
timeout: 120000,
suppressNotFoundErrors: true
})
.clickLaunchIcon('solidity')
.click('[data-id="compilerContainerCompileBtn"]')
.clickLaunchIcon('filePanel')
.waitForElementVisible({
selector: '*[data-id="treeViewDivtreeViewItem.deps/npm/@openzeppelin/contracts-upgradeable@4.8.3/proxy/beacon/IBeaconUpgradeable.sol"]',
timeout: 120000,
})
.clickLaunchIcon('solidity')
.waitForElementPresent('select[id="compiledContracts"] option[value=MyToken]', 60000)
.clickLaunchIcon('udapp')
Expand Down
21 changes: 0 additions & 21 deletions apps/remix-ide-e2e/src/tests/proxy_oz_v5.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,29 +22,8 @@ module.exports = {
.addFile('myTokenV1.sol', sources[0]['myTokenV1.sol'])
.clickLaunchIcon('solidity')
.pause(2000)
// because the compilatiom imports are slow and sometimes stop loading (not sure why, it's bug) we need to recompile and check to see if the files are really in de FS
.click('[data-id="compilerContainerCompileBtn"]')
.clickLaunchIcon('filePanel')
.isVisible({
selector: '*[data-id="treeViewDivtreeViewItem.deps/npm/@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol"]',
timeout: 120000,
suppressNotFoundErrors: true
})
.clickLaunchIcon('solidity')
.click('[data-id="compilerContainerCompileBtn"]')
.clickLaunchIcon('filePanel')
.isVisible({
selector: '*[data-id="treeViewDivtreeViewItem.deps/npm/@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol"]',
timeout: 120000,
suppressNotFoundErrors: true
})
.clickLaunchIcon('solidity')
.click('[data-id="compilerContainerCompileBtn"]')
.clickLaunchIcon('filePanel')
.waitForElementVisible({
selector: '*[data-id="treeViewDivtreeViewItem.deps/npm/@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol"]',
timeout: 120000,
})
.clickLaunchIcon('solidity')
.waitForElementPresent('select[id="compiledContracts"] option[value=MyToken]', 60000)
.clickLaunchIcon('udapp')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,29 +28,7 @@ module.exports = {
.addFile('myTokenV1.sol', sources[0]['myTokenV1.sol'])
.clickLaunchIcon('solidity')
.pause(2000)
// because the compilatiom imports are slow and sometimes stop loading (not sure why, it's bug) we need to recompile and check to see if the files are really in de FS
.click('[data-id="compilerContainerCompileBtn"]')
.clickLaunchIcon('filePanel')
.isVisible({
selector: '*[data-id="treeViewDivtreeViewItem.deps/npm/@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol"]',
timeout: 120000,
suppressNotFoundErrors: true
})
.clickLaunchIcon('solidity')
.click('[data-id="compilerContainerCompileBtn"]')
.clickLaunchIcon('filePanel')
.isVisible({
selector: '*[data-id="treeViewDivtreeViewItem.deps/npm/@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol"]',
timeout: 120000,
suppressNotFoundErrors: true
})
.clickLaunchIcon('solidity')
.click('[data-id="compilerContainerCompileBtn"]')
.clickLaunchIcon('filePanel')
.waitForElementVisible({
selector: '*[data-id="treeViewDivtreeViewItem.deps/npm/@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol"]',
timeout: 120000,
})
.clickLaunchIcon('solidity')
.waitForElementPresent('select[id="compiledContracts"] option[value=MyToken]', 60000)
.clickLaunchIcon('udapp')
Expand Down
2 changes: 2 additions & 0 deletions apps/remix-ide-e2e/src/tests/runAndDeploy.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,8 @@ module.exports = {
.waitForElementVisible('*[data-id="treeViewLitreeViewItemscripts/deploy_with_web3.ts"]')
.openFile('scripts/deploy_with_web3.ts')
.click('[data-id="play-editor"]')
.waitForElementContainsText('*[data-id="terminalJournal"]', 'address:')
.openFile('.states/vm-london/state.json')
.waitForElementPresent('[data-id="treeViewDivDraggableItem.states/vm-london/state.json"]')
.click('[data-id="treeViewDivDraggableItem.states/vm-london/state.json"]')
.pause(1000)
Expand Down
3 changes: 1 addition & 2 deletions apps/remix-ide-e2e/src/tests/solidityUnittests.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ module.exports = {
.clickLaunchIcon('filePanel')
.addFile('simple_storage.sol', sources[0]['simple_storage.sol'])
.addFile('ks2a.sol', sources[0]['ks2a.sol'])
.waitForElementVisible('li[data-id="treeViewLitreeViewItem.deps/remix-tests/remix_tests.sol"]')
.waitForElementVisible('li[data-id="treeViewLitreeViewItem.deps/remix-tests/remix_accounts.sol"]')
.openFile('.deps/remix-tests/remix_tests.sol')
// remix_test.sol should be opened in editor
.getEditorValue((content) => browser.assert.ok(content.indexOf('library Assert {') !== -1))
Expand All @@ -48,6 +46,7 @@ module.exports = {
.waitForElementPresent('*[data-id="testTabGenerateTestFile"]')
.click('*[data-id="testTabGenerateTestFile"]')
.clickLaunchIcon('filePanel')
.openFile('tests/simple_storage_test.sol')
.waitForElementPresent('*[data-path="default_workspace/tests/simple_storage_test.sol"]')
.removeFile('tests/simple_storage_test.sol', 'default_workspace')
},
Expand Down
3 changes: 3 additions & 0 deletions apps/remix-ide-e2e/src/tests/url.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ module.exports = {
.currentWorkspaceIs('code-sample')
.openFile('contract-eaa022e37e.yul')
.getEditorValue((content) => {
console.log(content)
browser.assert.ok(content && content.indexOf(
'object "Contract1" {') !== -1)
})
Expand All @@ -202,6 +203,7 @@ module.exports = {
.pause(2000)
.click('[data-id="compilerContainerCompileBtn"]')
.clickLaunchIcon('filePanel')
.openFile('.deps/npm/@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol')
.isVisible({
selector: '*[data-id="treeViewDivtreeViewItem.deps/npm/@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol"]',
timeout: 120000,
Expand All @@ -222,6 +224,7 @@ module.exports = {
selector: '*[data-id="treeViewDivtreeViewItem.deps/npm/@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol"]',
timeout: 120000,
})
.openFile('myTokenV1.sol')
.clickLaunchIcon('solidity')
.waitForElementPresent('select[id="compiledContracts"] option[value=MyToken]', 60000)
.clickLaunchIcon('udapp')
Expand Down
3 changes: 3 additions & 0 deletions apps/remixdesktop/test/tests/app/circom-compiler.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,16 @@ const tests = {
.click('[data-id="play-editor"]')
.waitForElementVisible('[data-id="verticalIconsKindcircuit-compiler"]')
.waitForElementVisible('[data-id="treeViewLitreeViewItemcircuits/.bin"]')
.openFile('circuits/.bin/simple_js')
.click('[data-id="treeViewLitreeViewItemcircuits/.bin"]')
.waitForElementVisible('[data-id="treeViewLitreeViewItemcircuits/.bin/simple_js"]')
.click('[data-id="treeViewLitreeViewItemcircuits/.bin/simple_js"]')
.openFile('circuits/.bin/simple_js/simple.wasm')
.waitForElementVisible('[data-id="treeViewLitreeViewItemcircuits/.bin/simple_js/simple.wasm"]')
},
'Should run setup script for simple circuit': function (browser: NightwatchBrowser) {
browser
.openFile('circuits/.bin/simple_js/simple.wtn')
.clickLaunchIcon('circuit-compiler')
.frame(0)
.waitForElementVisible('[data-id="runSetupBtn"]')
Expand Down
3 changes: 2 additions & 1 deletion libs/remix-ui/workspace/src/lib/actions/events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import isElectron from 'is-electron'
import React from 'react'
import { action, FileTree, WorkspaceTemplate } from '../types'
import { ROOT_PATH } from '../utils/constants'
import { displayNotification, displayPopUp, fileAddedSuccess, fileRemovedSuccess, fileRenamedSuccess, folderAddedSuccess, loadLocalhostError, loadLocalhostRequest, loadLocalhostSuccess, removeContextMenuItem, removeFocus, rootFolderChangedSuccess, setContextMenuItem, setMode, setReadOnlyMode, setFileDecorationSuccess } from './payload'
import { displayNotification, displayPopUp, focusElement, fileAddedSuccess, fileRemovedSuccess, fileRenamedSuccess, folderAddedSuccess, loadLocalhostError, loadLocalhostRequest, loadLocalhostSuccess, removeContextMenuItem, removeFocus, rootFolderChangedSuccess, setContextMenuItem, setMode, setReadOnlyMode, setFileDecorationSuccess } from './payload'
import { addInputField, createWorkspace, populateWorkspace, deleteWorkspace, fetchWorkspaceDirectory, renameWorkspace, switchToWorkspace, uploadFile } from './workspace'

const LOCALHOST = ' - connect to localhost - '
Expand Down Expand Up @@ -77,6 +77,7 @@ export const listenOnPluginEvents = (filePanelPlugin) => {
currentCheck = currentCheck + '/' + value
await folderAdded(currentCheck)
}
dispatch(focusElement([{ key: file, type: 'file' }]))
})
}

Expand Down
Loading