Skip to content

Commit 529afa7

Browse files
committed
update e2e openFile
1 parent 5494dbf commit 529afa7

File tree

13 files changed

+94
-117
lines changed

13 files changed

+94
-117
lines changed

apps/remix-ide-e2e/src/commands/openFile.ts

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ class OpenFile extends EventEmitter {
66
this.api.perform((done) => {
77
openFile(this.api, name, () => {
88
done()
9-
this.emit('complete')
9+
this.api.pause(2000).perform(() => this.emit('complete'))
1010
})
1111
})
1212
return this
@@ -31,15 +31,33 @@ function openFile (browser: NightwatchBrowser, name: string, done: VoidFunction)
3131
done()
3232
})
3333
}
34-
3534
})
3635
})
37-
.waitForElementVisible('li[data-id="treeViewLitreeViewItem' + name + '"', 60000)
38-
.click('li[data-id="treeViewLitreeViewItem' + name + '"')
39-
.pause(2000)
40-
.perform(() => {
41-
done()
42-
})
36+
.perform(async () => {
37+
if (await browser.isVisible({ selector: 'li[data-id="treeViewLitreeViewItem' + name + '"]', suppressNotFoundErrors: true})) {
38+
browser.click('li[data-id="treeViewLitreeViewItem' + name + '"]')
39+
done()
40+
return
41+
}
42+
let it = 0
43+
const split = name.split('/')
44+
let current = split.splice(0, 1)
45+
while (true) {
46+
if (await browser.isVisible({ selector: 'li[data-id="treeViewLitreeViewItem' + current.join('/') + '"]', suppressNotFoundErrors: true }) &&
47+
!await browser.isPresent({ selector: 'li[data-id="treeViewLitreeViewItem' + current.join('/') + '"] .fa-folder-open', suppressNotFoundErrors: true })) {
48+
browser.click('li[data-id="treeViewLitreeViewItem' + current.join('/') + '"]')
49+
}
50+
if (current.join('/') === name) {
51+
break
52+
}
53+
current.push(split.shift())
54+
it++
55+
if (it > 15) {
56+
browser.assert.fail(name, current.join('/'), 'cannot open file ' + name)
57+
}
58+
}
59+
done()
60+
})
4361
}
4462

4563
module.exports = OpenFile

apps/remix-ide-e2e/src/tests/ballot_0_4_14.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ module.exports = {
3636
browser.pause(500)
3737
.clickLaunchIcon('udapp')
3838
.selectAccount('0xCA35b7d915458EF540aDe6068dFe2F44E8fa733c')
39-
.pause()
4039
.setValue('input[placeholder="uint8 _numProposals"]', '2')
4140
.click('*[data-id="Deploy - transact (not payable)"]')
4241
.waitForElementPresent('*[data-id="universalDappUiContractActionWrapper"]', 60000)

apps/remix-ide-e2e/src/tests/circom.test.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,10 @@ module.exports = {
3838
.waitForElementPresent('[data-id="verticalIconsKindcircuit-compiler"]')
3939
.waitForElementVisible('[data-id="verticalIconsKindcircuit-compiler"]')
4040
.click('[data-id="play-editor"]')
41-
.waitForElementPresent('[data-id="treeViewLitreeViewItemcircuits/.bin/simple_js/simple.wasm"]')
42-
.waitForElementVisible('[data-id="treeViewLitreeViewItemcircuits/.bin/simple_js/simple.wasm"]')
41+
.waitForElementContainsText('*[data-id="terminalJournal"]', 'Everything went okay')
42+
.waitForElementPresent('[data-id="treeViewLitreeViewItemcircuits/.bin/simple_js"]')
43+
.openFile('circuits/.bin/simple_js')
44+
.waitForElementPresent('[data-id="treeViewLitreeViewItemcircuits/.bin/simple_js/simple.wasm"]')
4345
},
4446
'Should compute a witness for a simple circuit #group1': function (browser: NightwatchBrowser) {
4547
browser
@@ -55,6 +57,7 @@ module.exports = {
5557
.click('[data-id="compute_witness_btn"]')
5658
.frameParent()
5759
.clickLaunchIcon('filePanel')
60+
.openFile('circuits/.bin/simple_js/simple.wtn')
5861
.waitForElementPresent('[data-id="treeViewLitreeViewItemcircuits/.bin/simple_js/simple.wtn"]')
5962
.waitForElementVisible('[data-id="treeViewLitreeViewItemcircuits/.bin/simple_js/simple.wtn"]')
6063
},
@@ -70,6 +73,7 @@ module.exports = {
7073
.click('button[data-id="compile_circuit_btn"]')
7174
.frameParent()
7275
.clickLaunchIcon('filePanel')
76+
.openFile('circuits/.bin/simple_js/simple.wasm')
7377
.waitForElementPresent('[data-id="treeViewLitreeViewItemcircuits/.bin/simple_js/simple.wasm"]')
7478
.waitForElementVisible('[data-id="treeViewLitreeViewItemcircuits/.bin/simple_js/simple.wasm"]')
7579
},
@@ -88,6 +92,7 @@ module.exports = {
8892
.waitForElementVisible('[data-id="setup_exports_toggler"] .fa-check-circle')
8993
.frameParent()
9094
.clickLaunchIcon('filePanel')
95+
.openFile('circuits/groth16/zk/keys/verification_key.json')
9196
.waitForElementVisible('*[data-id="treeViewLitreeViewItemcircuits/groth16/zk/keys/verification_key.json"]')
9297
},
9398
'Should run Plonk setup and export for a simple circuit using the GUI #group2': function (browser: NightwatchBrowser) {
@@ -102,6 +107,7 @@ module.exports = {
102107
.waitForElementVisible('[data-id="setup_exports_toggler"] .fa-check-circle')
103108
.frameParent()
104109
.clickLaunchIcon('filePanel')
110+
.openFile('circuits/plonk/zk/keys/verification_key.json')
105111
.waitForElementVisible('*[data-id="treeViewLitreeViewItemcircuits/plonk/zk/keys/verification_key.json"]')
106112
},
107113
'Should compile a simple circuit using CTRL + S from the editor #group3': function (browser: NightwatchBrowser) {
@@ -116,6 +122,8 @@ module.exports = {
116122

117123
return actions.keyDown(this.Keys.CONTROL).sendKeys('s')
118124
})
125+
.pause(2000)
126+
.openFile('circuits/.bin/simple_js/simple.wasm')
119127
.waitForElementPresent('[data-id="treeViewLitreeViewItemcircuits/.bin/simple_js/simple.wasm"]')
120128
.waitForElementVisible('[data-id="treeViewLitreeViewItemcircuits/.bin/simple_js/simple.wasm"]')
121129
},
@@ -164,6 +172,7 @@ module.exports = {
164172
.waitForElementNotPresent('[data-id="circuit_feedback"]')
165173
.frameParent()
166174
.clickLaunchIcon('filePanel')
175+
.openFile('circuits/.bin/simple_js/simple.wasm')
167176
.waitForElementPresent('[data-id="treeViewLitreeViewItemcircuits/.bin/simple_js/simple.wasm"]')
168177
},
169178
'Should create a new workspace using hash checker template #group5 #group6': function (browser: NightwatchBrowser) {

apps/remix-ide-e2e/src/tests/erc721.test.ts

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -34,29 +34,10 @@ module.exports = {
3434
.pause(2000)
3535
.click('[data-id="compilerContainerCompileBtn"]')
3636
.clickLaunchIcon('filePanel')
37-
.isVisible({
38-
selector: '*[data-id="treeViewLitreeViewItem.deps/npm/@openzeppelin/contracts/utils/introspection/IERC165.sol"]',
39-
timeout: 120000,
40-
suppressNotFoundErrors: true
41-
})
42-
.clickLaunchIcon('solidity')
43-
.click('[data-id="compilerContainerCompileBtn"]')
44-
.clickLaunchIcon('filePanel')
45-
.isVisible({
46-
selector: '*[data-id="treeViewLitreeViewItem.deps/npm/@openzeppelin/contracts/utils/introspection/IERC165.sol"]',
47-
timeout: 120000,
48-
suppressNotFoundErrors: true
49-
})
50-
.clickLaunchIcon('solidity')
51-
.click('[data-id="compilerContainerCompileBtn"]')
52-
.clickLaunchIcon('filePanel')
53-
.waitForElementVisible({
54-
selector: '*[data-id="treeViewLitreeViewItem.deps/npm/@openzeppelin/contracts/utils/introspection/IERC165.sol"]',
55-
timeout: 120000,
56-
})
37+
.clickLaunchIcon('udapp')
5738
.verifyContracts(['MyToken'])
58-
// deploy contract
5939
.clickLaunchIcon('udapp')
40+
// deploy contract
6041
.selectContract('MyToken')
6142
.createContract('')
6243
.testFunction('last',

apps/remix-ide-e2e/src/tests/file_explorer_multiselect.test.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ module.exports = {
4747
.dragAndDrop('li[data-id="treeViewLitreeViewItemcontracts/1_Storage.sol"]', id)
4848
.waitForElementPresent({ selector: '[data-id="fileSystemModalDialogModalFooter-react"] .modal-ok', abortOnFailure: false })
4949
.execute(function () { (document.querySelector('[data-id="fileSystemModalDialogModalFooter-react"] .modal-ok') as HTMLElement).click() })
50+
.openFile('tests/1_Storage.sol')
51+
.openFile('tests/2_Owner.sol')
5052
.waitForElementVisible({ selector: 'li[data-id="treeViewLitreeViewItemtests/1_Storage.sol"]', abortOnFailure: false })
5153
.waitForElementVisible({ selector: 'li[data-id="treeViewLitreeViewItemtests/2_Owner.sol"]', abortOnFailure: false })
5254
.waitForElementNotPresent({ selector: 'li[data-id="treeViewLitreeViewItemcontracts/1_Storage.sol"]', abortOnFailure: false })
@@ -84,6 +86,7 @@ module.exports = {
8486
.dragAndDrop('li[data-id="treeViewLitreeViewItemtests"]', id)
8587
.waitForElementPresent({ selector: '[data-id="fileSystemModalDialogModalFooter-react"] .modal-ok', abortOnFailure: false })
8688
.execute(function () { (document.querySelector('[data-id="fileSystemModalDialogModalFooter-react"] .modal-ok') as HTMLElement).click() })
89+
.openFile('contracts/tests')
8790
.waitForElementVisible({ selector: 'li[data-id="treeViewLitreeViewItemcontracts/tests"]', abortOnFailure: false })
8891
.waitForElementVisible({ selector: 'li[data-id="treeViewLitreeViewItemcontracts/README.txt"]', abortOnFailure: false })
8992
.waitForElementVisible({ selector: 'li[data-id="treeViewLitreeViewItemcontracts/scripts"]', abortOnFailure: false })

apps/remix-ide-e2e/src/tests/proxy_oz_v4.test.ts

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -28,26 +28,6 @@ module.exports = {
2828
// 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
2929
.click('[data-id="compilerContainerCompileBtn"]')
3030
.clickLaunchIcon('filePanel')
31-
.isVisible({
32-
selector: '*[data-id="treeViewDivtreeViewItem.deps/npm/@openzeppelin/[email protected]/proxy/beacon/IBeaconUpgradeable.sol"]',
33-
timeout: 120000,
34-
suppressNotFoundErrors: true
35-
})
36-
.clickLaunchIcon('solidity')
37-
.click('[data-id="compilerContainerCompileBtn"]')
38-
.clickLaunchIcon('filePanel')
39-
.isVisible({
40-
selector: '*[data-id="treeViewDivtreeViewItem.deps/npm/@openzeppelin/[email protected]/proxy/beacon/IBeaconUpgradeable.sol"]',
41-
timeout: 120000,
42-
suppressNotFoundErrors: true
43-
})
44-
.clickLaunchIcon('solidity')
45-
.click('[data-id="compilerContainerCompileBtn"]')
46-
.clickLaunchIcon('filePanel')
47-
.waitForElementVisible({
48-
selector: '*[data-id="treeViewDivtreeViewItem.deps/npm/@openzeppelin/[email protected]/proxy/beacon/IBeaconUpgradeable.sol"]',
49-
timeout: 120000,
50-
})
5131
.clickLaunchIcon('solidity')
5232
.waitForElementPresent('select[id="compiledContracts"] option[value=MyToken]', 60000)
5333
.clickLaunchIcon('udapp')

apps/remix-ide-e2e/src/tests/proxy_oz_v5.test.ts

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -22,29 +22,8 @@ module.exports = {
2222
.addFile('myTokenV1.sol', sources[0]['myTokenV1.sol'])
2323
.clickLaunchIcon('solidity')
2424
.pause(2000)
25-
// 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
2625
.click('[data-id="compilerContainerCompileBtn"]')
2726
.clickLaunchIcon('filePanel')
28-
.isVisible({
29-
selector: '*[data-id="treeViewDivtreeViewItem.deps/npm/@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol"]',
30-
timeout: 120000,
31-
suppressNotFoundErrors: true
32-
})
33-
.clickLaunchIcon('solidity')
34-
.click('[data-id="compilerContainerCompileBtn"]')
35-
.clickLaunchIcon('filePanel')
36-
.isVisible({
37-
selector: '*[data-id="treeViewDivtreeViewItem.deps/npm/@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol"]',
38-
timeout: 120000,
39-
suppressNotFoundErrors: true
40-
})
41-
.clickLaunchIcon('solidity')
42-
.click('[data-id="compilerContainerCompileBtn"]')
43-
.clickLaunchIcon('filePanel')
44-
.waitForElementVisible({
45-
selector: '*[data-id="treeViewDivtreeViewItem.deps/npm/@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol"]',
46-
timeout: 120000,
47-
})
4827
.clickLaunchIcon('solidity')
4928
.waitForElementPresent('select[id="compiledContracts"] option[value=MyToken]', 60000)
5029
.clickLaunchIcon('udapp')

apps/remix-ide-e2e/src/tests/proxy_oz_v5_non_shanghai_runtime.test.ts

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -28,29 +28,7 @@ module.exports = {
2828
.addFile('myTokenV1.sol', sources[0]['myTokenV1.sol'])
2929
.clickLaunchIcon('solidity')
3030
.pause(2000)
31-
// 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
3231
.click('[data-id="compilerContainerCompileBtn"]')
33-
.clickLaunchIcon('filePanel')
34-
.isVisible({
35-
selector: '*[data-id="treeViewDivtreeViewItem.deps/npm/@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol"]',
36-
timeout: 120000,
37-
suppressNotFoundErrors: true
38-
})
39-
.clickLaunchIcon('solidity')
40-
.click('[data-id="compilerContainerCompileBtn"]')
41-
.clickLaunchIcon('filePanel')
42-
.isVisible({
43-
selector: '*[data-id="treeViewDivtreeViewItem.deps/npm/@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol"]',
44-
timeout: 120000,
45-
suppressNotFoundErrors: true
46-
})
47-
.clickLaunchIcon('solidity')
48-
.click('[data-id="compilerContainerCompileBtn"]')
49-
.clickLaunchIcon('filePanel')
50-
.waitForElementVisible({
51-
selector: '*[data-id="treeViewDivtreeViewItem.deps/npm/@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol"]',
52-
timeout: 120000,
53-
})
5432
.clickLaunchIcon('solidity')
5533
.waitForElementPresent('select[id="compiledContracts"] option[value=MyToken]', 60000)
5634
.clickLaunchIcon('udapp')

apps/remix-ide-e2e/src/tests/runAndDeploy.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,8 @@ module.exports = {
169169
.waitForElementVisible('*[data-id="treeViewLitreeViewItemscripts/deploy_with_web3.ts"]')
170170
.openFile('scripts/deploy_with_web3.ts')
171171
.click('[data-id="play-editor"]')
172+
.waitForElementContainsText('*[data-id="terminalJournal"]', 'address:')
173+
.openFile('.states/vm-london/state.json')
172174
.waitForElementPresent('[data-id="treeViewDivDraggableItem.states/vm-london/state.json"]')
173175
.click('[data-id="treeViewDivDraggableItem.states/vm-london/state.json"]')
174176
.pause(1000)

apps/remix-ide-e2e/src/tests/solidityUnittests.test.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@ module.exports = {
3030
.clickLaunchIcon('filePanel')
3131
.addFile('simple_storage.sol', sources[0]['simple_storage.sol'])
3232
.addFile('ks2a.sol', sources[0]['ks2a.sol'])
33-
.waitForElementVisible('li[data-id="treeViewLitreeViewItem.deps/remix-tests/remix_tests.sol"]')
34-
.waitForElementVisible('li[data-id="treeViewLitreeViewItem.deps/remix-tests/remix_accounts.sol"]')
3533
.openFile('.deps/remix-tests/remix_tests.sol')
3634
// remix_test.sol should be opened in editor
3735
.getEditorValue((content) => browser.assert.ok(content.indexOf('library Assert {') !== -1))
@@ -48,6 +46,7 @@ module.exports = {
4846
.waitForElementPresent('*[data-id="testTabGenerateTestFile"]')
4947
.click('*[data-id="testTabGenerateTestFile"]')
5048
.clickLaunchIcon('filePanel')
49+
.openFile('tests/simple_storage_test.sol')
5150
.waitForElementPresent('*[data-path="default_workspace/tests/simple_storage_test.sol"]')
5251
.removeFile('tests/simple_storage_test.sol', 'default_workspace')
5352
},

0 commit comments

Comments
 (0)