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

@ -29,7 +29,13 @@ module.exports = {
javascriptEnabled: true, javascriptEnabled: true,
acceptSslCerts: true, acceptSslCerts: true,
'goog:chromeOptions': { '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 = { module.exports = {
'@disabled': true, '@disabled': true,
'@desktop': true,
before: function (browser: NightwatchBrowser, done: VoidFunction) { 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 () { '@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 browser
.pause(5000) .pause(5000)
.url('http://127.0.0.1:8080/?address=0x56db08fb78bc6689a1ef66efd079083fed0e4915') .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')
.refresh() .refresh()
.pause(7000) .pause(7000)
.currentWorkspaceIs('etherscan-code-sample') .currentWorkspaceIs('etherscan-code-sample')
@ -130,7 +112,6 @@ module.exports = {
'contract TetherToken is Pausable, StandardToken, BlackList {') !== -1) 'contract TetherToken is Pausable, StandardToken, BlackList {') !== -1)
}) })
*/
}, },
'Should load the code from URL & code params #group1': function (browser: NightwatchBrowser) { '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 { class AppComponent {
constructor () { constructor () {
console.error(window.location.href)
this.appManager = new RemixAppManager({}) this.appManager = new RemixAppManager({})
this.queryParams = new QueryParams() this.queryParams = new QueryParams()
this._components = {} this._components = {}

@ -1,5 +1,4 @@
export const fetchContractFromEtherscan = async (plugin, network, contractAddress, targetPath, shouldSetFile = true, key?) => { export const fetchContractFromEtherscan = async (plugin, network, contractAddress, targetPath, shouldSetFile = true, key?) => {
console.error('get etherscan contract', contractAddress);
let data let data
const compilationTargets = {} const compilationTargets = {}
let etherscanKey let etherscanKey
@ -8,12 +7,10 @@ export const fetchContractFromEtherscan = async (plugin, network, contractAddres
else etherscanKey = key else etherscanKey = key
if (etherscanKey) { if (etherscanKey) {
console.error('etherscan key found', etherscanKey);
const endpoint = network.id == 1 ? 'api.etherscan.io' : 'api-' + network.name + '.etherscan.io' const endpoint = network.id == 1 ? 'api.etherscan.io' : 'api-' + network.name + '.etherscan.io'
try { try {
data = await fetch('https://' + endpoint + '/api?module=contract&action=getsourcecode&address=' + contractAddress + '&apikey=' + etherscanKey) data = await fetch('https://' + endpoint + '/api?module=contract&action=getsourcecode&address=' + contractAddress + '&apikey=' + etherscanKey)
data = await data.json() data = await data.json()
console.error('etherscan contract data', data);
// etherscan api doc https://docs.etherscan.io/api-endpoints/contracts // etherscan api doc https://docs.etherscan.io/api-endpoints/contracts
if (data.message === 'OK' && data.status === "1") { if (data.message === 'OK' && data.status === "1") {
if (data.result.length) { 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) } else throw new Error('unable to retrieve contract data ' + data.message)
} catch (e) { } catch (e) {
console.error('etherscan contract data error', e);
throw new Error('unable to retrieve contract data: ' + e.message) 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.') } 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 params = queryParams.get() as UrlParametersType
const workspaces = await getWorkspaces() || [] const workspaces = await getWorkspaces() || []
dispatch(setWorkspaces(workspaces)) dispatch(setWorkspaces(workspaces))
console.error('PARAMS', params)
if (params.gist) { if (params.gist) {
await createWorkspaceTemplate('gist-sample', 'gist-template') await createWorkspaceTemplate('gist-sample', 'gist-template')
plugin.setWorkspace({ name: 'gist-sample', isLocalhost: false }) plugin.setWorkspace({ name: 'gist-sample', isLocalhost: false })

Loading…
Cancel
Save