e2e added. scrol of fE fixed

pull/2470/head
lianahus 3 years ago committed by yann300
parent 3d123440b7
commit a0162a8ac4
  1. 23
      apps/remix-ide-e2e/src/commands/verifyContracts.ts
  2. 35
      apps/remix-ide-e2e/src/tests/ballot.test.ts
  3. 1
      apps/remix-ide-e2e/src/tests/compiler_api.test.ts
  4. 2
      apps/remix-ide-e2e/src/types/index.d.ts
  5. 23
      libs/remix-ui/solidity-compiler/src/lib/compiler-container.tsx
  6. 1
      libs/remix-ui/workspace/src/lib/css/remix-ui-workspace.css
  7. 6
      libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx

@ -2,7 +2,7 @@ import { NightwatchBrowser } from 'nightwatch'
import EventEmitter from 'events'
class VerifyContracts extends EventEmitter {
command (this: NightwatchBrowser, compiledContractNames: string[], opts = { wait: 1000, version: null }): NightwatchBrowser {
command (this: NightwatchBrowser, compiledContractNames: string[], opts = { wait: 1000, version: null, runs: '200' }): NightwatchBrowser {
this.api.perform((done) => {
verifyContracts(this.api, compiledContractNames, opts, () => {
done()
@ -13,7 +13,7 @@ class VerifyContracts extends EventEmitter {
}
}
function verifyContracts (browser: NightwatchBrowser, compiledContractNames: string[], opts: { wait: number, version?: string }, callback: VoidFunction) {
function verifyContracts (browser: NightwatchBrowser, compiledContractNames: string[], opts: { wait: number, version?: string, runs?: string }, callback: VoidFunction) {
browser
.clickLaunchIcon('solidity')
.pause(opts.wait)
@ -36,6 +36,25 @@ function verifyContracts (browser: NightwatchBrowser, compiledContractNames: str
done()
callback()
})
} if (opts.runs) {
browser
.click('*[data-id="compilation-details"]')
.waitForElementVisible('*[data-id="remixui_treeviewitem_metadata"]')
.pause(2000)
.click('*[data-id="remixui_treeviewitem_metadata"]')
.waitForElementVisible('*[data-id="treeViewDivtreeViewItemsettings"]')
.pause(2000)
.click('*[data-id="treeViewDivtreeViewItemsettings"]')
.waitForElementVisible('*[data-id="treeViewDivtreeViewItemoptimizer"]')
.click('*[data-id="treeViewDivtreeViewItemoptimizer"]')
.waitForElementVisible('*[data-id="treeViewDivruns"]')
.assert.containsText('*[data-id="treeViewDivruns"]', `${opts.runs}`)
.click('[data-id="workspacesModalDialog-modal-footer-ok-react"]')
.perform(() => {
done()
callback()
})
} else {
compiledContractNames.forEach((name) => {
browser.waitForElementContainsText('[data-id="compiledContracts"]', name, 60000)

@ -123,6 +123,21 @@ module.exports = {
// Test in Udapp UI , treeViewDiv0 shows returned value on method click
.assert.containsText('*[data-id="treeViewDiv0"]', 'bytes32: winnerName_ 0x48656c6c6f20576f726c64210000000000000000000000000000000000000000')
.end()
},
'Compile Ballot using config file': function (browser: NightwatchBrowser) {
browser
.addFile('cf.json', {content: configFile})
.clickLaunchIcon('solidity')
.click('*[data-id="scConfigExpander"]')
.click('*[data-id="scFileConfiguration"]')
.click('*[data-id="scConfigChangeFilePath"]')
.click('*[data-id="scConfigFilePathInput]')
.clearValue('*[data-id="scConfigFilePathInput"]')
.setValue('*[data-id="scConfigFilePathInput"]', 'cf.json')
.openFile('Untitled.sol')
.pause(5000)
.verifyContracts(['Ballot'], {wait: 2000, runs: '300'})
}
}
@ -190,6 +205,7 @@ const stateCheck = {
immutable: false
}
}
const ballotABI = `[
{
"inputs": [
@ -356,3 +372,22 @@ const ballotABI = `[
"type": "function"
}
]`
const configFile = `
{
"language": "Solidity",
"settings": {
"optimizer": {
"enabled": true,
"runs": 300
},
"outputSelection": {
"*": {
"": ["ast"],
"*": []
}
},
"evmVersion": "byzantium"
}
}
`

@ -168,3 +168,4 @@ contract DoesNotCompile {
function fStackLimit(uint u1, uint u2, uint u3, uint u4, uint u5, uint u6, uint u7, uint u8, uint u9, uint u10, uint u11, uint u12) public {
}
}`

@ -11,7 +11,7 @@ declare module 'nightwatch' {
testContracts(fileName: string, contractCode: NightwatchContractContent, compiledContractNames: string[]): NightwatchBrowser,
setEditorValue(value: string, callback?: () => void): NightwatchBrowser,
addFile(name: string, content: NightwatchContractContent): NightwatchBrowser,
verifyContracts(compiledContractNames: string[], opts?: { wait: number, version?: string }): NightwatchBrowser,
verifyContracts(compiledContractNames: string[], opts?: { wait: number, version?: string, runs?: string }): NightwatchBrowser,
selectAccount(account?: string): NightwatchBrowser,
clickFunction(fnFullName: string, expectedInput?: NightwatchClickFunctionExpectedInput): NightwatchBrowser,
testFunction(txHash: string, expectedInput: NightwatchTestFunctionExpectedInput): NightwatchBrowser,

@ -67,20 +67,18 @@ export const CompilerContainer = (props: CompilerContainerProps) => {
const [compilerContainer, dispatch] = useReducer(compilerReducer, compilerInitialState)
useEffect(() => {
api.setAppParameter('configFilePath', defaultPath)
if (state.useFileConfiguration) {
api.fileExists(defaultPath).then((exists) => {
if (!exists || state.useFileConfiguration ) createNewConfigFile()
})
if (workspaceName) {
api.setAppParameter('configFilePath', defaultPath)
if (state.useFileConfiguration) {
api.fileExists(defaultPath).then((exists) => {
if (!exists || state.useFileConfiguration ) createNewConfigFile()
})
}
setShowFilePathInput(false)
}
api.setAppParameter('configFilePath', defaultPath)
setShowFilePathInput(false)
}, [workspaceName])
useEffect(() => {
if (state.useFileConfiguration)
api.fileExists(defaultPath).then((exists) => {
if (!exists || state.useFileConfiguration ) createNewConfigFile()
@ -781,7 +779,7 @@ export const CompilerContainer = (props: CompilerContainerProps) => {
</div>
</div>
<div className="d-flex pb-1 remixui_compilerConfig custom-control custom-radio">
<input className="custom-control-input" type="radio" name="configradio" value="file" onChange={toggleConfigType} checked={state.useFileConfiguration} id="scFileConfig" />
<input className="custom-control-input" type="radio" name="configradio" value="file" onChange={toggleConfigType} checked={state.useFileConfiguration} id="scFileConfig" data-id="scFileConfiguration"/>
<label className="form-check-label custom-control-label" htmlFor="scFileConfig">Use configuration file</label>
</div>
<div className={`pt-2 ml-4 ml-2 align-items-start justify-content-between d-flex`}>
@ -797,13 +795,14 @@ export const CompilerContainer = (props: CompilerContainerProps) => {
placeholder={"Enter the new path"}
title="If the file you entered does not exist you will be able to create one in the next step."
disabled={!state.useFileConfiguration}
data-id="scConfigFilePathInput"
onKeyPress={event => {
if (event.key === 'Enter') {
handleConfigPathChange()
}
}}
/>
{ !showFilePathInput && <button disabled={!state.useFileConfiguration} className="btn-secondary" onClick={() => {setShowFilePathInput(true)}}>Change</button> }
{ !showFilePathInput && <button disabled={!state.useFileConfiguration} data-id="scConfigChangeFilePath" className="btn-secondary" onClick={() => {setShowFilePathInput(true)}}>Change</button> }
</div>
</div>
<div className="px-4">

@ -13,6 +13,7 @@
padding-left : 6px;
padding-right : 6px;
padding-top : 6px;
overflow-y : auto;
}
.remixui_fileExplorerTree {
cursor : default;

@ -228,9 +228,9 @@ export function Workspace () {
</div>
</header>
</div>
<div className='remixui_fileExplorerTree'>
<div>
<div className='pl-2 remixui_treeview' data-id='filePanelFileExplorerTree'>
<div className='h-100 remixui_fileExplorerTree'>
<div className='h-100'>
<div className='pl-2 h-100 remixui_treeview' data-id='filePanelFileExplorerTree'>
{ (global.fs.mode === 'browser') && (currentWorkspace !== NO_WORKSPACE) &&
<FileExplorer
name={currentWorkspace}

Loading…
Cancel
Save