pull/4673/head
bunsenstraat 7 months ago
parent b066e666e5
commit bef688cbe5
  1. 12
      apps/remix-ide-e2e/nightwatch-chrome.ts
  2. 23
      apps/remix-ide-e2e/src/commands/setupMetamask.ts
  3. 10
      apps/remix-ide-e2e/src/select_tests.sh
  4. 15
      apps/remix-ide-e2e/src/tests/runAndDeploy_injected.test.ts

@ -61,6 +61,18 @@ module.exports = {
}
},
'chromeDesktopMetamask': {
desiredCapabilities: {
'browserName': 'chrome',
'javascriptEnabled': true,
'acceptSslCerts': true,
'goog:chromeOptions': {
args: ['window-size=2560,1440', '--no-sandbox', '--verbose']
,extensions: [metamaskExtension]
}
}
},
'chrome-runAndDeploy': {
desiredCapabilities: {
'browserName': 'chrome',

@ -3,7 +3,7 @@ import { NightwatchBrowser } from 'nightwatch'
const EventEmitter = require('events')
class MetaMask extends EventEmitter {
command (this: NightwatchBrowser, passphrase: string, password: string): NightwatchBrowser {
command(this: NightwatchBrowser, passphrase: string, password: string): NightwatchBrowser {
this.api.perform((done) => {
setupMetaMask(this.api, passphrase, password, () => {
done()
@ -14,10 +14,10 @@ class MetaMask extends EventEmitter {
}
}
function setupMetaMask (browser: NightwatchBrowser, passphrase: string, password: string, done: VoidFunction) {
function setupMetaMask(browser: NightwatchBrowser, passphrase: string, password: string, done: VoidFunction) {
const words = passphrase.split(' ')
browser
.switchBrowserTab(1)
.switchBrowserTab(1)
.waitForElementVisible('input[data-testid="onboarding-terms-checkbox"]')
.click('input[data-testid="onboarding-terms-checkbox"]')
.waitForElementVisible('button[data-testid="onboarding-import-wallet"]')
@ -49,11 +49,18 @@ function setupMetaMask (browser: NightwatchBrowser, passphrase: string, password
.click('button[data-testid="pin-extension-next"]')
.waitForElementVisible('button[data-testid="pin-extension-done"]')
.click('button[data-testid="pin-extension-done"]')
.waitForElementVisible('button[data-testid="popover-close"]')
.click('button[data-testid="popover-close"]')
.pause(1000)
.isPresent('button[data-testid="popover-close"]', () => {
browser.click('button[data-testid="popover-close"]')
.isVisible({
selector: 'button[data-testid="popover-close"]',
locateStrategy: 'css selector',
suppressNotFoundErrors: true,
timeout: 3000
}, (okVisible) => {
console.log('okVisible', okVisible)
if (!okVisible.value) {
console.log('popover not found')
}else{
browser.click('button[data-testid="popover-close"]')
}
})
.click('[data-testid="network-display"]')
.click('.mm-modal-content label.toggle-button--off') // show test networks

@ -3,7 +3,7 @@
# Bash Menu Script Example
PS3='Select a browser: '
BROWSERS=( "chrome" "chrome headless" "firefox" "exit" )
BROWSERS=( "chrome" "chrome with metamask" "firefox" "exit" )
select opt in "${BROWSERS[@]}"
do
case $opt in
@ -12,9 +12,9 @@ do
BROWSER="chromeDesktop"
break
;;
"chrome headless")
echo "Chrome headless selected"
BROWSER="chrome"
"chrome with metamask")
echo "Chrome metamask selected"
BROWSER="chromeDesktopMetamask"
break
;;
"firefox")
@ -53,6 +53,8 @@ do
yarn run build:e2e && nightwatch --config dist/apps/remix-ide-e2e/nightwatch-chrome.js $opt --env=$BROWSER
elif [ "$BROWSER" = "chromeDesktop" ]; then
yarn run build:e2e && nightwatch --config dist/apps/remix-ide-e2e/nightwatch-chrome.js $opt --env=$BROWSER
elif [ "$BROWSER" = "chromeDesktopMetamask" ]; then
yarn run build:e2e && nightwatch --config dist/apps/remix-ide-e2e/nightwatch-chrome.js $opt --env=$BROWSER
fi
fi

@ -11,6 +11,20 @@ const checkBrowserIsChrome = function (browser: NightwatchBrowser) {
return browser.browserName.indexOf('chrome') > -1
}
const checkAlerts = function (browser: NightwatchBrowser){
browser.isVisible({
selector: '//*[contains(.,"not have enough")]',
locateStrategy: 'xpath',
suppressNotFoundErrors: true,
timeout: 3000
}, (okVisible) => {
if (okVisible.value) {
browser.assert.fail('Not enough ETH in test account!!')
browser.end()
}
})
}
module.exports = {
'@disabled': true,
before: function (browser: NightwatchBrowser, done: VoidFunction) {
@ -67,6 +81,7 @@ module.exports = {
.pause(5000)
.perform((done) => {
browser.switchBrowserWindow(extension_url, 'MetaMask', (browser) => {
checkAlerts(browser)
browser
.waitForElementPresent('[data-testid="page-container-footer-next"]')
.click('[data-testid="page-container-footer-next"]') // approve the tx

Loading…
Cancel
Save