record test fix

pull/2035/head
filip mertens 3 years ago
parent f111483d26
commit 7dee1a02e6
  1. 11
      apps/remix-ide-e2e/src/tests/recorder.test.ts
  2. 10
      libs/remix-ui/run-tab/src/lib/actions/index.ts

@ -11,7 +11,7 @@ module.exports = {
return sources return sources
}, },
'Test Recorder': function (browser: NightwatchBrowser) { 'Run Scenario': function (browser: NightwatchBrowser) {
let addressRef let addressRef
browser.addFile('scenario.json', { content: records }) browser.addFile('scenario.json', { content: records })
.pause(5000) .pause(5000)
@ -34,7 +34,10 @@ module.exports = {
.perform(() => done()) .perform(() => done())
}) })
.click('*[data-id="deployAndRunClearInstances"]') .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') .clickLaunchIcon('udapp')
.createContract('12') .createContract('12')
.clickInstance(0) .clickInstance(0)
@ -45,7 +48,7 @@ module.exports = {
const modalOk = document.querySelector('[data-id="udappNotify-modal-footer-ok-react"]') as any const modalOk = document.querySelector('[data-id="udappNotify-modal-footer-ok-react"]') as any
modalOk.click() modalOk.click()
}) }).pause(1000)
.getEditorValue(function (result) { .getEditorValue(function (result) {
const parsed = JSON.parse(result) const parsed = JSON.parse(result)
browser.assert.equal(JSON.stringify(parsed.transactions[0].record.parameters), JSON.stringify(scenario.transactions[0].record.parameters)) 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. // deploy 2 contracts (2 different ABIs), save the record, reexecute and test one of the function.
browser browser
.click('*[data-id="deployAndRunClearInstances"]') .click('*[data-id="deployAndRunClearInstances"]')

@ -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) const txJSON = JSON.stringify(plugin.recorder.getAll(), null, 2)
promptCb(() => { promptCb(async () => {
try { try {
if (!provider.set(newPath, txJSON)) return cb('Failed to create file ' + newPath) await provider.set(newPath, txJSON)
plugin.fileManager.open(newPath) await plugin.fileManager.open(newPath)
} catch (error) { } catch (error) {
if (error) return cb('Failed to create file. ' + newPath + ' ' + 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) => { export const storeScenario = async (prompt: (msg: string, defaultValue: string) => JSX.Element) => {
const path = plugin.fileManager.currentPath() 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) if (!fileProvider) return displayNotification('Alert', 'Invalid File Provider', 'OK', null)
const newPath = await createNonClashingNameAsync(path + '/' + plugin.REACT_API.recorder.pathToScenario, plugin.fileManager) const newPath = await createNonClashingNameAsync(path + '/' + plugin.REACT_API.recorder.pathToScenario, plugin.fileManager)

Loading…
Cancel
Save