speed up tests

pull/5370/head
bunsenstraat 3 years ago
parent 772448cfd5
commit bfbaf85ca3
  1. 4
      apps/remix-ide-e2e/src/local-plugin/src/app/app.tsx
  2. 34
      apps/remix-ide-e2e/src/tests/plugin_api.ts
  3. 2
      apps/remix-ide/src/app/panels/file-panel.js

@ -25,6 +25,7 @@ function App () {
const [payload, setPayload] = useState<string>('')
const [append, setAppend] = useState<boolean>(false)
const [log, setLog] = useState<any>()
const [started, setStarted] = useState<boolean>(false)
const [events, setEvents] = useState<any>()
const [profiles, setProfiles] = useState<Profile[]>([pluginManagerProfile, filePanelProfile, filSystemProfile, dGitProfile, networkProfile, settingsProfile, editorProfile, terminalProfile, compilerProfile, udappProfile, contentImportProfile, windowProfile])
@ -76,6 +77,7 @@ function App () {
if (ob && !Array.isArray(ob)) { ob = [ob] }
} catch (e) { }
const args = ob || [payload]
setStarted(true)
console.log('calling :', profile.name, method, ...args)
await client.call('manager', 'activatePlugin', profile.name)
const result = await client.call(profile.name as any, method, ...args)
@ -84,11 +86,13 @@ function App () {
} catch (e) {
setLog(e.message)
}
setStarted(false)
}
return (
<div className="App container-fluid">
<h5>PLUGIN API TESTER</h5>
<label id='callStatus'>{started ? <>start</> : <>stop</> }</label><br></br>
<label>method results</label>
<Logger id='methods' log={log} append={append}></Logger>
<label>events</label>

@ -57,9 +57,11 @@ const setPayload = async (browser: NightwatchBrowser, payload: any) => {
const clickButton = async (browser: NightwatchBrowser, buttonText: string) => {
return new Promise((resolve) => {
browser.useXpath().waitForElementVisible(`//*[@data-id='${buttonText}']`)
.click(`//*[@data-id='${buttonText}']`)
.pause(5000, () => resolve(true))
browser.useXpath().waitForElementVisible(`//*[@data-id='${buttonText}']`).pause(100)
.click(`//*[@data-id='${buttonText}']`, async () => {
await checkForAcceptAndRemember(browser)
browser.waitForElementContainsText('//*[@id="callStatus"]', 'stop').perform(() => resolve(true))
})
})
}
@ -95,7 +97,6 @@ const clickAndCheckLog = async (browser: NightwatchBrowser, buttonText: string,
if (eventResult && typeof eventResult !== 'string') { eventResult = JSON.stringify(eventResult) }
if (buttonText) {
await clickButton(browser, buttonText)
await checkForAcceptAndRemember(browser)
}
await debugValues(browser, 'methods', methodResult)
await debugValues(browser, 'events', eventResult)
@ -122,7 +123,7 @@ module.exports = {
.frame(0).useXpath()
},
// FILESYSTEM
// context menu item
'Should create context menu item': async function (browser: NightwatchBrowser) {
await clickAndCheckLog(browser, 'filePanel:registerContextMenuItem', null, null, {
@ -135,20 +136,24 @@ module.exports = {
pattern: []
})
await browser.useXpath().frameParent(async () => {
await clickButton(browser, 'verticalIconsFileExplorerIcons')
// await clickButton(browser, 'treeViewLitreeViewItemcontracts')
browser.rightClick('*[data-id="treeViewLitreeViewItemcontracts/1_Storage.sol"]').waitForElementVisible('//*[@id="menuitemtestcommand"]').click('//*[@id="menuitemtestcommand"]', async () => {
browser.useCss().clickLaunchIcon('filePanel')
.rightClick('[data-id="treeViewLitreeViewItemcontracts/1_Storage.sol"]').useXpath().waitForElementVisible('//*[@id="menuitemtestcommand"]').click('//*[@id="menuitemtestcommand"]', async () => {
// @ts-ignore
browser.click('//*[@data-id="verticalIconsKindlocalPlugin"]').frame(0, async () => {
await clickAndCheckLog(browser, null, { id: 'localPlugin', name: 'testCommand', label: 'testCommand', type: [], extension: ['.sol'], path: ['contracts/1_Storage.sol'], pattern: [] }, null, null)
})
})
})
},
// FILESYSTEM
'Should get current workspace': async function (browser: NightwatchBrowser) {
await clickAndCheckLog(browser, 'filePanel:getCurrentWorkspace', { name: 'default_workspace', isLocalhost: false, absolutePath: '.workspaces/default_workspace' }, null, null)
},
'Should get current files': async function (browser: NightwatchBrowser) {
await clickAndCheckLog(browser, 'fileManager:readdir', { contracts: { isDirectory: true }, scripts: { isDirectory: true }, tests: { isDirectory: true }, 'README.txt': { isDirectory: false } }, null, null)
await clickAndCheckLog(browser, 'fileManager:readdir', { contracts: { isDirectory: true }, scripts: { isDirectory: true }, tests: { isDirectory: true }, 'README.txt': { isDirectory: false } }, null, '/')
},
'Should throw error on current file': async function (browser: NightwatchBrowser) {
await clickAndCheckLog(browser, 'fileManager:getCurrentFile', 'Error from IDE : Error: No such file or directory No file selected', null, null)
@ -217,11 +222,22 @@ module.exports = {
await clickAndCheckLog(browser, 'filePanel:createWorkspace', null, { event: 'setWorkspace', args: [{ name: 'newspace', isLocalhost: false }] }, 'newspace')
await setAppend(browser)
},
'Should rename workspace': async function (browser: NightwatchBrowser) {
await setAppend(browser)
await clickAndCheckLog(browser, 'filePanel:renameWorkspace', null, null, ['default_workspace', 'renamed'])
await clickAndCheckLog(browser, 'filePanel:getWorkspaces', ['emptyworkspace', 'testspace', 'newspace', 'renamed'], null, null)
await setAppend(browser)
},
// COMPILER
'Should compile a file': async function (browser: NightwatchBrowser) {
await setAppend(browser)
await clickAndCheckLog(browser, 'solidity:compile', null, null, 'contracts/1_Storage.sol')
browser.pause(5000, async () => {
await clickAndCheckLog(browser, 'solidity:compile', null, 'compilationFinished', null)
await setAppend(browser)
})
},
'Should get compilationresults': async function (browser: NightwatchBrowser) {

@ -35,7 +35,7 @@ const modalDialogCustom = require('../ui/modal-dialog-custom')
const profile = {
name: 'filePanel',
displayName: 'File explorers',
methods: ['createNewFile', 'uploadFile', 'getCurrentWorkspace', 'getWorkspaces', 'createWorkspace', 'setWorkspace', 'registerContextMenuItem'],
methods: ['createNewFile', 'uploadFile', 'getCurrentWorkspace', 'getWorkspaces', 'createWorkspace', 'setWorkspace', 'registerContextMenuItem', 'renameWorkspace'],
events: ['setWorkspace', 'renameWorkspace', 'deleteWorkspace', 'createWorkspace'],
icon: 'assets/img/fileManager.webp',
description: ' - ',

Loading…
Cancel
Save