Setuetup MetaMask

pull/1/head
ioedeveloper 5 years ago committed by yann300
parent efd06a86a5
commit 420e2eb903
  1. 8
      nightwatch.js
  2. 37
      test-browser/commands/setupMetamask.js
  3. BIN
      test-browser/extensions/chrome/metamask.crx
  4. 2
      test-browser/helpers/init.js
  5. 6
      test-browser/tests/runAndDeploy.js

@ -1,6 +1,9 @@
'use strict'
require('@babel/register')()
const crxFile = require('fs').readFileSync('./test-browser/extensions/chrome/metamask.crx')
const metamaskExtension = new Buffer.from(crxFile).toString('base64')
module.exports = {
'src_folders': ['test-browser/tests'],
'output_folder': 'reports',
@ -35,8 +38,9 @@ module.exports = {
'browserName': 'chrome',
'javascriptEnabled': true,
'acceptSslCerts': true,
'chromeOptions': {
'args': ['window-size=2560,1440', 'start-fullscreen']
'goog:chromeOptions': {
'args': ['window-size=2560,1440', 'start-fullscreen'],
'extensions': [metamaskExtension]
}
}
},

@ -0,0 +1,37 @@
const EventEmitter = require('events')
class MetaMask extends EventEmitter {
command () {
this.api.perform((done) => {
setupMetaMask(this.api, () => {
done()
this.emit('complete')
})
})
return this
}
}
function setupMetaMask (browser, done) {
browser
.keys(browser.Keys.ALT).keys(browser.Keys.SHIFT).keys('M')
.pause(100000)
.waitForElementPresent('.first-time-flow__button')
.click('.first-time-flow__button')
.waitForElementPresent('.select-action__select-button:nth-of-type(1) > .first-time-flow__button')
.click('.select-action__select-button:nth-of-type(1) > .first-time-flow__button')
.waitForElementPresent('.page-container__footer-button:nth-of-type(2)')
.click('.page-container__footer-button:nth-of-type(2)')
.waitForElementPresent('.first-time-flow__textarea')
.setValue('.first-time-flow__textarea', 'explain uniform adapt basic blue onion rebel pull rice erase volcano couple')
.setValue('*[autocomplete="new-password"]', 'remix_is_cool')
.setValue('*[autocomplete="confirm-password"]', 'remix_is_cool')
.click('.first-time-flow__checkbox')
.pause(5000)
.click('.first-time-flow__button')
.perform(() => {
done()
})
}
module.exports = MetaMask

@ -22,7 +22,7 @@ module.exports = function (browser, callback, url, preloadPlugins = true) {
}
function initModules (browser, callback) {
browser.pause(20000)
browser.pause(5000)
.click('#icon-panel div[plugin="pluginManager"]')
.scrollAndClick('#pluginManager article[id="remixPluginManagerListItem_solidity"] button')
.pause(5000)

@ -14,7 +14,9 @@ module.exports = {
'Should load run and deploy tab': function (browser) {
browser.waitForElementPresent('*[data-id="remixIdeSidePanel"]')
.setupMetamask()
.pause(3000)
.pause(1000000)
.clickLaunchIcon('udapp')
.waitForElementPresent('*[data-id="sidePanelSwapitTitle"]')
.assert.containsText('*[data-id="sidePanelSwapitTitle"]', 'DEPLOY & RUN TRANSACTIONS')
@ -56,9 +58,9 @@ module.exports = {
.click('*[data-id="universalDappUiTitleExpander"]')
.waitForElementPresent('*[data-id="pluginManagerSettingsDeployAndRunLLTxSendTransaction"]')
.click('*[data-id="pluginManagerSettingsDeployAndRunLLTxSendTransaction"]')
.testFunction('0xf887e3ac3143430b0c22d055eb25d234675e7f3246cb0824efc4c1437a1405d5', {
.testFunction('0xfe718871ee0b4d03cdcac0e12e5b164efaf7e23ba952c07db76e62692867019b', {
status: '0x1 Transaction mined and execution succeed',
'transaction hash': '0xf887e3ac3143430b0c22d055eb25d234675e7f3246cb0824efc4c1437a1405d5'
'transaction hash': '0xfe718871ee0b4d03cdcac0e12e5b164efaf7e23ba952c07db76e62692867019b'
})
.end()
},

Loading…
Cancel
Save