Commit 7d0d8bfe authored by ioedeveloper's avatar ioedeveloper

Upgraded nightwatch and fixed breaking changes

parent 4f26a735
NODE_OPTIONS=--max-old-space-size=3072 NODE_OPTIONS=--max-old-space-size=3072
\ No newline at end of file gist_token = <token>
account_passphrase = <passphrase>
account_password = <password>
\ No newline at end of file
...@@ -49,7 +49,7 @@ ...@@ -49,7 +49,7 @@
"minixhr": "^3.2.2", "minixhr": "^3.2.2",
"mkdirp": "^0.5.1", "mkdirp": "^0.5.1",
"nanohtml": "^1.6.3", "nanohtml": "^1.6.3",
"nightwatch": "^0.9.20", "nightwatch": "^1.3.5",
"notify-error": "^1.2.0", "notify-error": "^1.2.0",
"npm-link-local": "^1.1.0", "npm-link-local": "^1.1.0",
"npm-merge-driver": "^2.3.5", "npm-merge-driver": "^2.3.5",
......
...@@ -117,7 +117,7 @@ class MultiParamManager { ...@@ -117,7 +117,7 @@ class MultiParamManager {
title = this.funABI.type === 'receive' ? '(receive)' : '(fallback)' 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('placeholder', this.inputs)
this.basicInputField.setAttribute('title', this.inputs) this.basicInputField.setAttribute('title', this.inputs)
this.basicInputField.setAttribute('data-id', this.inputs) this.basicInputField.setAttribute('data-id', this.inputs)
...@@ -126,7 +126,7 @@ class MultiParamManager { ...@@ -126,7 +126,7 @@ class MultiParamManager {
this.clickCallBack(this.funABI.inputs, this.basicInputField.value) this.clickCallBack(this.funABI.inputs, this.basicInputField.value)
} }
const width = this.isDeploy ? '' : 'w-50' 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` this.contractActionsContainerSingle = yo`
<div class="${css.contractActionsContainerSingle} pt-2"> <div class="${css.contractActionsContainerSingle} pt-2">
${funcButton} ${funcButton}
...@@ -145,7 +145,7 @@ class MultiParamManager { ...@@ -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}" > this.contractActionsContainerMulti = yo`<div class="${css.contractActionsContainerMulti}" >
<div class="${css.contractActionsContainerMultiInner} text-dark" > <div class="${css.contractActionsContainerMultiInner} text-dark" >
......
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 { ...@@ -13,10 +13,19 @@ class CreateContract extends EventEmitter {
} }
function createContract (browser, inputParams, callback) { function createContract (browser, inputParams, callback) {
browser.clickLaunchIcon('settings').clickLaunchIcon('udapp') if (inputParams) {
browser.clickLaunchIcon('settings').clickLaunchIcon('udapp')
.setValue('div[class^="contractActionsContainerSingle"] input', inputParams, function () { .setValue('div[class^="contractActionsContainerSingle"] input', inputParams, function () {
browser.click('#runTabView button[class^="instanceButton"]').pause(500).perform(function () { callback() }) 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 module.exports = CreateContract
...@@ -3,7 +3,7 @@ const EventEmitter = require('events') ...@@ -3,7 +3,7 @@ const EventEmitter = require('events')
class ExecuteScript extends EventEmitter { class ExecuteScript extends EventEmitter {
command (script) { command (script) {
this.api this.api
.clearValue('*[data-id="terminalCliInput"]') .clearEditableContent('*[data-id="terminalCliInput"]')
.click('*[data-id="terminalCli"]') .click('*[data-id="terminalCli"]')
.sendKeys('*[data-id="terminalCliInput"]', script) .sendKeys('*[data-id="terminalCliInput"]', script)
.sendKeys('*[data-id="terminalCliInput"]', this.api.Keys.ENTER) .sendKeys('*[data-id="terminalCliInput"]', this.api.Keys.ENTER)
......
...@@ -3,23 +3,26 @@ const EventEmitter = require('events') ...@@ -3,23 +3,26 @@ const EventEmitter = require('events')
class GetInstalledPlugins extends EventEmitter { class GetInstalledPlugins extends EventEmitter {
command (cb) { command (cb) {
const browser = this.api const browser = this.api
const plugins = []
browser.waitForElementPresent('[plugin]:not([plugin=""]') browser.click('*[data-id="remixIdeIconPanel"]')
.perform((done) => { .waitForElementPresent('[plugin]:not([plugin=""])')
browser.execute(() => { .elements('css selector', '[plugin]:not([plugin=""])', (res) => {
const pluginNames = [] res.value.forEach(function (jsonWebElement) {
const plugins = document.querySelectorAll('[plugin]:not([plugin=""]') const jsonWebElementId = jsonWebElement.ELEMENT || jsonWebElement[Object.keys(jsonWebElement)[0]]
browser.elementIdAttribute(jsonWebElementId, 'plugin', (jsonElement) => {
const attribute = jsonElement.value
plugins.forEach(plugin => { plugins.push(attribute)
pluginNames.push(plugin.getAttribute('plugin'))
}) })
return pluginNames
}, [], (result) => {
done()
cb(result.value)
this.emit('complete')
}) })
}) })
.perform((done) => {
done()
cb(plugins)
this.emit('complete')
})
return this return this
} }
} }
......
...@@ -10,7 +10,7 @@ class JournalChildIncludes extends EventEmitter { ...@@ -10,7 +10,7 @@ class JournalChildIncludes extends EventEmitter {
this.api.elements('css selector', '*[data-id="terminalJournal"]', (res) => { this.api.elements('css selector', '*[data-id="terminalJournal"]', (res) => {
res.value.forEach(function (jsonWebElement) { res.value.forEach(function (jsonWebElement) {
const jsonWebElementId = jsonWebElement.ELEMENT const jsonWebElementId = jsonWebElement.ELEMENT || jsonWebElement[Object.keys(jsonWebElement)[0]]
browser.elementIdText(jsonWebElementId, (jsonElement) => { browser.elementIdText(jsonWebElementId, (jsonElement) => {
const text = jsonElement.value const text = jsonElement.value
......
...@@ -7,7 +7,7 @@ const EventEmitter = require('events') ...@@ -7,7 +7,7 @@ const EventEmitter = require('events')
class SwitchBrowserTab extends EventEmitter { class SwitchBrowserTab extends EventEmitter {
command (index) { command (index) {
this.api.perform((browser, done) => { this.api.perform((browser, done) => {
browser.window_handles((result) => { browser.windowHandles((result) => {
browser.switchWindow(result.value[index]) browser.switchWindow(result.value[index])
done() done()
}) })
......
...@@ -15,10 +15,10 @@ class TestContracts extends EventEmitter { ...@@ -15,10 +15,10 @@ class TestContracts extends EventEmitter {
function testContracts (browser, fileName, contractCode, compiledContractNames, callback) { function testContracts (browser, fileName, contractCode, compiledContractNames, callback) {
browser browser
.clickLaunchIcon('solidity') .clickLaunchIcon('solidity')
.clearValue('#input textarea')
.addFile(fileName, contractCode) .addFile(fileName, contractCode)
.pause(1000) .pause(1000)
.verifyContracts(compiledContractNames) .verifyContracts(compiledContractNames)
.perform(() => { .perform(() => {
callback() callback()
}) })
......
...@@ -6,14 +6,12 @@ module.exports = function (browser, callback, url, preloadPlugins = true) { ...@@ -6,14 +6,12 @@ module.exports = function (browser, callback, url, preloadPlugins = true) {
.pause(5000) .pause(5000)
.switchBrowserTab(0) .switchBrowserTab(0)
.injectScript('test-browser/helpers/applytestmode.js', function () { .injectScript('test-browser/helpers/applytestmode.js', function () {
browser.resizeWindow(2560, 1440, () => { browser.fullscreenWindow(() => {
if (preloadPlugins) { if (preloadPlugins) {
initModules(browser, () => { initModules(browser, () => {
browser.clickLaunchIcon('solidity') browser.clickLaunchIcon('solidity')
.pause(2000) .pause(2000)
.execute(() => { .click('*[for="autoCompile"]')
document.getElementById('autoCompile').click()
})
.perform(function () { .perform(function () {
callback() callback()
}) })
......
...@@ -48,7 +48,6 @@ module.exports = { ...@@ -48,7 +48,6 @@ module.exports = {
.click('*[data-id="settingsTabSaveGistToken"]') .click('*[data-id="settingsTabSaveGistToken"]')
.waitForElementVisible('*[data-shared="tooltipPopup"]:nth-last-of-type(1)', 5000) .waitForElementVisible('*[data-shared="tooltipPopup"]:nth-last-of-type(1)', 5000)
.assert.containsText('*[data-shared="tooltipPopup"]:nth-last-of-type(1)', 'Access token saved') .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) { 'Should copy github access token to clipboard': function (browser) {
...@@ -56,7 +55,6 @@ module.exports = { ...@@ -56,7 +55,6 @@ module.exports = {
.click('*[data-id="copyToClipboardCopyIcon"]') .click('*[data-id="copyToClipboardCopyIcon"]')
.waitForElementVisible('*[data-shared="tooltipPopup"]:nth-last-of-type(1)', 5000) .waitForElementVisible('*[data-shared="tooltipPopup"]:nth-last-of-type(1)', 5000)
.assert.containsText('*[data-shared="tooltipPopup"]:nth-last-of-type(1)', 'Copied value to clipboard.') .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) { 'Should remove github access token': function (browser) {
...@@ -65,7 +63,6 @@ module.exports = { ...@@ -65,7 +63,6 @@ module.exports = {
.waitForElementVisible('*[data-shared="tooltipPopup"]:nth-last-of-type(1)', 5000) .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-shared="tooltipPopup"]:nth-last-of-type(1)', 'Access token removed')
.assert.containsText('*[data-id="settingsTabGistAccessToken"]', '') .assert.containsText('*[data-id="settingsTabGistAccessToken"]', '')
.click('*[data-id="tooltipCloseButton"]')
}, },
'Should load dark theme': function (browser) { 'Should load dark theme': function (browser) {
......
...@@ -25,8 +25,8 @@ module.exports = { ...@@ -25,8 +25,8 @@ module.exports = {
'Should sign message using account key': function (browser) { 'Should sign message using account key': function (browser) {
browser.waitForElementPresent('*[data-id="settingsRemixRunSignMsg"]') browser.waitForElementPresent('*[data-id="settingsRemixRunSignMsg"]')
.click('*[data-id="settingsRemixRunSignMsg"]') .click('*[data-id="settingsRemixRunSignMsg"]')
.waitForElementPresent('*[data-id="modalDialogContainer"]') .pause(2000)
.click('*[data-id="modalDialogCustomPromptText"]') .waitForElementPresent('*[data-id="modalDialogCustomPromptText"]')
.setValue('*[data-id="modalDialogCustomPromptText"]', 'Remix is cool!') .setValue('*[data-id="modalDialogCustomPromptText"]', 'Remix is cool!')
.assert.elementNotPresent('*[data-id="settingsRemixRunSignMsgHash"]') .assert.elementNotPresent('*[data-id="settingsRemixRunSignMsgHash"]')
.assert.elementNotPresent('*[data-id="settingsRemixRunSignMsgSignature"]') .assert.elementNotPresent('*[data-id="settingsRemixRunSignMsgSignature"]')
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// const https = require('https') // const https = require('https')
module.exports = function sauce (callback) { module.exports = function sauce (callback) {
return callback() if (typeof callback === 'function') return callback()
/* /*
const currentTest = this.client.currentTest const currentTest = this.client.currentTest
const username = this.client.options.username const username = this.client.options.username
......
This diff is collapsed.
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
"serve": "nx serve", "serve": "nx serve",
"build": "nx build", "build": "nx build",
"test": "nx test", "test": "nx test",
"lint": "nx workspace-lint && nx lint", "lint": "nx lint",
"e2e": "nx e2e", "e2e": "nx e2e",
"affected:apps": "nx affected:apps", "affected:apps": "nx affected:apps",
"affected:libs": "nx affected:libs", "affected:libs": "nx affected:libs",
...@@ -73,7 +73,7 @@ ...@@ -73,7 +73,7 @@
"nightwatch_local_terminal": "nightwatch ./apps/remix-ide/test-browser/tests/terminal.test.js --config nightwatch.js --env chrome ", "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_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_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_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_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 ", "nightwatch_local_generalSettings": "nightwatch ./apps/remix-ide/test-browser/tests/generalSettings.test.js --config nightwatch.js --env chrome ",
...@@ -97,7 +97,7 @@ ...@@ -97,7 +97,7 @@
"apps/remix-ide/build/", "apps/remix-ide/build/",
"apps/remix-ide/src/app/editor/mode-solidity.js", "apps/remix-ide/src/app/editor/mode-solidity.js",
"apps/remix-ide/soljson.js", "apps/remix-ide/soljson.js",
"apps/remix-ide/assets/js/0.7.7/app.js" "apps/remix-ide/assets/js/"
], ],
"parser": "babel-eslint" "parser": "babel-eslint"
}, },
...@@ -195,7 +195,7 @@ ...@@ -195,7 +195,7 @@
"minixhr": "^3.2.2", "minixhr": "^3.2.2",
"mkdirp": "^0.5.1", "mkdirp": "^0.5.1",
"nanohtml": "^1.6.3", "nanohtml": "^1.6.3",
"nightwatch": "^0.9.20", "nightwatch": "^1.3.5",
"notify-error": "^1.2.0", "notify-error": "^1.2.0",
"npm-link-local": "^1.1.0", "npm-link-local": "^1.1.0",
"npm-merge-driver": "^2.3.5", "npm-merge-driver": "^2.3.5",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment