diff --git a/apps/remix-ide-e2e/src/tests/recorder.test.ts b/apps/remix-ide-e2e/src/tests/recorder.test.ts index 838ac567da..2bcd86f2ad 100644 --- a/apps/remix-ide-e2e/src/tests/recorder.test.ts +++ b/apps/remix-ide-e2e/src/tests/recorder.test.ts @@ -11,7 +11,7 @@ module.exports = { return sources }, - 'Test Recorder': function (browser: NightwatchBrowser) { + 'Run Scenario': function (browser: NightwatchBrowser) { let addressRef browser.addFile('scenario.json', { content: records }) .pause(5000) @@ -34,7 +34,10 @@ module.exports = { .perform(() => done()) }) .click('*[data-id="deployAndRunClearInstances"]') - .testContracts('testRecorder.sol', sources[0]['testRecorder.sol'], ['testRecorder']) + + }, + 'Save scenario': function (browser: NightwatchBrowser) { + browser.testContracts('testRecorder.sol', sources[0]['testRecorder.sol'], ['testRecorder']) .clickLaunchIcon('udapp') .createContract('12') .clickInstance(0) @@ -45,7 +48,7 @@ module.exports = { const modalOk = document.querySelector('[data-id="udappNotify-modal-footer-ok-react"]') as any modalOk.click() - }) + }).pause(1000) .getEditorValue(function (result) { const parsed = JSON.parse(result) browser.assert.equal(JSON.stringify(parsed.transactions[0].record.parameters), JSON.stringify(scenario.transactions[0].record.parameters)) @@ -61,7 +64,7 @@ module.exports = { }) }, - 'Record more than one contract': function (browser: NightwatchBrowser) { + 'Record more than one contract': !function (browser: NightwatchBrowser) { // deploy 2 contracts (2 different ABIs), save the record, reexecute and test one of the function. browser .click('*[data-id="deployAndRunClearInstances"]') diff --git a/libs/remix-ui/run-tab/src/lib/actions/index.ts b/libs/remix-ui/run-tab/src/lib/actions/index.ts index 95ef6f8a76..18635bb1d7 100644 --- a/libs/remix-ui/run-tab/src/lib/actions/index.ts +++ b/libs/remix-ui/run-tab/src/lib/actions/index.ts @@ -636,13 +636,13 @@ export const runTransactions = ( ) } -const saveScenario = (newPath: string, provider, promptCb, cb) => { +const saveScenario = async (newPath: string, provider, promptCb, cb) => { const txJSON = JSON.stringify(plugin.recorder.getAll(), null, 2) - promptCb(() => { + promptCb(async () => { try { - if (!provider.set(newPath, txJSON)) return cb('Failed to create file ' + newPath) - plugin.fileManager.open(newPath) + await provider.set(newPath, txJSON) + await plugin.fileManager.open(newPath) } catch (error) { if (error) return cb('Failed to create file. ' + newPath + ' ' + error) } @@ -651,7 +651,7 @@ const saveScenario = (newPath: string, provider, promptCb, cb) => { export const storeScenario = async (prompt: (msg: string, defaultValue: string) => JSX.Element) => { const path = plugin.fileManager.currentPath() - const fileProvider = plugin.fileManager.fileProviderOf(path) + const fileProvider = await plugin.fileManager.fileProviderOf(path) if (!fileProvider) return displayNotification('Alert', 'Invalid File Provider', 'OK', null) const newPath = await createNonClashingNameAsync(path + '/' + plugin.REACT_API.recorder.pathToScenario, plugin.fileManager)