onload strategy

pull/5370/head
filip mertens 11 months ago
parent 2a19328ae9
commit 3cc45847ed
  1. 2
      .circleci/config.yml
  2. 35
      apps/etherscan/src/app/app.tsx
  3. 2
      apps/remix-ide-e2e/src/tests/etherscan_api.test.ts

@ -3,7 +3,7 @@ version: 2.1
parameters:
run_flaky_tests:
type: boolean
default: false
default: true
orbs:
browser-tools: circleci/browser-tools@1.4.4
win: circleci/windows@5.0

@ -40,22 +40,31 @@ const App = () => {
contractsRef.current = contracts
useEffect(() => {
plugin.internalEvents.on('etherscan_activated', () => {
plugin.on('solidity', 'compilationFinished', (fileName: string, source: CompilationFileSources, languageVersion: string, data: CompilationResult) => {
const newContractsNames = getNewContractNames(data)
const setListeners = () => {
plugin.on('solidity', 'compilationFinished', (fileName: string, source: CompilationFileSources, languageVersion: string, data: CompilationResult) => {
const newContractsNames = getNewContractNames(data)
const newContractsToSave: string[] = [...contractsRef.current, ...newContractsNames]
const newContractsToSave: string[] = [...contractsRef.current, ...newContractsNames]
const uniqueContracts: string[] = [...new Set(newContractsToSave)]
setContracts(uniqueContracts)
})
plugin.on('blockchain' as any, 'networkStatus', (result) => {
setNetworkName(`${result.network.name} ${result.network.id !== '-' ? `(Chain id: ${result.network.id})` : '(Not supported)'}`)
})
// @ts-ignore
plugin.call('blockchain', 'getCurrentNetworkStatus').then((result: any) => setNetworkName(`${result.network.name} ${result.network.id !== '-' ? `(Chain id: ${result.network.id})` : '(Not supported)'}`))
const uniqueContracts: string[] = [...new Set(newContractsToSave)]
}
setContracts(uniqueContracts)
})
plugin.on('blockchain' as any, 'networkStatus', (result) => {
setNetworkName(`${result.network.name} ${result.network.id !== '-' ? `(Chain id: ${result.network.id})` : '(Not supported)'}`)
})
// @ts-ignore
plugin.call('blockchain', 'getCurrentNetworkStatus').then((result: any) => setNetworkName(`${result.network.name} ${result.network.id !== '-' ? `(Chain id: ${result.network.id})` : '(Not supported)'}`))
useEffect(() => {
plugin.onload(() => {
console.log('plugin loaded')
console.log(plugin.isLoaded)
setListeners()
})
plugin.internalEvents.on('etherscan_activated', () => {
})
}, [])

@ -24,7 +24,7 @@ module.exports = {
.click('[data-id="save-api-key"]')
},
'Should verify a contract (contract is already verified) #group1': function (browser: NightwatchBrowser) {
'Should verify a contract (contract is already verified) #group1 #flaky': function (browser: NightwatchBrowser) {
browser
.frameParent()
.clickLaunchIcon('udapp') // switch to Goerli

Loading…
Cancel
Save