Modify addFile command

pull/668/head
ioedeveloper 4 years ago
parent 2600fd00c6
commit e54320442e
  1. 22
      apps/remix-ide-e2e/src/commands/addFile.ts
  2. 2
      apps/remix-ide-e2e/src/tests/debugger.test.ts
  3. 2
      apps/remix-ide-e2e/src/tests/editor.test.ts
  4. 1
      apps/remix-ide-e2e/src/tests/fileManager_api.test.ts
  5. 2
      apps/remix-ide-e2e/src/tests/gist.test.ts
  6. 2
      apps/remix-ide-e2e/src/tests/solidityImport.test.ts
  7. 10
      apps/remix-ide-e2e/src/tests/solidityUnittests.test.ts
  8. 2
      apps/remix-ide-e2e/src/tests/terminal.test.ts
  9. 2
      apps/remix-ide-e2e/src/tests/usingWebWorker.test.ts
  10. 2
      apps/remix-ide-e2e/src/types/index.d.ts

@ -2,9 +2,9 @@ import { NightwatchBrowser, NightwatchContractContent } from 'nightwatch'
import EventEmitter from "events"
class AddFile extends EventEmitter {
command (this: NightwatchBrowser, name: string, content: NightwatchContractContent, open = true): NightwatchBrowser {
command (this: NightwatchBrowser, name: string, content: NightwatchContractContent): NightwatchBrowser {
this.api.perform((done) => {
addFile(this.api, name, content, open, () => {
addFile(this.api, name, content, () => {
done()
this.emit('complete')
})
@ -13,18 +13,18 @@ class AddFile extends EventEmitter {
}
}
function addFile (browser: NightwatchBrowser, name: string, content: NightwatchContractContent, open: boolean, done: VoidFunction) {
browser.clickLaunchIcon('udapp').clickLaunchIcon('fileExplorers').click('.newFile')
function addFile (browser: NightwatchBrowser, name: string, content: NightwatchContractContent, done: VoidFunction) {
browser.clickLaunchIcon('udapp')
.clickLaunchIcon('fileExplorers')
.click('li[data-id="treeViewLitreeViewItembrowser/README.txt"]') // focus on root directory
.click('.newFile')
.pause(2000)
.keys(name)
.keys(browser.Keys.ENTER)
.perform((done) => {
if (open) {
browser.openFile('browser/' + name)
.setEditorValue(content.content)
}
done()
})
.pause(2000)
.waitForElementVisible(`li[data-id="treeViewLitreeViewItembrowser/${name}"]`)
.click(`li[data-id="treeViewLitreeViewItembrowser/${name}"]`)
.setEditorValue(content.content)
.pause(1000)
.perform(function () {
done()

@ -186,8 +186,6 @@ module.exports = {
'Should call the debugger api: getTrace': function (browser: NightwatchBrowser) {
browser
.clickLaunchIcon('fileExplorers')
.click('li[data-id="treeViewLitreeViewItembrowser/externalImport.sol"')
.addFile('test_jsGetTrace.js', { content: jsGetTrace })
.executeScript('remix.exeCurrent()')
.pause(3000)

@ -81,8 +81,6 @@ module.exports = {
'Should highlight source code': function (browser: NightwatchBrowser) {
// include all files here because switching between plugins in side-panel removes highlight
browser
.clickLaunchIcon('fileExplorers')
.click('li[data-id="treeViewLitreeViewItembrowser/README.txt"')
.addFile('sourcehighlight.js', sourcehighlightScript)
.addFile('removeSourcehighlightScript.js', removeSourcehighlightScript)
.addFile('removeAllSourcehighlightScript.js', removeAllSourcehighlightScript)

@ -76,7 +76,6 @@ module.exports = {
'Should execute `readdir` api from file manager external api': function (browser: NightwatchBrowser) {
browser
.click('li[data-id="treeViewLitreeViewItembrowser/README.txt"')
.addFile('readdirFile.js', { content: executeReaddir })
.executeScript(`remix.exeCurrent()`)
.pause(2000)

@ -32,7 +32,7 @@ module.exports = {
.keys('Browser_Tests')
.keys(browser.Keys.ENTER)
.waitForElementVisible('*[data-id="treeViewLitreeViewItembrowser/Browser_Tests"]')
.addFile('File.sol', { content: '' }, false)
.addFile('File.sol', { content: '' })
.click('*[data-id="fileExplorerNewFilepublishToGist"]')
.waitForElementVisible('*[data-id="browserModalDialogContainer-react"]')
.pause(2000)

@ -40,8 +40,6 @@ module.exports = {
'Test Github Import - from other branch': function (browser: NightwatchBrowser) {
browser
.setSolidityCompilerVersion('soljson-v0.5.0+commit.1d4f565a.js') // switch back to 0.5.0 : release-v2.3.0 branch is not solidity 0.6 compliant
.clickLaunchIcon('fileExplorers')
.click('li[data-id="treeViewLitreeViewItembrowser/README.txt"')
.addFile('Untitled5.sol', sources[4]['browser/Untitled5.sol'])
.clickLaunchIcon('fileExplorers')
.verifyContracts(['test8', 'ERC20', 'SafeMath'], {wait: 10000})

@ -42,7 +42,7 @@ module.exports = {
'Should run simple unit test `simple_storage_test.sol` ': function (browser: NightwatchBrowser) {
browser.waitForElementPresent('*[data-id="verticalIconsKindfileExplorers"]')
.addFile('simple_storage_test.sol', sources[0]['browser/tests/simple_storage_test.sol'], false)
.addFile('tests/simple_storage_test.sol', sources[0]['browser/tests/simple_storage_test.sol'])
.click('*[data-id="verticalIconsKindsolidityUnitTesting"]')
.waitForElementPresent('*[data-id="testTabCheckAllTests"]')
.click('*[data-id="testTabCheckAllTests"]')
@ -62,7 +62,7 @@ module.exports = {
'Should run advance unit test using natspec and experimental ABIEncoderV2 `ks2b_test.sol` ': function (browser: NightwatchBrowser) {
browser.waitForElementPresent('*[data-id="verticalIconsKindfileExplorers"]')
.clickLaunchIcon('fileExplorers')
.addFile('ks2b_test.sol', sources[0]['browser/tests/ks2b_test.sol'], false)
.addFile('tests/ks2b_test.sol', sources[0]['browser/tests/ks2b_test.sol'])
.click('*[data-id="verticalIconsKindsolidityUnitTesting"]')
.waitForElementPresent('*[data-id="testTabCheckAllTests"]')
.click('*[data-id="testTabCheckAllTests"]')
@ -117,7 +117,7 @@ module.exports = {
'Should fail on deploy': function (browser: NightwatchBrowser) {
browser.waitForElementPresent('*[data-id="verticalIconsKindfileExplorers"]')
.addFile('deployError_test.sol', sources[0]['browser/tests/deployError_test.sol'])
.addFile('tests/deployError_test.sol', sources[0]['browser/tests/deployError_test.sol'])
.clickLaunchIcon('fileExplorers')
.openFile('browser/tests/deployError_test.sol')
.clickLaunchIcon('solidityUnitTesting')
@ -131,7 +131,7 @@ module.exports = {
'Should fail when parameters are to method in test contract': function (browser: NightwatchBrowser) {
browser.waitForElementPresent('*[data-id="verticalIconsKindfileExplorers"]')
.addFile('methodFailure_test.sol', sources[0]['browser/tests/methodFailure_test.sol'])
.addFile('tests/methodFailure_test.sol', sources[0]['browser/tests/methodFailure_test.sol'])
.clickLaunchIcon('fileExplorers')
.openFile('browser/tests/methodFailure_test.sol')
.clickLaunchIcon('solidityUnitTesting')
@ -145,8 +145,6 @@ module.exports = {
'Changing current path': function (browser: NightwatchBrowser) {
browser
.clickLaunchIcon('fileExplorers')
.click('li[data-id="treeViewLitreeViewItembrowser/README.txt"')
.waitForElementPresent('*[data-id="verticalIconsKindfileExplorers"]')
.addFile('myTests/simple_storage_test.sol', sources[0]['browser/tests/simple_storage_test.sol'])
.clickLaunchIcon('solidityUnitTesting')

@ -98,7 +98,6 @@ module.exports = {
'Call Remix File Resolver (internal URL) from a script': function (browser: NightwatchBrowser) {
browser
.click('*[data-id="terminalClearConsole"]') // clear the terminal
.click('li[data-id="treeViewLitreeViewItembrowser/resolveExternalUrlAndSave.js"')
.addFile('resolveUrl.js', { content: resolveUrl })
.openFile('browser/resolveUrl.js')
.pause(1000)
@ -110,7 +109,6 @@ module.exports = {
'Call Remix File Resolver (internal URL) from a script and specify a path': function (browser: NightwatchBrowser) {
browser
.click('*[data-id="terminalClearConsole"]') // clear the terminal
.click('li[data-id="treeViewLitreeViewItembrowser/resolveUrl.js"')
.addFile('resolveExternalUrlAndSaveToaPath.js', { content: resolveExternalUrlAndSaveToaPath })
.openFile('browser/resolveExternalUrlAndSaveToaPath.js')
.pause(1000)

@ -28,7 +28,7 @@ module.exports = {
browser
.waitForElementVisible('*[data-id="remixIdeIconPanel"]', 10000)
.clickLaunchIcon('fileExplorers')
.addFile('browser/basic.sol', sources[0]['browser/basic.sol'])
.addFile('basic.sol', sources[0]['browser/basic.sol'])
.clickLaunchIcon('solidity')
.execute(function() {
const elem = document.getElementById('nightlies') as HTMLInputElement

@ -10,7 +10,7 @@ declare module "nightwatch" {
scrollInto(target: string): NightwatchBrowser,
testContracts(fileName: string, contractCode: NightwatchContractContent, compiledContractNames: string[]): NightwatchBrowser,
setEditorValue(value: string, callback?: () => void): NightwatchBrowser,
addFile(name: string, content: NightwatchContractContent, open?: boolean): NightwatchBrowser,
addFile(name: string, content: NightwatchContractContent): NightwatchBrowser,
verifyContracts(compiledContractNames: string[], opts?: { wait: number, version?: string }): NightwatchBrowser,
selectAccount(account?: string): NightwatchBrowser,
clickFunction(fnFullName: string, expectedInput?: NightwatchClickFunctionExpectedInput): NightwatchBrowser,

Loading…
Cancel
Save