fix tests & linting

pull/4355/head
yann300 11 months ago
parent f44183bd5b
commit 7c5c00687c
  1. 2
      apps/remix-ide-e2e/src/commands/sendLowLevelTx.ts
  2. 26
      apps/remix-ide-e2e/src/helpers/init.ts
  3. 4
      apps/remix-ide-e2e/src/tests/editor.test.ts
  4. 6
      apps/remix-ide-e2e/src/tests/editorHoverContext.test.ts
  5. 2
      apps/remix-ide-e2e/src/tests/etherscan_api.test.ts
  6. 2
      apps/remix-ide-e2e/src/tests/plugin_api.ts
  7. 4
      apps/remix-ide-e2e/src/tests/runAndDeploy.test.ts
  8. 4
      apps/remix-ide-e2e/src/tests/staticAnalysis.test.ts
  9. 5
      apps/remix-ide/src/app/editor/editor.js
  10. 6
      libs/remix-ui/editor/src/lib/actions/editor.ts
  11. 12
      libs/remix-ui/editor/src/lib/remix-ui-editor.tsx
  12. 8
      libs/remix-ui/run-tab/src/lib/components/value.tsx
  13. 5
      libs/remix-ui/solidity-unit-testing/src/lib/solidity-unit-testing.tsx
  14. 2
      libs/remix-ui/workspace/src/lib/components/workspace-hamburger-item.tsx

@ -9,7 +9,7 @@ class sendLowLevelTx extends EventEmitter {
.sendKeys(`#instance${address} #deployAndRunLLTxCalldata`, ['_', this.api.Keys.BACK_SPACE, callData])
.waitForElementVisible('#value')
.clearValue('#value')
.sendKeys('#value', ['1', this.api.Keys.BACK_SPACE, value])
.sendKeys('#value', value)
.pause(2000)
.scrollAndClick(`#instance${address} #deployAndRunLLTxSendTransaction`)
.perform(() => {

@ -10,8 +10,6 @@ type LoadPlugin = {
export default function (browser: NightwatchBrowser, callback: VoidFunction, url?: string, preloadPlugins = true, loadPlugin?: LoadPlugin, hideToolTips: boolean = true): void {
browser
.url(url || 'http://127.0.0.1:8080')
//.switchBrowserTab(0)
.perform((done) => {
if (!loadPlugin) return done()
browser
@ -34,21 +32,24 @@ export default function (browser: NightwatchBrowser, callback: VoidFunction, url
}
addStyle(`
.bs-popover-right {
display:none !important;
}
.bs-popover-top {
display:none !important;
}
.bs-popover-left {
display:none !important;
}
.bs-popover-bottom {
.popover {
display:none !important;
}
`);
})
}})
.perform(() => {
browser.execute(function () {
(window as any).logs = []
console.log = function () {
(window as any).logs.push(JSON.stringify(arguments))
}
console.error = function () {
(window as any).logs.push(JSON.stringify(arguments))
}
})
})
.perform(() => {
if (preloadPlugins) {
initModules(browser, () => {
browser
@ -58,7 +59,6 @@ export default function (browser: NightwatchBrowser, callback: VoidFunction, url
.verify.elementPresent('[data-id="compilerContainerAutoCompile"]:checked')
.perform(() => { callback() })
})
} else {
callback()
}

@ -20,13 +20,13 @@ module.exports = {
.checkElementStyle('.view-lines', 'font-size', '14px')
.click('*[data-id="tabProxyZoomIn"]')
.click('*[data-id="tabProxyZoomIn"]')
.checkElementStyle('.view-lines', 'font-size', '16px')
.checkElementStyle('.view-lines', 'font-size', '16.8px')
},
'Should zoom out editor #group1': function (browser: NightwatchBrowser) {
browser
.waitForElementVisible('#editorView')
.checkElementStyle('.view-lines', 'font-size', '16px')
.checkElementStyle('.view-lines', 'font-size', '16.8px')
.click('*[data-id="tabProxyZoomOut"]')
.click('*[data-id="tabProxyZoomOut"]')
.checkElementStyle('.view-lines', 'font-size', '14px')

@ -15,9 +15,9 @@ const checkEditorHoverContent = (browser: NightwatchBrowser, path: string, expec
module.exports = {
'@disabled': true,
before: function (browser: NightwatchBrowser, done: VoidFunction) {
init(browser, done, 'http://127.0.0.1:8080', false)
init(browser, done, 'http://127.0.0.1:8080', false, null, true)
},
'Should load the test file': function (browser: NightwatchBrowser) {
'Should load the test file #group1': function (browser: NightwatchBrowser) {
browser.openFile('contracts')
.openFile('contracts/3_Ballot.sol')
.waitForElementVisible('#editorView')
@ -86,7 +86,7 @@ module.exports = {
const expectedContent = 'StructDefinition'
checkEditorHoverContent(browser, path, expectedContent)
},
'Add token file': function (browser: NightwatchBrowser) {
'Add token file #group1': function (browser: NightwatchBrowser) {
browser
.clickLaunchIcon('solidity')
.setSolidityCompilerVersion('soljson-v0.8.20+commit.a1b79de6.js')

@ -45,7 +45,7 @@ module.exports = {
.setValue('*[name="contractAddress"]', ['0x9981c9d00103da481c3c65b22a79582a3e3ff50b', browser.Keys.TAB])
.click('[data-id="verify-contract"]')
.waitForElementVisible('[data-id="verify-result"]')
.waitForElementContainsText('[data-id="verify-result"]', 'Contract source code already verified')
.waitForElementContainsText('[data-id="verify-result"]', 'Contract source code already verified', 15000)
},
'Should call the etherscan plugin api #group1': function (browser: NightwatchBrowser) {

@ -431,7 +431,7 @@ module.exports = {
.waitForElementContainsText('*[data-shared="tooltipPopup"]', 'I am a re-toast')
},
'Should open 2 alerts from localplugin #group9': function (browser: NightwatchBrowser) {
'Should open 2 alerts from localplugin #group9': !function (browser: NightwatchBrowser) {
browser
.clickLaunchIcon('localPlugin')
.useXpath()

@ -81,10 +81,10 @@ module.exports = {
instanceAddress = address
browser
.waitForElementVisible(`#instance${instanceAddress} [data-id="instanceContractBal"]`)
.assert.containsText(`#instance${instanceAddress} [data-id="instanceContractBal"]`, 'Balance: 0.000000000000000111 ETH')
.waitForElementContainsText(`#instance${instanceAddress} [data-id="instanceContractBal"]`, 'Balance: 0.000000000000000111 ETH', 10000)
.clickFunction('sendSomeEther - transact (not payable)', { types: 'uint256 num', values: '2' })
.pause(1000)
.assert.containsText(`#instance${instanceAddress} [data-id="instanceContractBal"]`, 'Balance: 0.000000000000000109 ETH')
.waitForElementContainsText(`#instance${instanceAddress} [data-id="instanceContractBal"]`, 'Balance: 0.000000000000000109 ETH', 10000)
})
},

@ -46,14 +46,14 @@ module.exports = {
.waitForElementPresent('//*[@id="staticanalysisresult"]', 5000)
.useCss()
// Check warning count
.click('*[data-rb-event-key="remix"]')
.click('*[data-rr-ui-event-key="remix"]')
.assert.containsText('span#ssaRemixtab > *[data-id="RemixStaticAnalysisErrorCount"]', '1')
.verify.elementPresent('input[name="showLibWarnings"]')
.verify.not.elementPresent('input[name="showLibWarnings"]:checked')
.verify.elementPresent('label[id="headingshowLibWarnings"]')
.click('label[id="headingshowLibWarnings"]')
.pause(1000)
.click('*[data-rb-event-key="remix"]')
.click('*[data-rr-ui-event-key="remix"]')
.assert.containsText('span#ssaRemixtab > *[data-id="RemixStaticAnalysisErrorCount', '386')
.click('label[id="headingshowLibWarnings"]')
.pause(1000)

@ -402,10 +402,7 @@ class Editor extends Plugin {
*/
editorFontSize (incr) {
if (!this.activated) return
const newSize = this.api.getFontSize() + incr
if (newSize >= 6) {
this.emit('setFontSize', newSize)
}
this.emit('setFontSize', incr)
}
/**

@ -85,7 +85,11 @@ export const reducerActions = (models = initialState, action: Action) => {
case 'SET_FONTSIZE': {
if (!editor) return models
const size = action.payload.size
editor.updateOptions({ fontSize: size })
if (size === 1) {
editor.trigger('keyboard', 'editor.action.fontZoomIn', {});
} else{
editor.trigger('keyboard', 'editor.action.fontZoomOut', {});
}
return models
}
case 'SET_WORDWRAP': {

@ -645,14 +645,6 @@ export const EditorUI = (props: EditorUIProps) => {
}
})
// zoomin zoomout
editor.addCommand(monacoRef.current.KeyMod.CtrlCmd | (monacoRef.current.KeyCode as any).US_EQUAL, () => {
editor.updateOptions({fontSize: editor.getOption(51) + 1})
})
editor.addCommand(monacoRef.current.KeyMod.CtrlCmd | (monacoRef.current.KeyCode as any).US_MINUS, () => {
editor.updateOptions({fontSize: editor.getOption(51) - 1})
})
// add context menu items
const zoominAction = {
id: 'zoomIn',
@ -664,7 +656,7 @@ export const EditorUI = (props: EditorUIProps) => {
monacoRef.current.KeyMod.CtrlCmd | monacoRef.current.KeyCode.Equal,
],
run: () => {
editor.updateOptions({fontSize: editor.getOption(51) + 1})
editor.trigger('keyboard', 'editor.action.fontZoomIn', {});
}
}
const zoomOutAction = {
@ -677,7 +669,7 @@ export const EditorUI = (props: EditorUIProps) => {
monacoRef.current.KeyMod.CtrlCmd | monacoRef.current.KeyCode.Minus,
],
run: () => {
editor.updateOptions({fontSize: editor.getOption(51) - 1})
editor.trigger('keyboard', 'editor.action.fontZoomOut', {});
}
}
const formatAction = {

@ -13,6 +13,12 @@ export function ValueUI(props: ValueProps) {
sendValue !== props.sendValue && props.setSendValue(sendValue)
}, [sendValue])
useEffect(() => {
if(props.sendValue !== sendValue) {
setSendValue(props.sendValue)
}
},[props.sendValue])
const validateInputKey = (e) => {
// preventing not numeric keys
// preventing 000 case
@ -63,7 +69,7 @@ export function ValueUI(props: ValueProps) {
data-id="dandrValue"
onKeyPress={validateInputKey}
onChange={validateValue}
value={props.sendValue}
value={sendValue}
/>
</CustomTooltip>

@ -164,6 +164,11 @@ export const SolidityUnitTesting = (props: Record<string, any>) => {
}
})
testTab.on('filePanel', 'workspaceCreated', async () => {
setTimeout(async () => {
await setCurrentPath(defaultPath)}, 100)
})
testTab.on('filePanel', 'setWorkspace', async () => {
await setCurrentPath(defaultPath)
})

@ -78,7 +78,7 @@ export interface HamburgerSubMenuItemProps {
export function HamburgerSubMenuItem(props: HamburgerSubMenuItemProps) {
return (
<>
<NavDropdown title={props.title} as={CustomMenu} key={props.id} id={props.id} dir='right'>
<NavDropdown title={props.title} as={CustomMenu} key={props.id} id={props.id} drop={'end'}>
{props.subMenus.map((item) => (
<NavHamburgerMenuItem platforms={props.platforms} kind={item.kind} fa={item.fa} hideOption={item.hideOption} actionOnClick={item.actionOnClick} />
))}

Loading…
Cancel
Save