Updated more tests

pull/1041/head
ioedeveloper 4 years ago
parent 7107ca92ca
commit aa4ccc3fa9
  1. 2
      .env
  2. 2
      apps/remix-ide-e2e/src/commands/openFile.ts
  3. 5
      apps/remix-ide-e2e/src/tests/ballot.test.ts
  4. 5
      apps/remix-ide-e2e/src/tests/ballot_0_4_11.spec.ts
  5. 5
      apps/remix-ide-e2e/src/tests/compiler_api.test.ts
  6. 5
      apps/remix-ide-e2e/src/tests/debugger.spec.ts
  7. 5
      apps/remix-ide-e2e/src/tests/defaultLayout.test.ts
  8. 21
      apps/remix-ide-e2e/src/tests/editor.spec.ts
  9. 15
      apps/remix-ide-e2e/src/tests/fileExplorer.test.ts
  10. 33
      apps/remix-ide-e2e/src/tests/fileManager_api.spec.ts
  11. 5
      apps/remix-ide-e2e/src/tests/generalSettings.test.ts
  12. 5
      apps/remix-ide-e2e/src/tests/gist.spec.ts
  13. 6
      apps/remix-ide-e2e/src/tests/libraryDeployment.test.ts
  14. 8
      package.json

@ -1,4 +1,4 @@
gist_token=<token>
gist_token=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
account_passphrase=<passphrase>
account_password=<password>
NODE_OPTIONS=--max-old-space-size=2048

@ -16,7 +16,7 @@ class OpenFile extends EventEmitter {
// click on fileExplorer can toggle it. We go through settings to be sure FE is open
function openFile (browser: NightwatchBrowser, name: string, done: VoidFunction) {
browser.clickLaunchIcon('settings').clickLaunchIcon('fileExplorers')
.waitForElementVisible('li[data-id="treeViewLitreeViewItem' + name + '"')
.waitForElementVisible('li[data-id="treeViewLitreeViewItem' + name + '"', 60000)
.click('li[data-id="treeViewLitreeViewItem' + name + '"')
.pause(2000)
.perform(() => {

@ -2,7 +2,6 @@
import { NightwatchBrowser } from 'nightwatch'
import init from '../helpers/init'
import sauce from './sauce'
import examples from '../examples/example-contracts'
const sources = [
@ -80,9 +79,7 @@ module.exports = {
.journalLastChildIncludes('Ballot.delegate(address)')
.journalLastChildIncludes('data: 0x5c1...a733c')
.end()
},
tearDown: sauce
}
}
const localsCheck = {

@ -2,7 +2,6 @@
import { NightwatchBrowser } from 'nightwatch'
import init from '../helpers/init'
import sauce from './sauce'
import examples from '../examples/example-contracts'
const sources = [
@ -90,9 +89,7 @@ module.exports = {
.journalLastChildIncludes('Ballot.delegate(address)')
.journalLastChildIncludes('data: 0x5c1...a733c')
.end()
},
tearDown: sauce
}
}
const ballotABI = `[

@ -2,7 +2,6 @@
import { NightwatchBrowser } from 'nightwatch'
import init from '../helpers/init'
import sauce from './sauce'
import examples from '../examples/example-contracts'
const sources = [
@ -58,9 +57,7 @@ module.exports = {
.clickLaunchIcon('solidity')
.waitForElementContainsText('*[data-id="compiledErrors"]', 'CompilerError: Stack too deep when compiling inline assembly: Variable headStart is 1 slot(s) too deep inside the stack.', 60000)
.end()
},
tearDown: sauce
}
}
const simpleContract = `pragma solidity >=0.4.22 <0.9.1;

@ -1,7 +1,6 @@
'use strict'
import { NightwatchBrowser } from 'nightwatch'
import init from '../helpers/init'
import sauce from './sauce'
module.exports = {
@ -209,9 +208,7 @@ module.exports = {
*/
.waitForElementContainsText('*[data-id="stepdetail"]', 'vm trace step:\n154', 60000)
.end()
},
tearDown: sauce
}
}
const sources = [

@ -1,7 +1,6 @@
'use strict'
import { NightwatchBrowser } from 'nightwatch'
import init from '../helpers/init'
import sauce from './sauce'
module.exports = {
before: function (browser: NightwatchBrowser, done: VoidFunction) {
@ -68,7 +67,5 @@ module.exports = {
.click('#homeItem')
.assert.containsText('div[title="home"]', 'Home')
.end()
},
tearDown: sauce
}
}

@ -2,7 +2,6 @@
import { NightwatchBrowser } from 'nightwatch'
import init from '../helpers/init'
import sauce from './sauce'
module.exports = {
@ -37,7 +36,7 @@ module.exports = {
.click('*[class="ace_content"]')
.sendKeys('*[class="ace_text-input"]', 'error')
.pause(2000)
.waitForElementVisible('.ace_error')
.waitForElementVisible('.ace_error', 60000)
.checkAnnotations('error', 28)
.clickLaunchIcon('udapp')
.checkAnnotationsNotPresent('error')
@ -93,11 +92,11 @@ module.exports = {
.openFile('sourcehighlight.js')
.executeScript('remix.exeCurrent()')
.editorScroll('down', 60)
.waitForElementPresent('.highlightLine32')
.waitForElementPresent('.highlightLine32', 60000)
.checkElementStyle('.highlightLine32', 'background-color', 'rgb(8, 108, 181)')
.waitForElementPresent('.highlightLine40')
.waitForElementPresent('.highlightLine40', 60000)
.checkElementStyle('.highlightLine40', 'background-color', 'rgb(8, 108, 181)')
.waitForElementPresent('.highlightLine50')
.waitForElementPresent('.highlightLine50', 60000)
.checkElementStyle('.highlightLine50', 'background-color', 'rgb(8, 108, 181)')
},
@ -110,7 +109,7 @@ module.exports = {
.click('li[data-id="treeViewLitreeViewItemcontracts"]')
.waitForElementVisible('li[data-id="treeViewLitreeViewItemcontracts/3_Ballot.sol"]')
.click('li[data-id="treeViewLitreeViewItemcontracts/3_Ballot.sol"]')
.waitForElementNotPresent('.highlightLine32')
.waitForElementNotPresent('.highlightLine32', 60000)
.checkElementStyle('.highlightLine40', 'background-color', 'rgb(8, 108, 181)')
.checkElementStyle('.highlightLine50', 'background-color', 'rgb(8, 108, 181)')
},
@ -123,13 +122,11 @@ module.exports = {
.waitForElementVisible('li[data-id="treeViewLitreeViewItemcontracts/3_Ballot.sol"]')
.click('li[data-id="treeViewLitreeViewItemcontracts/3_Ballot.sol"]')
.pause(2000)
.waitForElementNotPresent('.highlightLine32')
.waitForElementNotPresent('.highlightLine40')
.waitForElementNotPresent('.highlightLine50')
.waitForElementNotPresent('.highlightLine32', 60000)
.waitForElementNotPresent('.highlightLine40', 60000)
.waitForElementNotPresent('.highlightLine50', 60000)
.end()
},
tearDown: sauce
}
}
const aceThemes = {

@ -1,11 +1,10 @@
'use strict'
import { NightwatchBrowser } from 'nightwatch'
import init from '../helpers/init'
import sauce from './sauce'
import * as path from 'path'
const testData = {
testFile1: path.resolve(__dirname + '/editor.test.js'), // eslint-disable-line
testFile1: path.resolve(__dirname + '/editor.spec.js'), // eslint-disable-line
testFile2: path.resolve(__dirname + '/fileExplorer.test.js'), // eslint-disable-line
testFile3: path.resolve(__dirname + '/generalSettings.test.js') // eslint-disable-line
}
@ -69,7 +68,7 @@ module.exports = {
.waitForElementVisible('*[data-id="treeViewLitreeViewItemBrowser_E2E_Tests"]')
.rightClick('[data-path="Browser_E2E_Tests"]')
.click('*[id="menuitemdelete"]')
.waitForElementVisible('*[data-id="default_workspaceModalDialogContainer-react"]')
.waitForElementVisible('*[data-id="default_workspaceModalDialogContainer-react"]', 60000)
.pause(2000)
.click('*[data-id="default_workspaceModalDialogContainer-react"] .modal-ok')
.waitForElementNotPresent('*[data-id="treeViewLitreeViewItemBrowser_E2E_Tests"]')
@ -82,11 +81,11 @@ module.exports = {
.pause(10000)
.waitForElementVisible('*[data-id="fileExplorerNewFilepublishToGist"]')
.click('*[data-id="fileExplorerNewFilepublishToGist"]')
.waitForElementVisible('*[data-id="default_workspaceModalDialogContainer-react"]')
.waitForElementVisible('*[data-id="default_workspaceModalDialogContainer-react"]', 60000)
.pause(2000)
.click('*[data-id="default_workspaceModalDialogContainer-react"] .modal-ok')
.pause(2000)
.waitForElementVisible('*[data-id="default_workspaceModalDialogContainer-react"]')
.waitForElementVisible('*[data-id="default_workspaceModalDialogContainer-react"]', 60000)
.pause(2000)
.click('*[data-id="default_workspaceModalDialogContainer-react"] .modal-ok')
.pause(2000)
@ -105,11 +104,9 @@ module.exports = {
.setValue('*[data-id="fileExplorerFileUpload"]', testData.testFile1)
.setValue('*[data-id="fileExplorerFileUpload"]', testData.testFile2)
.setValue('*[data-id="fileExplorerFileUpload"]', testData.testFile3)
.waitForElementVisible('[data-id="treeViewLitreeViewItemeditor.test.js"]')
.waitForElementVisible('[data-id="treeViewLitreeViewItemeditor.spec.js"]')
.waitForElementVisible('[data-id="treeViewLitreeViewItemfileExplorer.test.js"]')
.waitForElementVisible('[data-id="treeViewLitreeViewItemgeneralSettings.test.js"]')
.end()
},
tearDown: sauce
}
}

@ -1,7 +1,6 @@
'use strict'
import { NightwatchBrowser } from 'nightwatch'
import init from '../helpers/init'
import sauce from './sauce'
module.exports = {
before: function (browser: NightwatchBrowser, done: VoidFunction) {
@ -12,25 +11,22 @@ module.exports = {
browser
.addFile('file.js', { content: executeFile })
.executeScript('remix.exeCurrent()')
.pause(5000)
.journalLastChildIncludes('file.js')
.waitForElementContainsText('*[data-id="terminalJournal"]', 'file.js', 60000)
},
'Should execute `exists` api from file manager external api': function (browser: NightwatchBrowser) {
browser
.addFile('exists.js', { content: executeExists })
.executeScript('remix.exeCurrent()')
.pause(2000)
.journalChildIncludes('exists.js true')
.journalChildIncludes('non-exists.js false')
.waitForElementContainsText('*[data-id="terminalJournal"]', 'exists.js true', 60000)
.waitForElementContainsText('*[data-id="terminalJournal"]', 'non-exists.js false', 60000)
},
'Should execute `open` api from file manager external api': function (browser: NightwatchBrowser) {
browser
.addFile('open.js', { content: executeOpen })
.executeScript('remix.exeCurrent()')
.pause(2000)
.journalLastChildIncludes('contracts/3_Ballot.sol')
.waitForElementContainsText('*[data-id="terminalJournal"]', 'contracts/3_Ballot.sol', 60000)
},
'Should execute `writeFile` api from file manager external api': function (browser: NightwatchBrowser) {
@ -46,16 +42,14 @@ module.exports = {
browser
.addFile('readFile.js', { content: executeReadFile })
.executeScript('remix.exeCurrent()')
.pause(2000)
.journalLastChildIncludes('pragma solidity ^0.6.0')
.waitForElementContainsText('*[data-id="terminalJournal"]', 'pragma solidity ^0.6.0', 60000)
},
'Should execute `copyFile` api from file manager external api': function (browser: NightwatchBrowser) {
browser
.addFile('copyFile.js', { content: executeCopyFile })
.executeScript('remix.exeCurrent()')
.pause(2000)
.journalLastChildIncludes('pragma solidity >=0.7.0 <0.9.0;')
.waitForElementContainsText('*[data-id="terminalJournal"]', 'pragma solidity >=0.7.0 <0.9.0;', 60000)
},
'Should execute `rename` api from file manager external api': function (browser: NightwatchBrowser) {
@ -63,7 +57,7 @@ module.exports = {
.addFile('renameFile.js', { content: executeRename })
.executeScript('remix.exeCurrent()')
.pause(2000)
.waitForElementPresent('[data-id="treeViewLitreeViewItemold_contract.sol"]')
.waitForElementPresent('[data-id="treeViewLitreeViewItemold_contract.sol"]', 60000)
},
'Should execute `mkdir` api from file manager external api': function (browser: NightwatchBrowser) {
@ -71,15 +65,14 @@ module.exports = {
.addFile('mkdirFile.js', { content: executeMkdir })
.executeScript('remix.exeCurrent()')
.pause(2000)
.waitForElementPresent('[data-id="treeViewLitreeViewItemTest_Folder"]')
.waitForElementPresent('[data-id="treeViewLitreeViewItemTest_Folder"]', 60000)
},
'Should execute `readdir` api from file manager external api': function (browser: NightwatchBrowser) {
browser
.addFile('readdirFile.js', { content: executeReaddir })
.executeScript('remix.exeCurrent()')
.pause(2000)
.journalLastChildIncludes('Test_Folder isDirectory true')
.waitForElementContainsText('*[data-id="terminalJournal"]', 'Test_Folder isDirectory true', 60000)
},
'Should execute `remove` api from file manager external api': function (browser: NightwatchBrowser) {
@ -87,7 +80,7 @@ module.exports = {
.addFile('removeFile.js', { content: executeRemove })
.executeScript('remix.exeCurrent()')
.pause(2000)
.waitForElementNotPresent('[data-id="treeViewLitreeViewItemold_contract.sol"]')
.waitForElementNotPresent('[data-id="treeViewLitreeViewItemold_contract.sol"]', 60000)
},
// TODO: Fix remove root directory prefix for browser and localhost
@ -96,11 +89,9 @@ module.exports = {
.addFile('test_jsRemoveFolder.js', { content: executeRemoveOnFolder })
.executeScript('remix.exeCurrent()')
.pause(2000)
.waitForElementNotPresent('[data-id="treeViewLitreeViewItemTest_Folder"]')
.waitForElementNotPresent('[data-id="treeViewLitreeViewItemTest_Folder"]', 60000)
.end()
},
tearDown: sauce
}
}
const executeFile = `

@ -1,7 +1,6 @@
'use strict'
import { NightwatchBrowser } from 'nightwatch'
import init from '../helpers/init'
import sauce from './sauce'
module.exports = {
before: function (browser: NightwatchBrowser, done: VoidFunction) {
@ -129,9 +128,7 @@ module.exports = {
.checkElementStyle(':root', '--info', remixIdeThemes.cyborg.info)
.checkElementStyle(':root', '--warning', remixIdeThemes.cyborg.warning)
.checkElementStyle(':root', '--danger', remixIdeThemes.cyborg.danger)
},
tearDown: sauce
}
}
const remixIdeThemes = {

@ -1,7 +1,6 @@
'use strict'
import { NightwatchBrowser } from 'nightwatch'
import init from '../helpers/init'
import sauce from './sauce'
const testData = {
validGistId: '1859c97c6e1efc91047d725d5225888e',
@ -123,7 +122,5 @@ module.exports = {
.waitForElementVisible(`div[title='default_workspace/${testData.validGistId}/ApplicationRegistry']`)
.assert.containsText(`div[title='default_workspace/${testData.validGistId}/ApplicationRegistry'] > span`, 'ApplicationRegistry')
.end()
},
tearDown: sauce
}
}

@ -1,7 +1,6 @@
'use strict'
import { NightwatchBrowser } from 'nightwatch'
import init from '../helpers/init'
import sauce from './sauce'
module.exports = {
before: function (browser: NightwatchBrowser, done: VoidFunction) {
@ -45,6 +44,7 @@ module.exports = {
.click('*[data-id="settingsTabGenerateContractMetadataLabel"]')
.clickLaunchIcon('solidity')
.click('#compileTabView button[title="Compile"]') // that should generate the JSON artefact
.clickLaunchIcon('udapp')
.verifyContracts(['test'])
.clickLaunchIcon('udapp')
.selectContract('lib') // deploy lib
@ -60,9 +60,7 @@ module.exports = {
})
})
.end()
},
tearDown: sauce
}
}
function checkDeployShouldFail (browser: NightwatchBrowser, callback: VoidFunction) {

@ -59,7 +59,7 @@
"nightwatch_local_ballot": "npm run build:e2e && nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js dist/apps/remix-ide-e2e/src/tests/ballot.test.js --env=chrome",
"nightwatch_local_ballot_0_4_11": "npm run build:e2e && nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js dist/apps/remix-ide-e2e/src/tests/ballot_0_4_11.spec.js --env=chrome",
"nightwatch_local_usingWorker": "npm run build:e2e && nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js dist/apps/remix-ide-e2e/src/tests/usingWebWorker.test.js --env=chrome",
"nightwatch_local_libraryDeployment": "npm run build:e2e && nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js dist/apps/remix-ide-e2e/src/tests/libraryDeployment.test.js --env=chrome",
"nightwatch_local_libraryDeployment": "npm run build:e2e && nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js dist/apps/remix-ide-e2e/src/tests/libraryDeployment.test.js --env=firefox",
"nightwatch_local_solidityImport": "npm run build:e2e && nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js dist/apps/remix-ide-e2e/src/tests/solidityImport.test.js --env=chrome",
"nightwatch_local_recorder": "npm run build:e2e && nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js dist/apps/remix-ide-e2e/src/tests/recorder.test.js --env=chrome",
"nightwatch_local_transactionExecution": "npm run build:e2e && nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js dist/apps/remix-ide-e2e/src/tests/transactionExecution.test.js --env=chrome",
@ -69,7 +69,7 @@
"nightwatch_local_solidityUnitTests": "npm run build:e2e && nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js dist/apps/remix-ide-e2e/src/tests/solidityUnittests.test.js --env=chrome",
"nightwatch_local_remixd": "npm run build:e2e && nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js dist/apps/remix-ide-e2e/src/tests/remixd.test.js --env=chrome",
"nightwatch_local_terminal": "npm run build:e2e && nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js dist/apps/remix-ide-e2e/src/tests/terminal.test.js --env=chrome",
"nightwatch_local_gist": "npm run build:e2e && nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js dist/apps/remix-ide-e2e/src/tests/gist.test.js --env=chrome",
"nightwatch_local_gist": "npm run build:e2e && nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js dist/apps/remix-ide-e2e/src/tests/gist.spec.js --env=firefox",
"nightwatch_local_workspace": "npm run build:e2e && nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js dist/apps/remix-ide-e2e/src/tests/workspace.test.js --env=chrome",
"nightwatch_local_defaultLayout": "npm run build:e2e && nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js dist/apps/remix-ide-e2e/src/tests/defaultLayout.test.js --env=chrome",
"nightwatch_local_pluginManager": "npm run build:e2e && nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js dist/apps/remix-ide-e2e/src/tests/pluginManager.test.js --env=chrome",
@ -77,10 +77,10 @@
"nightwatch_local_generalSettings": "npm run build:e2e && nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js dist/apps/remix-ide-e2e/src/tests/generalSettings.test.js --env=chrome",
"nightwatch_local_fileExplorer": "npm run build:e2e && nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js dist/apps/remix-ide-e2e/src/tests/fileExplorer.test.js --env=chrome",
"nightwatch_local_debugger": "npm run build:e2e && nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js dist/apps/remix-ide-e2e/src/tests/debugger.spec.js --env=chrome",
"nightwatch_local_editor": "npm run build:e2e && nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js dist/apps/remix-ide-e2e/src/tests/editor.test.js --env=chrome",
"nightwatch_local_editor": "npm run build:e2e && nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js dist/apps/remix-ide-e2e/src/tests/editor.spec.js --env=chrome",
"nightwatch_local_compiler": "npm run build:e2e && nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js dist/apps/remix-ide-e2e/src/tests/compiler_api.test.js --env=chrome",
"nightwatch_local_txListener": "npm run build:e2e && nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js dist/apps/remix-ide-e2e/src/tests/txListener.test.js --env=chrome",
"nightwatch_local_fileManager": "npm run build:e2e && nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js dist/apps/remix-ide-e2e/src/tests/fileManager_api.test.js --env=chrome",
"nightwatch_local_fileManager": "npm run build:e2e && nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js dist/apps/remix-ide-e2e/src/tests/fileManager_api.spec.js --env=chrome",
"nightwatch_local_runAndDeploy": "npm run build:e2e && nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js dist/apps/remix-ide-e2e/src/tests/runAndDeploy.js --env=chrome-runAndDeploy",
"nightwatch_local_url": "npm run build:e2e && nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js dist/apps/remix-ide-e2e/src/tests/url.test.js --env=chrome",
"nightwatch_local_verticalIconscontextmenu": "npm run build:e2e && nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js dist/apps/remix-ide-e2e/src/tests/verticalIconsPanel.test.js --env=chrome",

Loading…
Cancel
Save