Fixed specialFunction e2e

yann300-patch-36
David Disu 3 years ago committed by yann300
parent e31c3c210c
commit 8a36939f8c
  1. 5
      apps/remix-ide-e2e/src/commands/sendLowLevelTx.ts
  2. 1
      apps/remix-ide-e2e/src/tests/specialFunctions.test.ts
  3. 9
      libs/remix-ui/run-tab/src/lib/components/contractDropdownUI.tsx
  4. 19
      libs/remix-ui/run-tab/src/lib/components/value.tsx
  5. 7
      libs/remix-ui/run-tab/src/lib/reducers/runTab.ts
  6. 1
      libs/remix-ui/run-tab/src/lib/types/index.ts

@ -6,10 +6,11 @@ class sendLowLevelTx extends EventEmitter {
console.log('low level transact to ', address, value, callData)
this.api.waitForElementVisible(`#instance${address} #deployAndRunLLTxSendTransaction`, 1000)
.clearValue(`#instance${address} #deployAndRunLLTxCalldata`)
.setValue(`#instance${address} #deployAndRunLLTxCalldata`, callData)
.sendKeys(`#instance${address} #deployAndRunLLTxCalldata`, ['_', this.api.Keys.BACK_SPACE, callData])
.waitForElementVisible('#value')
.clearValue('#value')
.setValue('#value', value)
.sendKeys('#value', ['1', this.api.Keys.BACK_SPACE, value])
.pause(2000)
.scrollAndClick(`#instance${address} #deployAndRunLLTxSendTransaction`)
.perform(() => {
this.emit('complete')

@ -173,6 +173,7 @@ module.exports = {
.waitForElementVisible('#value')
.clearValue('#value')
.setValue('#value', '0')
.pause(2000)
.createContract('')
.clickInstance(1)
.pause(1000)

@ -26,7 +26,7 @@ export function ContractDropdownUI (props: ContractDropdownProps) {
const [loadedContractData, setLoadedContractData] = useState<ContractData>(null)
const [constructorInterface, setConstructorInterface] = useState<FuncABI>(null)
const [constructorInputs, setConstructorInputs] = useState(null)
const { contractList, loadType, currentFile } = props.contracts
const { contractList, loadType, currentFile, compilationCount } = props.contracts
useEffect(() => {
enableAtAddress(false)
@ -72,11 +72,13 @@ export function ContractDropdownUI (props: ContractDropdownProps) {
setCompFails('block')
}
initSelectedContract()
}, [loadType, currentFile])
}, [loadType, currentFile, compilationCount])
useEffect(() => {
if (selectedContract) {
const contract = contractList.find(contract => contract.alias === selectedContract)
if (contract) {
const loadedContractData = props.getSelectedContract(selectedContract, contract.name)
if (loadedContractData) {
@ -85,7 +87,8 @@ export function ContractDropdownUI (props: ContractDropdownProps) {
setConstructorInputs(loadedContractData.getConstructorInputs())
}
}
}, [selectedContract])
}
}, [selectedContract, compilationCount])
useEffect(() => {
initSelectedContract()

@ -5,11 +5,11 @@ import { isNumeric } from '@remix-ui/helper'
import { ValueProps } from '../types'
export function ValueUI (props: ValueProps) {
const inputValue = useRef(null)
const [sendValue, setSendValue] = useState<string>('')
const [sendValue, setSendValue] = useState<string>(props.sendValue)
const inputValue = useRef<HTMLInputElement>({} as HTMLInputElement)
useEffect(() => {
sendValue && props.setSendValue(sendValue)
(sendValue !== props.sendValue) && props.setSendValue(sendValue)
}, [sendValue])
const validateInputKey = (e) => {
@ -27,8 +27,7 @@ export function ValueUI (props: ValueProps) {
if (!value) {
// assign 0 if given value is
// - empty
setSendValue('0')
return
return setSendValue('0')
}
let v
@ -59,16 +58,16 @@ export function ValueUI (props: ValueProps) {
className="form-control udapp_gasNval udapp_col2"
id="value"
data-id="dandrValue"
value={sendValue || '0'}
title="Enter the value and choose the unit"
onKeyPress={validateInputKey}
onChange={validateValue}
value={props.sendValue}
/>
<select name="unit" value={props.sendUnit} className="form-control p-1 udapp_gasNvalUnit udapp_col2_2 custom-select" id="unit" onChange={(e) => { props.setUnit((e.target.value) as 'ether' | 'finney' | 'gwei' | 'wei') }}>
<option data-unit="wei">Wei</option>
<option data-unit="gwei">Gwei</option>
<option data-unit="finney">Finney</option>
<option data-unit="ether">Ether</option>
<option data-unit="wei" value='wei'>Wei</option>
<option data-unit="gwei" value="gwei">Gwei</option>
<option data-unit="finney" value="finney">Finney</option>
<option data-unit="ether" value="ether">Ether</option>
</select>
</div>
</div>

@ -52,6 +52,7 @@ export interface RunTabState {
}[],
loadType: 'abi' | 'sol' | 'other'
currentFile: string,
compilationCount: number,
isRequesting: boolean,
isSuccessful: boolean,
error: string
@ -91,7 +92,7 @@ export const runTabInitialState: RunTabState = {
selectedAccount: ''
},
sendValue: '0',
sendUnit: 'ether',
sendUnit: 'wei',
gasLimit: 3000000,
selectExEnv: 'vm-london',
personalMode: false,
@ -145,6 +146,7 @@ export const runTabInitialState: RunTabState = {
contractList: [],
loadType: 'other',
currentFile: '',
compilationCount: 0,
isRequesting: false,
isSuccessful: false,
error: null
@ -475,7 +477,8 @@ export const runTabReducer = (state: RunTabState = runTabInitialState, action: A
...state,
contracts: {
...state.contracts,
currentFile: payload
currentFile: payload,
compilationCount: state.contracts.compilationCount + 1
}
}
}

@ -156,6 +156,7 @@ export interface ContractDropdownProps {
}[],
loadType: 'abi' | 'sol' | 'other',
currentFile: string,
compilationCount: number,
isRequesting: boolean,
isSuccessful: boolean,
error: string

Loading…
Cancel
Save