set user agent

set desktop

rm desktop

reset file

reset file

screens

mv logs

log params

params

stringify

strings

restore test

restore test

restore script

turn off flaky

rm desktop
pull/2729/head
bunsenstraat 2 years ago committed by Aniket
parent c878a480b8
commit 31bc0e80a9
  1. 4
      .circleci/config.yml
  2. 8
      apps/remix-ide-e2e/nightwatch.ts
  3. 25
      apps/remix-ide-e2e/src/tests/url.test.ts
  4. 1
      apps/remix-ide/src/app.js
  5. 4
      libs/remix-core-plugin/src/lib/helpers/fetch-etherscan.ts
  6. 1
      libs/remix-ui/workspace/src/lib/actions/index.ts

@ -6,7 +6,7 @@ version: 2.1
parameters:
run_flaky_tests:
type: boolean
default: true
default: false
orbs:
browser-tools: circleci/browser-tools@1.2.3
jobs:
@ -176,7 +176,7 @@ jobs:
name: Start Selenium
command: java -jar /usr/local/bin/selenium.jar
background: true
- run: ./apps/remix-ide/ci/flaky.sh chromeDesktop
- run: ./apps/remix-ide/ci/flaky.sh chrome
- store_test_results:
path: ./reports/tests
- store_artifacts:

@ -29,7 +29,13 @@ module.exports = {
javascriptEnabled: true,
acceptSslCerts: true,
'goog:chromeOptions': {
args: ['window-size=2560,1440', 'start-fullscreen', '--no-sandbox', '--headless', '--verbose']
args: ['window-size=2560,1440',
'start-fullscreen',
'--no-sandbox',
'--headless',
'--verbose',
"--user-agent=Mozilla/5.0 (Macintosh; Intel Mac OS X 12_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.0.0 Safari/537.36",
]
}
}
},

@ -42,10 +42,8 @@ const sources = [
module.exports = {
'@disabled': true,
'@desktop': true,
before: function (browser: NightwatchBrowser, done: VoidFunction) {
init(browser, done)
//init(browser, done, 'http://127.0.0.1:8080/#optimize=true&runs=300&evmVersion=istanbul&version=soljson-v0.7.4+commit.3f05b770.js', true)
init(browser, done, 'http://127.0.0.1:8080/#optimize=true&runs=300&evmVersion=istanbul&version=soljson-v0.7.4+commit.3f05b770.js', true)
},
'@sources': function () {
@ -87,26 +85,10 @@ module.exports = {
})
},
'Should load Etherscan verified contractss from URL "address" param) #group2 #flaky': function (browser: NightwatchBrowser) {
'Should load Etherscan verified contractss from URL "address" param) #group2': function (browser: NightwatchBrowser) {
browser
.pause(5000)
.url('http://127.0.0.1:8080/?address=0x56db08fb78bc6689a1ef66efd079083fed0e4915')
.pause(10000)
.getLog('browser', (logEntries) => {
if (logEntries && logEntries.length > 0) {
console.log('Browser log:')
console.log(logEntries)
}
}).
currentWorkspaceIs('etherscan-code-sample')
.getLog('browser', (logEntries) => {
if (logEntries && logEntries.length > 0) {
console.log('Browser log:')
console.log(logEntries)
}
})
/*
.saveScreenshot('./reports/screenshots/etherscan-verified-contract-1.png')
.url('http://127.0.0.1:8080/#address=0x56db08fb78bc6689a1ef66efd079083fed0e4915')
.refresh()
.pause(7000)
.currentWorkspaceIs('etherscan-code-sample')
@ -130,7 +112,6 @@ module.exports = {
'contract TetherToken is Pausable, StandardToken, BlackList {') !== -1)
})
*/
},
'Should load the code from URL & code params #group1': function (browser: NightwatchBrowser) {

@ -62,7 +62,6 @@ const { TabProxy } = require('./app/panels/tab-proxy.js')
class AppComponent {
constructor () {
console.error(window.location.href)
this.appManager = new RemixAppManager({})
this.queryParams = new QueryParams()
this._components = {}

@ -1,5 +1,4 @@
export const fetchContractFromEtherscan = async (plugin, network, contractAddress, targetPath, shouldSetFile = true, key?) => {
console.error('get etherscan contract', contractAddress);
let data
const compilationTargets = {}
let etherscanKey
@ -8,12 +7,10 @@ export const fetchContractFromEtherscan = async (plugin, network, contractAddres
else etherscanKey = key
if (etherscanKey) {
console.error('etherscan key found', etherscanKey);
const endpoint = network.id == 1 ? 'api.etherscan.io' : 'api-' + network.name + '.etherscan.io'
try {
data = await fetch('https://' + endpoint + '/api?module=contract&action=getsourcecode&address=' + contractAddress + '&apikey=' + etherscanKey)
data = await data.json()
console.error('etherscan contract data', data);
// etherscan api doc https://docs.etherscan.io/api-endpoints/contracts
if (data.message === 'OK' && data.status === "1") {
if (data.result.length) {
@ -24,7 +21,6 @@ export const fetchContractFromEtherscan = async (plugin, network, contractAddres
}
} else throw new Error('unable to retrieve contract data ' + data.message)
} catch (e) {
console.error('etherscan contract data error', e);
throw new Error('unable to retrieve contract data: ' + e.message)
}
} else throw new Error('unable to try fetching the source code from etherscan: etherscan access token not found. please go to the Remix settings page and provide an access token.')

@ -52,6 +52,7 @@ export const initWorkspace = (filePanelPlugin) => async (reducerDispatch: React.
const params = queryParams.get() as UrlParametersType
const workspaces = await getWorkspaces() || []
dispatch(setWorkspaces(workspaces))
console.error('PARAMS', params)
if (params.gist) {
await createWorkspaceTemplate('gist-sample', 'gist-template')
plugin.setWorkspace({ name: 'gist-sample', isLocalhost: false })

Loading…
Cancel
Save