Update file-explorer tests

pull/668/head
ioedeveloper 4 years ago
parent dc8d5602fa
commit 8d386b9d68
  1. 2
      .env
  2. 2
      apps/remix-ide-e2e/src/commands/clearEditableContent.ts
  3. 13
      apps/remix-ide-e2e/src/commands/renamePath.ts
  4. 62
      apps/remix-ide-e2e/src/tests/fileExplorer.test.ts
  5. 2
      apps/remix-ide-e2e/src/types/index.d.ts
  6. 2
      package.json

@ -1,4 +1,4 @@
gist_token=ef5df4e3822bf121f1aee4616ea110309e2d49f5
gist_token=51c492cff9ccd5b819b79ddf5ecd275c725d0d9e
account_passphrase=explain uniform adapt basic blue onion rebel pull rice erase volcano couple
account_password=remix_is_cool
NODE_OPTIONS=--max-old-space-size=2048

@ -22,7 +22,7 @@ function clearContent (browser: NightwatchBrowser, cssSelector: string, callback
selection.removeAllRanges()
selection.addRange(range)
}, [cssSelector], function () {
browser.sendKeys(cssSelector, browser.Keys.BACK_SPACE)
browser.keys(browser.Keys.BACK_SPACE)
.pause(5000)
callback()
})

@ -1,10 +1,10 @@
import EventEmitter from 'events'
import { NightwatchBrowser } from 'nightwatch'
class RenameFile extends EventEmitter {
class RenamePath extends EventEmitter {
command (this: NightwatchBrowser, path: string, newFileName: string, renamedPath: string) {
this.api.perform((done) => {
renameFile(this.api, path, newFileName, renamedPath, () => {
renamePath(this.api, path, newFileName, renamedPath, () => {
done()
this.emit('complete')
})
@ -13,7 +13,7 @@ class RenameFile extends EventEmitter {
}
}
function renameFile (browser: NightwatchBrowser, path: string, newFileName: string, renamedPath: string, done: VoidFunction) {
function renamePath (browser: NightwatchBrowser, path: string, newFileName: string, renamedPath: string, done: VoidFunction) {
browser.execute(function (path: string) {
function contextMenuClick (element) {
const evt = element.ownerDocument.createEvent('MouseEvents')
@ -41,10 +41,9 @@ function renameFile (browser: NightwatchBrowser, path: string, newFileName: stri
doneSetValue()
})
})
.click('body') // blur
.waitForElementVisible('#modal-footer-ok', 100000)
.pause(1000)
.keys(browser.Keys.ENTER)
.pause(2000)
.click('#modal-footer-ok')
.waitForElementNotPresent('[data-path="' + path + '"]')
.waitForElementPresent('[data-path="' + renamedPath + '"]')
.perform(() => {
@ -53,4 +52,4 @@ function renameFile (browser: NightwatchBrowser, path: string, newFileName: stri
})
}
module.exports = RenameFile
module.exports = RenamePath

@ -21,70 +21,72 @@ module.exports = {
.clickLaunchIcon('fileExplorers')
.assert.containsText('h6[data-id="sidePanelSwapitTitle"]', 'FILE EXPLORERS')
.click('*[data-id="fileExplorerNewFilecreateNewFile"]')
.waitForElementVisible('*[data-id="modalDialogContainer"]')
.setValue('*[data-id="modalDialogCustomPromptText"]', '5_New_contract.sol')
.modalFooterOKClick()
.waitForElementVisible('*[data-id="treeViewLibrowser/5_New_contract.sol"]', 7000)
.pause(1000)
.keys('5_New_contract.sol')
.keys(browser.Keys.ENTER)
.waitForElementVisible('*[data-id="treeViewLitreeViewItembrowser/5_New_contract.sol"]', 7000)
},
'Should rename `5_New_contract.sol` to 5_Renamed_Contract.sol': function (browser: NightwatchBrowser) {
browser
.waitForElementVisible('*[data-id="treeViewLibrowser/5_New_contract.sol"]')
.renameFile('browser/5_New_contract.sol', '5_Renamed_Contract.sol', 'browser/5_Renamed_Contract.sol')
.waitForElementVisible('*[data-id="treeViewLibrowser/5_Renamed_Contract.sol"]')
.waitForElementVisible('*[data-id="treeViewLitreeViewItembrowser/5_New_contract.sol"]')
.renamePath('browser/5_New_contract.sol', '5_Renamed_Contract.sol', 'browser/5_Renamed_Contract.sol')
.waitForElementVisible('*[data-id="treeViewLitreeViewItembrowser/5_Renamed_Contract.sol"]')
},
'Should delete file `5_Renamed_Contract.sol` from file explorer': function (browser: NightwatchBrowser) {
browser
.waitForElementVisible('*[data-id="treeViewLibrowser/5_Renamed_Contract.sol"]')
.waitForElementVisible('*[data-id="treeViewLitreeViewItembrowser/5_Renamed_Contract.sol"]')
.rightClick('[data-path="browser/5_Renamed_Contract.sol"]')
.click('*[id="menuitemdelete"]')
.waitForElementVisible('*[data-id="modalDialogContainer"]')
.modalFooterOKClick()
.waitForElementNotPresent('*[data-id="treeViewLibrowser/5_Renamed_Contract.sol"')
.pause(2000)
.click('.modal-ok')
.waitForElementNotPresent('*[data-id="treeViewLitreeViewItembrowser/5_Renamed_Contract.sol"')
},
'Should create a new folder': function (browser: NightwatchBrowser) {
browser
.waitForElementVisible('*[data-id="treeViewLibrowser/README.txt"]')
.rightClick('[data-path="browser/README.txt"]')
.click('*[id="menuitemcreate folder"]')
.waitForElementVisible('*[data-id="modalDialogContainer"]')
.setValue('*[data-id="modalDialogCustomPromptText"]', 'Browser_Tests')
.modalFooterOKClick()
.waitForElementVisible('*[data-id="treeViewLibrowser/Browser_Tests"]')
.waitForElementVisible('*[data-id="treeViewLitreeViewItembrowser/README.txt"]')
.click('[data-id="fileExplorerNewFilecreateNewFolder"]')
.pause(1000)
.keys('Browser_Tests')
.keys(browser.Keys.ENTER)
.waitForElementVisible('*[data-id="treeViewLitreeViewItembrowser/Browser_Tests"]')
},
'Should rename Browser_Tests folder to Browser_E2E_Tests': function (browser: NightwatchBrowser) {
browser
.waitForElementVisible('*[data-id="treeViewLibrowser/Browser_Tests"]')
.rightClick('[data-path="browser/Browser_Tests"]')
.click('*[id="menuitemrename"]')
.sendKeys('[data-path="browser/Browser_Tests"]', 'Browser_E2E_Tests')
.sendKeys('[data-path="browser/Browser_Tests"]', browser.Keys.ENTER)
.waitForElementVisible('*[data-id="treeViewLibrowser/Browser_E2E_Tests"]')
.waitForElementVisible('*[data-id="treeViewLitreeViewItembrowser/Browser_Tests"]')
.renamePath('browser/Browser_Tests', 'Browser_E2E_Tests', 'browser/Browser_E2E_Tests')
.waitForElementVisible('*[data-id="treeViewLitreeViewItembrowser/Browser_E2E_Tests"]')
},
'Should delete Browser_E2E_Tests folder': function (browser: NightwatchBrowser) {
browser
.waitForElementVisible('*[data-id="treeViewLibrowser/Browser_E2E_Tests"]')
.waitForElementVisible('*[data-id="treeViewLitreeViewItembrowser/Browser_E2E_Tests"]')
.rightClick('[data-path="browser/Browser_E2E_Tests"]')
.click('*[id="menuitemdelete"]')
.waitForElementVisible('*[data-id="modalDialogContainer"]')
.modalFooterOKClick()
.waitForElementNotPresent('*[data-id="treeViewLibrowser/Browser_E2E_Tests"]')
.pause(2000)
.click('.modal-ok')
.waitForElementNotPresent('*[data-id="treeViewLitreeViewItembrowser/Browser_E2E_Tests"]')
},
'Should publish all explorer files to github gist': function (browser: NightwatchBrowser) {
const runtimeBrowser = browser.options.desiredCapabilities.browserName
browser
browser.refresh()
.pause(10000)
.waitForElementVisible('*[data-id="fileExplorerNewFilepublishToGist"]')
.click('*[data-id="fileExplorerNewFilepublishToGist"]')
.waitForElementVisible('*[data-id="modalDialogContainer"]')
.modalFooterOKClick()
.waitForElementVisible('*[data-id="modalDialogContainer"]', 7000)
.modalFooterOKClick()
.pause(2000)
.click('.modal-ok')
.pause(2000)
.waitForElementVisible('*[data-id="modalDialogContainer"]')
.pause(2000)
.click('.modal-ok')
.pause(2000)
.perform((done) => {
if (runtimeBrowser === 'chrome') {

@ -28,7 +28,7 @@ declare module "nightwatch" {
checkElementStyle(cssSelector: string, styleProperty: string, expectedResult: string): NightwatchBrowser,
openFile(name: string): NightwatchBrowser,
editorScroll(direction: 'up' | 'down', numberOfTimes: number): NightwatchBrowser,
renameFile(path: string, newFileName: string, renamedPath: string): NightwatchBrowser,
renamePath(path: string, newFileName: string, renamedPath: string): NightwatchBrowser,
rightClick(cssSelector: string): NightwatchBrowser,
waitForElementContainsText(id: string, value: string): NightwatchBrowser,
getModalBody(callback: (value: string, cb: VoidFunction) => void): NightwatchBrowser,

@ -79,7 +79,7 @@
"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_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.test.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",
"onchange": "onchange apps/remix-ide/build/app.js -- npm-run-all lint",

Loading…
Cancel
Save