added scroll to icons in tests

added parameter to scrollInto to alighn to the center
pull/1/head
LianaHus 5 years ago
parent 0b2da2ed15
commit acbd919a75
  1. 15
      test-browser/commands/scrollAndClick.js
  2. 2
      test-browser/commands/scrollInto.js
  3. 14
      test-browser/helpers/init.js

@ -0,0 +1,15 @@
const EventEmitter = require('events')
class ScrollAndClick extends EventEmitter {
command (target) {
this.api
.scrollInto(target)
.click(target)
.perform(() => {
this.emit('complete')
})
return this
}
}
module.exports = ScrollAndClick

@ -14,7 +14,7 @@ class ScrollInto extends EventEmitter {
function _scrollInto (browser, target, cb) {
browser.execute(function (target) {
document.querySelector(target).scrollIntoView()
document.querySelector(target).scrollIntoView(({block: 'center'}))
}, [target], function () {
cb()
})

@ -14,16 +14,18 @@ module.exports = function (browser, callback) {
}
function initModules (browser, callback) {
browser.pause(3000).click('#icon-panel div[plugin="pluginManager"]')
.execute(function () {
document.querySelector('div[id="pluginManager"]').scrollTop = document.querySelector('div[id="pluginManager"]').scrollHeight
}, [], function () {
browser.click('#pluginManager article[id="remixPluginManagerListItem_solidity"] button')
browser.pause(3000)
.click('#icon-panel div[plugin="pluginManager"]')
.scrollInto('#pluginManager article[id="remixPluginManagerListItem_solidity"] button')
.click('#pluginManager article[id="remixPluginManagerListItem_solidity"] button')
.pause(5000)
.scrollInto('#pluginManager article[id="remixPluginManagerListItem_udapp"] button')
.click('#pluginManager article[id="remixPluginManagerListItem_udapp"] button')
.scrollInto('#pluginManager article[id="remixPluginManagerListItem_solidityStaticAnalysis"] button')
.click('#pluginManager article[id="remixPluginManagerListItem_solidityStaticAnalysis"] button')
.scrollInto('#pluginManager article[id="remixPluginManagerListItem_debugger"] button')
.click('#pluginManager article[id="remixPluginManagerListItem_debugger"] button')
.scrollInto('#icon-panel div[plugin="fileExplorers"]')
.click('#icon-panel div[plugin="fileExplorers"]')
.perform(() => { callback() })
})
}

Loading…
Cancel
Save