Upgraded nightwatch and fixed breaking changes

pull/2/head
ioedeveloper 5 years ago
parent 4f26a73584
commit 7d0d8bfe33
  1. 3
      .env
  2. 2
      apps/remix-ide/package.json
  3. 6
      apps/remix-ide/src/app/ui/multiParamManager.js
  4. 30
      apps/remix-ide/test-browser/commands/clearEditableContent.js
  5. 11
      apps/remix-ide/test-browser/commands/createContract.js
  6. 2
      apps/remix-ide/test-browser/commands/executeScript.js
  7. 27
      apps/remix-ide/test-browser/commands/getInstalledPlugins.js
  8. 2
      apps/remix-ide/test-browser/commands/journalChildIncludes.js
  9. 2
      apps/remix-ide/test-browser/commands/switchBrowserTab.js
  10. 2
      apps/remix-ide/test-browser/commands/testContracts.js
  11. 6
      apps/remix-ide/test-browser/helpers/init.js
  12. 3
      apps/remix-ide/test-browser/tests/generalSettings.test.js
  13. 4
      apps/remix-ide/test-browser/tests/runAndDeploy.js
  14. 2
      apps/remix-ide/test-browser/tests/sauce.js
  15. 1053
      package-lock.json
  16. 8
      package.json

@ -1 +1,4 @@
NODE_OPTIONS=--max-old-space-size=3072
gist_token = <token>
account_passphrase = <passphrase>
account_password = <password>

@ -49,7 +49,7 @@
"minixhr": "^3.2.2",
"mkdirp": "^0.5.1",
"nanohtml": "^1.6.3",
"nightwatch": "^0.9.20",
"nightwatch": "^1.3.5",
"notify-error": "^1.2.0",
"npm-link-local": "^1.1.0",
"npm-merge-driver": "^2.3.5",

@ -117,7 +117,7 @@ class MultiParamManager {
title = this.funABI.type === 'receive' ? '(receive)' : '(fallback)'
}
this.basicInputField = yo`<input class="form-control"></input>`
this.basicInputField = yo`<input class="form-control" data-id="multiParamManagerBasicInputField"></input>`
this.basicInputField.setAttribute('placeholder', this.inputs)
this.basicInputField.setAttribute('title', this.inputs)
this.basicInputField.setAttribute('data-id', this.inputs)
@ -126,7 +126,7 @@ class MultiParamManager {
this.clickCallBack(this.funABI.inputs, this.basicInputField.value)
}
const width = this.isDeploy ? '' : 'w-50'
let funcButton = yo`<button onclick=${() => onClick()} class="${css.instanceButton} ${width} btn btn-sm">${title}</button>`
let funcButton = yo`<button onclick=${() => onClick()} class="${css.instanceButton} ${width} btn btn-sm" data-id="multiParamManagerFuncButton">${title}</button>`
this.contractActionsContainerSingle = yo`
<div class="${css.contractActionsContainerSingle} pt-2">
${funcButton}
@ -145,7 +145,7 @@ class MultiParamManager {
}
}
var expandedButton = yo`<button onclick=${() => { multiOnClick() }} class="${css.instanceButton}"></button>`
var expandedButton = yo`<button onclick=${() => { multiOnClick() }} class="${css.instanceButton}" data-id="multiParamManagerExpandedButton"></button>`
this.contractActionsContainerMulti = yo`<div class="${css.contractActionsContainerMulti}" >
<div class="${css.contractActionsContainerMultiInner} text-dark" >

@ -0,0 +1,30 @@
const EventEmitter = require('events')
class clearEditablecontent extends EventEmitter {
command (cssSelector) {
this.api.perform((done) => {
clearContent(this.api, cssSelector, () => {
done()
this.emit('complete')
})
})
return this
}
}
function clearContent (browser, cssSelector, callback) {
browser.execute(function (cssSelector) {
const selection = window.getSelection()
const range = document.createRange()
range.selectNodeContents(document.querySelector(cssSelector))
selection.removeAllRanges()
selection.addRange(range)
}, [cssSelector], function () {
browser.sendKeys(cssSelector, browser.Keys.BACK_SPACE)
.pause(5000)
callback()
})
}
module.exports = clearEditablecontent

@ -13,10 +13,19 @@ class CreateContract extends EventEmitter {
}
function createContract (browser, inputParams, callback) {
browser.clickLaunchIcon('settings').clickLaunchIcon('udapp')
if (inputParams) {
browser.clickLaunchIcon('settings').clickLaunchIcon('udapp')
.setValue('div[class^="contractActionsContainerSingle"] input', inputParams, function () {
browser.click('#runTabView button[class^="instanceButton"]').pause(500).perform(function () { callback() })
})
} else {
browser
.clickLaunchIcon('settings')
.clickLaunchIcon('udapp')
.click('#runTabView button[class^="instanceButton"]')
.pause(500)
.perform(function () { callback() })
}
}
module.exports = CreateContract

@ -3,7 +3,7 @@ const EventEmitter = require('events')
class ExecuteScript extends EventEmitter {
command (script) {
this.api
.clearValue('*[data-id="terminalCliInput"]')
.clearEditableContent('*[data-id="terminalCliInput"]')
.click('*[data-id="terminalCli"]')
.sendKeys('*[data-id="terminalCliInput"]', script)
.sendKeys('*[data-id="terminalCliInput"]', this.api.Keys.ENTER)

@ -3,23 +3,26 @@ const EventEmitter = require('events')
class GetInstalledPlugins extends EventEmitter {
command (cb) {
const browser = this.api
const plugins = []
browser.waitForElementPresent('[plugin]:not([plugin=""]')
.perform((done) => {
browser.execute(() => {
const pluginNames = []
const plugins = document.querySelectorAll('[plugin]:not([plugin=""]')
browser.click('*[data-id="remixIdeIconPanel"]')
.waitForElementPresent('[plugin]:not([plugin=""])')
.elements('css selector', '[plugin]:not([plugin=""])', (res) => {
res.value.forEach(function (jsonWebElement) {
const jsonWebElementId = jsonWebElement.ELEMENT || jsonWebElement[Object.keys(jsonWebElement)[0]]
browser.elementIdAttribute(jsonWebElementId, 'plugin', (jsonElement) => {
const attribute = jsonElement.value
plugins.forEach(plugin => {
pluginNames.push(plugin.getAttribute('plugin'))
plugins.push(attribute)
})
return pluginNames
}, [], (result) => {
done()
cb(result.value)
this.emit('complete')
})
})
.perform((done) => {
done()
cb(plugins)
this.emit('complete')
})
return this
}
}

@ -10,7 +10,7 @@ class JournalChildIncludes extends EventEmitter {
this.api.elements('css selector', '*[data-id="terminalJournal"]', (res) => {
res.value.forEach(function (jsonWebElement) {
const jsonWebElementId = jsonWebElement.ELEMENT
const jsonWebElementId = jsonWebElement.ELEMENT || jsonWebElement[Object.keys(jsonWebElement)[0]]
browser.elementIdText(jsonWebElementId, (jsonElement) => {
const text = jsonElement.value

@ -7,7 +7,7 @@ const EventEmitter = require('events')
class SwitchBrowserTab extends EventEmitter {
command (index) {
this.api.perform((browser, done) => {
browser.window_handles((result) => {
browser.windowHandles((result) => {
browser.switchWindow(result.value[index])
done()
})

@ -15,10 +15,10 @@ class TestContracts extends EventEmitter {
function testContracts (browser, fileName, contractCode, compiledContractNames, callback) {
browser
.clickLaunchIcon('solidity')
.clearValue('#input textarea')
.addFile(fileName, contractCode)
.pause(1000)
.verifyContracts(compiledContractNames)
.perform(() => {
callback()
})

@ -6,14 +6,12 @@ module.exports = function (browser, callback, url, preloadPlugins = true) {
.pause(5000)
.switchBrowserTab(0)
.injectScript('test-browser/helpers/applytestmode.js', function () {
browser.resizeWindow(2560, 1440, () => {
browser.fullscreenWindow(() => {
if (preloadPlugins) {
initModules(browser, () => {
browser.clickLaunchIcon('solidity')
.pause(2000)
.execute(() => {
document.getElementById('autoCompile').click()
})
.click('*[for="autoCompile"]')
.perform(function () {
callback()
})

@ -48,7 +48,6 @@ module.exports = {
.click('*[data-id="settingsTabSaveGistToken"]')
.waitForElementVisible('*[data-shared="tooltipPopup"]:nth-last-of-type(1)', 5000)
.assert.containsText('*[data-shared="tooltipPopup"]:nth-last-of-type(1)', 'Access token saved')
.click('*[data-id="tooltipCloseButton"]')
},
'Should copy github access token to clipboard': function (browser) {
@ -56,7 +55,6 @@ module.exports = {
.click('*[data-id="copyToClipboardCopyIcon"]')
.waitForElementVisible('*[data-shared="tooltipPopup"]:nth-last-of-type(1)', 5000)
.assert.containsText('*[data-shared="tooltipPopup"]:nth-last-of-type(1)', 'Copied value to clipboard.')
.click('*[data-id="tooltipCloseButton"]')
},
'Should remove github access token': function (browser) {
@ -65,7 +63,6 @@ module.exports = {
.waitForElementVisible('*[data-shared="tooltipPopup"]:nth-last-of-type(1)', 5000)
.assert.containsText('*[data-shared="tooltipPopup"]:nth-last-of-type(1)', 'Access token removed')
.assert.containsText('*[data-id="settingsTabGistAccessToken"]', '')
.click('*[data-id="tooltipCloseButton"]')
},
'Should load dark theme': function (browser) {

@ -25,8 +25,8 @@ module.exports = {
'Should sign message using account key': function (browser) {
browser.waitForElementPresent('*[data-id="settingsRemixRunSignMsg"]')
.click('*[data-id="settingsRemixRunSignMsg"]')
.waitForElementPresent('*[data-id="modalDialogContainer"]')
.click('*[data-id="modalDialogCustomPromptText"]')
.pause(2000)
.waitForElementPresent('*[data-id="modalDialogCustomPromptText"]')
.setValue('*[data-id="modalDialogCustomPromptText"]', 'Remix is cool!')
.assert.elementNotPresent('*[data-id="settingsRemixRunSignMsgHash"]')
.assert.elementNotPresent('*[data-id="settingsRemixRunSignMsgSignature"]')

@ -2,7 +2,7 @@
// const https = require('https')
module.exports = function sauce (callback) {
return callback()
if (typeof callback === 'function') return callback()
/*
const currentTest = this.client.currentTest
const username = this.client.options.username

1053
package-lock.json generated

File diff suppressed because it is too large Load Diff

@ -26,7 +26,7 @@
"serve": "nx serve",
"build": "nx build",
"test": "nx test",
"lint": "nx workspace-lint && nx lint",
"lint": "nx lint",
"e2e": "nx e2e",
"affected:apps": "nx affected:apps",
"affected:libs": "nx affected:libs",
@ -73,7 +73,7 @@
"nightwatch_local_terminal": "nightwatch ./apps/remix-ide/test-browser/tests/terminal.test.js --config nightwatch.js --env chrome ",
"nightwatch_local_gist": "nightwatch ./apps/remix-ide/test-browser/tests/gist.test.js --config nightwatch.js --env chrome ",
"nightwatch_local_workspace": "nightwatch ./apps/remix-ide/test-browser/tests/workspace.test.js --config nightwatch.js --env chrome ",
"nightwatch_local_defaultLayout": "nightwatch ./apps/remix-ide/test-browser/tests/defaultLayout.test.js --config apps/remix-ide/nightwatch.js --env chrome ",
"nightwatch_local_defaultLayout": "nightwatch ./apps/remix-ide/test-browser/tests/defaultLayout.test.js --config nightwatch.js --env chrome ",
"nightwatch_local_pluginManager": "nightwatch ./apps/remix-ide/test-browser/tests/pluginManager.test.js --config nightwatch.js --env chrome ",
"nightwatch_local_publishContract": "nightwatch ./apps/remix-ide/test-browser/tests/publishContract.test.js --config nightwatch.js --env chrome ",
"nightwatch_local_generalSettings": "nightwatch ./apps/remix-ide/test-browser/tests/generalSettings.test.js --config nightwatch.js --env chrome ",
@ -97,7 +97,7 @@
"apps/remix-ide/build/",
"apps/remix-ide/src/app/editor/mode-solidity.js",
"apps/remix-ide/soljson.js",
"apps/remix-ide/assets/js/0.7.7/app.js"
"apps/remix-ide/assets/js/"
],
"parser": "babel-eslint"
},
@ -195,7 +195,7 @@
"minixhr": "^3.2.2",
"mkdirp": "^0.5.1",
"nanohtml": "^1.6.3",
"nightwatch": "^0.9.20",
"nightwatch": "^1.3.5",
"notify-error": "^1.2.0",
"npm-link-local": "^1.1.0",
"npm-merge-driver": "^2.3.5",

Loading…
Cancel
Save