pull/5370/head
filip mertens 2 years ago
parent 9cbbff3dae
commit 4baacbe025
  1. 4
      apps/remix-ide-e2e/src/commands/checkVariableDebug.ts
  2. 4
      apps/remix-ide-e2e/src/commands/clickLaunchIcon.ts
  3. 4
      apps/remix-ide-e2e/src/helpers/init.ts
  4. 4
      apps/remix-ide-e2e/src/tests/ballot_0_4_14.test.ts
  5. 3
      apps/remix-ide-e2e/src/tests/debugger.test.ts
  6. 1
      apps/remix-ide-e2e/src/tests/erc721.test.ts
  7. 1
      apps/remix-ide-e2e/src/tests/proxy.test.ts
  8. 1
      apps/remix-ide-e2e/src/tests/solidityUnittests.test.ts
  9. 2
      apps/remix-ide-e2e/src/tests/transactionExecution.test.ts
  10. 1
      libs/remix-ui/editor/src/lib/remix-ui-editor.tsx
  11. 8
      libs/remix-ui/solidity-compiler/src/lib/compiler-container.tsx
  12. 2
      package.json

@ -19,22 +19,20 @@ function checkDebug(browser: NightwatchBrowser, id: string, debugValue: Nightwat
// id is soliditylocals or soliditystate // id is soliditylocals or soliditystate
let resultOfElement = null let resultOfElement = null
let isEqual = false let isEqual = false
// waitUntil will run with intervals of 1000ms for 10 seconds until the condition is met
browser.waitUntil(() => { browser.waitUntil(() => {
browser.execute(function (id: string) { browser.execute(function (id: string) {
const elem = document.querySelector('#' + id + ' .dropdownrawcontent') as HTMLElement const elem = document.querySelector('#' + id + ' .dropdownrawcontent') as HTMLElement
if (elem && elem.innerText) { if (elem && elem.innerText) {
console.log(elem.innerText)
return elem.innerText return elem.innerText
} }
}, [id], (result) => { }, [id], (result) => {
if (result.value) { if (result.value) {
console.log(JSON.parse(<string>result.value))
try { try {
resultOfElement = JSON.parse(<string>result.value) resultOfElement = JSON.parse(<string>result.value)
isEqual = deepequal(debugValue, resultOfElement) isEqual = deepequal(debugValue, resultOfElement)
} catch (e) { } catch (e) {
browser.assert.fail('cant parse solidity state', e.message, '') browser.assert.fail('cant parse solidity state', e.message, '')
console.log(e)
} }
} }
}) })

@ -5,9 +5,7 @@ class ClickLaunchIcon extends EventEmitter {
command (this: NightwatchBrowser, icon: string): NightwatchBrowser { command (this: NightwatchBrowser, icon: string): NightwatchBrowser {
this.api this.api
.waitForElementVisible('#icon-panel div[plugin="' + icon + '"]') .waitForElementVisible('#icon-panel div[plugin="' + icon + '"]')
.click('#icon-panel div[plugin="' + icon + '"]', (result) => { .click('#icon-panel div[plugin="' + icon + '"]')
console.log('clicking on ', result.status)
})
.perform((done) => { .perform((done) => {
done() done()
this.emit('complete') this.emit('complete')

@ -10,8 +10,7 @@ type LoadPlugin = {
export default function (browser: NightwatchBrowser, callback: VoidFunction, url?: string, preloadPlugins = true, loadPlugin?: LoadPlugin): void { export default function (browser: NightwatchBrowser, callback: VoidFunction, url?: string, preloadPlugins = true, loadPlugin?: LoadPlugin): void {
browser browser
.url(url || 'http://127.0.0.1:8080') .url(url || 'http://127.0.0.1:8080')
//.pause(6000) //.switchBrowserTab(0)
.switchBrowserTab(0)
.waitForElementVisible('[id="remixTourSkipbtn"]') .waitForElementVisible('[id="remixTourSkipbtn"]')
.click('[id="remixTourSkipbtn"]') .click('[id="remixTourSkipbtn"]')
@ -24,7 +23,6 @@ export default function (browser: NightwatchBrowser, callback: VoidFunction, url
localStorage.setItem('test-plugin-url', loadPlugin.url) localStorage.setItem('test-plugin-url', loadPlugin.url)
}, [loadPlugin]) }, [loadPlugin])
.refreshPage() .refreshPage()
.waitForElementVisible('[data-id="sidePanelSwapitTitle"]')
.perform(done()) .perform(done())
}) })
.verifyLoad() .verifyLoad()

@ -16,7 +16,7 @@ module.exports = {
'@sources': function () { '@sources': function () {
return sources return sources
}, },
'Add Ballot #group1 #group2': function (browser: NightwatchBrowser) { 'Add Ballot': function (browser: NightwatchBrowser) {
browser browser
.addFile('Untitled.sol', sources[0]['Untitled.sol']) .addFile('Untitled.sol', sources[0]['Untitled.sol'])
}, },
@ -30,7 +30,7 @@ module.exports = {
.verify.elementPresent('[data-id="compilerContainerAutoCompile"]:checked') .verify.elementPresent('[data-id="compilerContainerAutoCompile"]:checked')
}, },
'Compile Ballot with compiler version 0.4.14 #group1 #group2': function (browser: NightwatchBrowser) { 'Compile Ballot with compiler version 0.4.14': function (browser: NightwatchBrowser) {
browser browser
.testContracts('Untitled.sol', sources[0]['Untitled.sol'], ['Ballot']) .testContracts('Untitled.sol', sources[0]['Untitled.sol'], ['Ballot'])
}, },

@ -15,10 +15,11 @@ module.exports = {
'Should launch debugger #group1': function (browser: NightwatchBrowser) { 'Should launch debugger #group1': function (browser: NightwatchBrowser) {
browser.addFile('blah.sol', sources[0]['blah.sol']) browser.addFile('blah.sol', sources[0]['blah.sol'])
.pause(4000) .pause(4000)
// on autocompile sometimes the compiler returns invalid source, so we need to recompile to make sure the source is valid
.clickLaunchIcon('solidity').click('*[data-id="compilerContainerCompileBtn"]') .clickLaunchIcon('solidity').click('*[data-id="compilerContainerCompileBtn"]')
.pause(4000) .pause(4000)
.clickLaunchIcon('udapp') .clickLaunchIcon('udapp')
.waitForElementPresent('*[title="Deploy - transact (not payable)"]', 180000) .waitForElementPresent('*[title="Deploy - transact (not payable)"]', 60000)
.click('*[title="Deploy - transact (not payable)"]') .click('*[title="Deploy - transact (not payable)"]')
.debugTransaction(0) .debugTransaction(0)
.waitForElementContainsText('*[data-id="sidePanelSwapitTitle"]', 'DEBUGGER', 60000) .waitForElementContainsText('*[data-id="sidePanelSwapitTitle"]', 'DEBUGGER', 60000)

@ -28,6 +28,7 @@ module.exports = {
.waitForElementVisible('*[data-id="treeViewLitreeViewItemcontracts"]') .waitForElementVisible('*[data-id="treeViewLitreeViewItemcontracts"]')
.waitForElementVisible('*[data-id="treeViewLitreeViewItemcontracts/MyToken.sol"]') .waitForElementVisible('*[data-id="treeViewLitreeViewItemcontracts/MyToken.sol"]')
.openFile('contracts/MyToken.sol') .openFile('contracts/MyToken.sol')
// because the compilatiom imports are slow and sometimes stop loading (not sure why, it's bug) we need to recompile and check to see if the files are really in de FS
.clickLaunchIcon('solidity') .clickLaunchIcon('solidity')
.pause(2000) .pause(2000)
.click('[data-id="compilerContainerCompileBtn"]') .click('[data-id="compilerContainerCompileBtn"]')

@ -20,6 +20,7 @@ module.exports = {
.addFile('myTokenV1.sol', sources[0]['myTokenV1.sol']) .addFile('myTokenV1.sol', sources[0]['myTokenV1.sol'])
.clickLaunchIcon('solidity') .clickLaunchIcon('solidity')
.pause(2000) .pause(2000)
// because the compilatiom imports are slow and sometimes stop loading (not sure why, it's bug) we need to recompile and check to see if the files are really in de FS
.click('[data-id="compilerContainerCompileBtn"]') .click('[data-id="compilerContainerCompileBtn"]')
.clickLaunchIcon('filePanel') .clickLaunchIcon('filePanel')
.isVisible({ .isVisible({

@ -271,7 +271,6 @@ module.exports = {
'Debug tests using debugger #group7': function (browser: NightwatchBrowser) { 'Debug tests using debugger #group7': function (browser: NightwatchBrowser) {
browser browser
//.pause()
.waitForElementPresent('*[data-id="verticalIconsKindfilePanel"]') .waitForElementPresent('*[data-id="verticalIconsKindfilePanel"]')
.addFile('tests/ballotFailedDebug_test.sol', sources[0]['tests/ballotFailedDebug_test.sol']) .addFile('tests/ballotFailedDebug_test.sol', sources[0]['tests/ballotFailedDebug_test.sol'])
.clickLaunchIcon('solidityUnitTesting') .clickLaunchIcon('solidityUnitTesting')

@ -23,8 +23,6 @@ module.exports = {
status: 'true Transaction mined and execution succeed', status: 'true Transaction mined and execution succeed',
'decoded output': { 0: 'uint256: 8' } 'decoded output': { 0: 'uint256: 8' }
}) })
//.pause(5000)
//.checkTerminalFilter('0x12332162e2e31397dc1e07ed0a1cf08f728e9b4487c6f9ed79d2f39410c92782', '')
.clickFunction('g - transact (not payable)') .clickFunction('g - transact (not payable)')
.testFunction('last', .testFunction('last',
{ {

@ -606,6 +606,7 @@ export const EditorUI = (props: EditorUIProps) => {
} }
return result return result
} }
// just for e2e testing
const loadedElement = document.createElement('span') const loadedElement = document.createElement('span')
loadedElement.setAttribute('data-id', 'editorloaded') loadedElement.setAttribute('data-id', 'editorloaded')
document.body.appendChild(loadedElement) document.body.appendChild(loadedElement)

@ -61,7 +61,6 @@ export const CompilerContainer = (props: CompilerContainerProps) => {
const [showFilePathInput, setShowFilePathInput] = useState<boolean>(false) const [showFilePathInput, setShowFilePathInput] = useState<boolean>(false)
const [toggleExpander, setToggleExpander] = useState<boolean>(false) const [toggleExpander, setToggleExpander] = useState<boolean>(false)
const [disableCompileButton, setDisableCompileButton] = useState<boolean>(false) const [disableCompileButton, setDisableCompileButton] = useState<boolean>(false)
const [compilerLoadedVersion, setCompilerLoadedVersion] = useState<string>('')
const compileIcon = useRef(null) const compileIcon = useRef(null)
const promptMessageInput = useRef(null) const promptMessageInput = useRef(null)
const configFilePathInput = useRef(null) const configFilePathInput = useRef(null)
@ -187,7 +186,6 @@ export const CompilerContainer = (props: CompilerContainerProps) => {
loadingCompiler() loadingCompiler()
break break
case 'compilerLoaded': case 'compilerLoaded':
setCompilerLoadedVersion(state.selectedVersion)
compilerLoaded(compilerContainer.compiler.args[1]) compilerLoaded(compilerContainer.compiler.args[1])
break break
case 'compilationFinished': case 'compilationFinished':
@ -458,6 +456,11 @@ export const CompilerContainer = (props: CompilerContainerProps) => {
// just for e2e // just for e2e
// eslint-disable-next-line no-case-declarations // eslint-disable-next-line no-case-declarations
const elements = document.querySelectorAll('[data-id="compilerloaded"]')
// remove elements
for (let i = 0; i < elements.length; i++) {
elements[i].remove()
}
const loadedElement = document.createElement('span') const loadedElement = document.createElement('span')
loadedElement.setAttribute('data-id', 'compilerloaded') loadedElement.setAttribute('data-id', 'compilerloaded')
loadedElement.setAttribute('data-version', state.selectedVersion) loadedElement.setAttribute('data-version', state.selectedVersion)
@ -858,7 +861,6 @@ export const CompilerContainer = (props: CompilerContainerProps) => {
</div> </div>
</div> </div>
<div className="px-4"> <div className="px-4">
{compilerLoadedVersion ? <span data-id='compilerLoadedVersion' data-version={compilerLoadedVersion}></span> : ''}
<button id="compileBtn" data-id="compilerContainerCompileBtn" className="btn btn-primary btn-block d-block w-100 text-break remixui_disabled mb-1 mt-3" onClick={compile} disabled={(configFilePath === '' && state.useFileConfiguration) || disableCompileButton}> <button id="compileBtn" data-id="compilerContainerCompileBtn" className="btn btn-primary btn-block d-block w-100 text-break remixui_disabled mb-1 mt-3" onClick={compile} disabled={(configFilePath === '' && state.useFileConfiguration) || disableCompileButton}>
<OverlayTrigger overlay={ <OverlayTrigger overlay={
<Tooltip id="overlay-tooltip-compile"> <Tooltip id="overlay-tooltip-compile">

@ -67,7 +67,7 @@
"nightwatch_local_firefox": "yarn run build:e2e && nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js --env=firefox", "nightwatch_local_firefox": "yarn run build:e2e && nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js --env=firefox",
"nightwatch_local_chrome": "yarn run build:e2e && nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js --env=chrome", "nightwatch_local_chrome": "yarn run build:e2e && nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js --env=chrome",
"nightwatch_local_ballot": "yarn run build:e2e && nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js dist/apps/remix-ide-e2e/src/tests/ballot.test.js --env=chrome", "nightwatch_local_ballot": "yarn run build:e2e && nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js dist/apps/remix-ide-e2e/src/tests/ballot.test.js --env=chrome",
"nightwatch_local_ballot_0_4_11": "yarn run build:e2e && nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js dist/apps/remix-ide-e2e/src/tests/ballot_0_4_14.test.js --env=chrome", "nightwatch_local_ballot_0_4_14": "yarn run build:e2e && nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js dist/apps/remix-ide-e2e/src/tests/ballot_0_4_14.test.js --env=chrome",
"nightwatch_local_usingWorker": "yarn run build:e2e && nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js dist/apps/remix-ide-e2e/src/tests/usingWebWorker.test.js --env=chrome", "nightwatch_local_usingWorker": "yarn run build:e2e && nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js dist/apps/remix-ide-e2e/src/tests/usingWebWorker.test.js --env=chrome",
"nightwatch_local_libraryDeployment": "yarn run build:e2e && nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js dist/apps/remix-ide-e2e/src/tests/libraryDeployment.test.js --env=chrome", "nightwatch_local_libraryDeployment": "yarn run build:e2e && nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js dist/apps/remix-ide-e2e/src/tests/libraryDeployment.test.js --env=chrome",
"nightwatch_local_solidityImport": "yarn run build:e2e && nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js dist/apps/remix-ide-e2e/src/tests/solidityImport_*.test.js --env=chrome", "nightwatch_local_solidityImport": "yarn run build:e2e && nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js dist/apps/remix-ide-e2e/src/tests/solidityImport_*.test.js --env=chrome",

Loading…
Cancel
Save