Skip to content

Commit b64fb5d

Browse files
ioedeveloperAniket-Engg
authored andcommitted
await promise fulfilment
1 parent 8fa8586 commit b64fb5d

File tree

3 files changed

+27
-16
lines changed

3 files changed

+27
-16
lines changed

apps/remix-ide-e2e/src/tests/plugin_api.ts

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ const clickButton = async (browser: NightwatchBrowser, buttonText: string, waitR
6363
return new Promise((resolve) => {
6464
browser
6565
.scrollInto(`[data-id='${buttonText}']`)
66+
.pause(1000)
6667
.useXpath()
6768
.waitForElementVisible(`//*[@data-id='${buttonText}']`).pause(100)
6869
.click(`//*[@data-id='${buttonText}']`, async () => {
@@ -168,7 +169,7 @@ module.exports = {
168169
})
169170
},
170171

171-
'Should connect a local plugin #pr': function (browser: NightwatchBrowser) {
172+
'Should connect a local plugin ': function (browser: NightwatchBrowser) {
172173
browser.addLocalPlugin(localPluginData, true)
173174
// @ts-ignore
174175
.frame(0).useXpath()
@@ -263,37 +264,37 @@ module.exports = {
263264
await clickAndCheckLog(browser, 'fileManager-closeAllFiles', null, { event: 'noFileSelected', args: []}, null)
264265
},
265266

266-
'Should switch to file #group2 #pr': async function (browser: NightwatchBrowser) {
267+
'Should switch to file #group2': async function (browser: NightwatchBrowser) {
267268
await clickAndCheckLog(browser, 'fileManager-switchFile', null, { event: 'currentFileChanged', args: ['contracts/1_Storage.sol']}, 'contracts/1_Storage.sol')
268269
await clickAndCheckLog(browser, 'fileManager-getCurrentFile', 'contracts/1_Storage.sol', null, null)
269270
await clickAndCheckLog(browser, 'fileManager-switchFile', null, { event: 'currentFileChanged', args: ['README.txt']}, 'README.txt')
270271
await clickAndCheckLog(browser, 'fileManager-getCurrentFile', 'README.txt', null, null)
271272
},
272-
'Should write to file #group2 #pr': async function (browser: NightwatchBrowser) {
273+
'Should write to file #group2': async function (browser: NightwatchBrowser) {
273274
await clickAndCheckLog(browser, 'fileManager-writeFile', null, { event: 'fileSaved', args: ['README.txt']}, ['README.txt', 'test'])
274275
browser.pause(4000, async () => {
275276
await clickAndCheckLog(browser, 'fileManager-getFile', 'test', null, 'README.txt')
276277
})
277278
},
278-
'Should set file #group2 #pr': async function (browser: NightwatchBrowser) {
279+
'Should set file #group2': async function (browser: NightwatchBrowser) {
279280
await clickAndCheckLog(browser, 'fileManager-setFile', null, { event: 'fileAdded', args: ['new.sol']}, ['new.sol', 'test'])
280281
await clickAndCheckLog(browser, 'fileManager-readFile', 'test', null, 'new.sol')
281282
},
282-
'Should write to new file #group2 #pr': async function (browser: NightwatchBrowser) {
283+
'Should write to new file #group2': async function (browser: NightwatchBrowser) {
283284
await clickAndCheckLog(browser, 'fileManager-writeFile', null, { event: 'fileAdded', args: ['testing.txt']}, ['testing.txt', 'test'])
284285
await clickAndCheckLog(browser, 'fileManager-readFile', 'test', null, 'testing.txt')
285286
},
286-
'Should rename file #group2 #pr': async function (browser: NightwatchBrowser) {
287+
'Should rename file #group2': async function (browser: NightwatchBrowser) {
287288
await clickAndCheckLog(browser, 'fileManager-rename', null, null, ['testing.txt', 'testrename.txt'])
288289
await clickAndCheckLog(browser, 'fileManager-readFile', 'test', null, 'testrename.txt')
289290
},
290291

291-
'Should create empty workspace #group2 #pr': async function (browser: NightwatchBrowser) {
292+
'Should create empty workspace #group2': async function (browser: NightwatchBrowser) {
292293
await clickAndCheckLog(browser, 'filePanel-createWorkspace', null, null, ['emptyworkspace', true])
293294
await clickAndCheckLog(browser, 'filePanel-getCurrentWorkspace', { name: 'emptyworkspace', isLocalhost: false, absolutePath: '.workspaces/emptyworkspace' }, null, null)
294295
await clickAndCheckLog(browser, 'fileManager-readdir', {}, null, '/')
295296
},
296-
'Should create workspace #group2 #pr': async function (browser: NightwatchBrowser) {
297+
'Should create workspace #group2': async function (browser: NightwatchBrowser) {
297298
await clickAndCheckLog(browser, 'filePanel-createWorkspace', null, null, 'testspace')
298299
await clickAndCheckLog(browser, 'filePanel-getCurrentWorkspace', { name: 'testspace', isLocalhost: false, absolutePath: '.workspaces/testspace' }, null, null)
299300
await clickAndCheckLog(browser, 'fileManager-readdir', {
@@ -305,24 +306,24 @@ module.exports = {
305306
"remix.config.json": { "isDirectory": false },
306307
}, null, '/')
307308
},
308-
'Should get all workspaces #group2 #pr': async function (browser: NightwatchBrowser) {
309+
'Should get all workspaces #group2': async function (browser: NightwatchBrowser) {
309310
await clickAndCheckLog(browser, 'topbar-getWorkspaces', [{ name:"default_workspace",isGitRepo:false,hasGitSubmodules:false,isGist:null }, { name:"emptyworkspace",isGitRepo:false,hasGitSubmodules:false,isGist:null }, { name:"testspace",isGitRepo:false,hasGitSubmodules:false,isGist:null }], null, null)
310311
},
311-
'Should have set workspace event #group2 #pr': async function (browser: NightwatchBrowser) {
312+
'Should have set workspace event #group2': async function (browser: NightwatchBrowser) {
312313
await clickAndCheckLog(browser, 'filePanel-createWorkspace', null, { event: 'setWorkspace', args: [{ name: 'newspace', isLocalhost: false }]}, 'newspace')
313314
},
314-
'Should have event when switching workspace #group2 #pr': async function (browser: NightwatchBrowser) {
315+
'Should have event when switching workspace #group2': async function (browser: NightwatchBrowser) {
315316
// @ts-ignore
316317
browser.frameParent().useCss().clickLaunchIcon('filePanel').switchWorkspace('default_workspace').useXpath().click('//*[@data-id="verticalIconsKindlocalPlugin"]').frame(0, async () => {
317318
await clickAndCheckLog(browser, null, null, { event: 'setWorkspace', args: [{ name: 'default_workspace', isLocalhost: false }]}, null)
318319
})
319320
},
320321

321-
'Should rename workspace #group2 #pr': async function (browser: NightwatchBrowser) {
322+
'Should rename workspace #group2': async function (browser: NightwatchBrowser) {
322323
await clickAndCheckLog(browser, 'filePanel-renameWorkspace', null, null, ['default_workspace', 'renamed'])
323324
await clickAndCheckLog(browser, 'topbar-getWorkspaces', [{ name:"emptyworkspace",isGitRepo:false,hasGitSubmodules:false,isGist:null },{ name:"testspace",isGitRepo:false,hasGitSubmodules:false,isGist:null },{ name:"newspace",isGitRepo:false,hasGitSubmodules:false,isGist:null },{ name:"renamed",isGitRepo:false,hasGitSubmodules:false,isGist:null }], null, null)
324325
},
325-
'Should delete workspace #group2 #pr': async function (browser: NightwatchBrowser) {
326+
'Should delete workspace #group2': async function (browser: NightwatchBrowser) {
326327
await clickAndCheckLog(browser, 'filePanel-deleteWorkspace', null, null, ['testspace'])
327328
await clickAndCheckLog(browser, 'topbar-getWorkspaces', [{ name:"emptyworkspace",isGitRepo:false,hasGitSubmodules:false,isGist:null },{ name:"newspace",isGitRepo:false,hasGitSubmodules:false,isGist:null },{ name:"renamed",isGitRepo:false,hasGitSubmodules:false,isGist:null }], null, null)
328329
},

libs/remix-ui/solidity-compiler/src/lib/compiler-container.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -440,9 +440,9 @@ export const CompilerContainer = (props: CompilerContainerProps) => {
440440
const remixConfig = await api.readFile(remixConfigPath)
441441
const remixConfigContent = JSON.parse(remixConfig)
442442

443-
if (!remixConfigContent['solidity-compiler']) createNewConfigFile()
443+
if (!remixConfigContent['solidity-compiler']) await createNewConfigFile()
444444
} else {
445-
createNewConfigFile()
445+
await createNewConfigFile()
446446
}
447447
}
448448
_setCompilerVersionFromPragma(currentFile)

libs/remix-ui/solidity-compiler/src/lib/logic/compileTabLogic.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { ICompilerApi } from '@remix-project/remix-lib'
22
import { getValidLanguage, Compiler } from '@remix-project/remix-solidity'
33
import { EventEmitter } from 'events'
4+
import { configFileContent } from '../compilerConfiguration'
45

56
declare global {
67
interface Window {
@@ -114,7 +115,16 @@ export class CompileTabLogic {
114115
if (configExists) {
115116
const configContent = await this.api.readFile(remixConfigPath)
116117
const config = JSON.parse(configContent)
117-
this.compiler.set('configFileContent', config['solidity-compiler'])
118+
119+
if (config['solidity-compiler']) {
120+
this.compiler.set('configFileContent', config['solidity-compiler'])
121+
} else {
122+
this.compiler.set('configFileContent', JSON.parse(configFileContent))
123+
this.api.writeFile(remixConfigPath, JSON.stringify({ ...config, 'solidity-compiler': JSON.parse(configFileContent) }, null, 2))
124+
}
125+
} else {
126+
this.compiler.set('configFileContent', JSON.parse(configFileContent))
127+
this.api.writeFile(remixConfigPath, JSON.stringify({ 'solidity-compiler': JSON.parse(configFileContent) }, null, 2))
118128
}
119129
}
120130
}

0 commit comments

Comments
 (0)