Skip to content

Commit

Permalink
add E2E
Browse files Browse the repository at this point in the history
  • Loading branch information
yann300 committed Feb 11, 2025
1 parent 349b917 commit 47ed2e3
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions apps/remix-ide-e2e/src/tests/vm_state.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,20 @@ const tests = {
)
},
'Should fork state successfully #group1': function (browser: NightwatchBrowser) {
let contractAddress = ''
browser
.openFile('contracts')
.openFile('contracts/1_Storage.sol')
.verifyContracts(['Storage'])
.clickLaunchIcon('udapp')
.click('[data-id="Deploy - transact (not payable)"]')
.clickInstance(0)
.perform((done) => {
browser.getAddressAtPosition(0, (address) => {
contractAddress = address
done()
})
})
.clickFunction('store - transact (not payable)', { types: 'uint256 num', values: '"55"' })
.testFunction('last',
{
Expand Down Expand Up @@ -81,6 +88,42 @@ const tests = {
browser.assert.ok(content.indexOf(`"db":`) !== -1)
browser.assert.ok(content.indexOf(`"blocks":`) !== -1)
})
// fork again this state
.click('*[data-id="fork-state-icon"]')
.waitForElementVisible('*[data-id="udappNotifyModalDialogModalTitle-react"]')
.click('input[data-id="modalDialogForkState"]')
.setValue('input[data-id="modalDialogForkState"]', 'forkedState_2')
.modalFooterOKClick('udappNotify')
// load the previous contract
.addAtAddressInstance(contractAddress, false, false, false)
.clickInstance(0)
// check that the state is loaded
.clickFunction('retrieve - call')
.testFunction('last',
{
'decoded output': { '0': 'uint256: 55' }
})
// update the state
.clickFunction('store - transact (not payable)', { types: 'uint256 num', values: '"57"' })
.testFunction('last',
{
status: '0x1 Transaction mined and execution succeed',
'decoded input': { 'uint256 num': '57' }
})
.clickFunction('retrieve - call')
.testFunction('last',
{
'decoded output': { '0': 'uint256: 57' }
})
// switch back to the previous state and check the value hasn't changed.
.switchWorkspace('forkedState_1')
.addAtAddressInstance(contractAddress, false, false, false)
.clickInstance(0)
.clickFunction('retrieve - call')
.testFunction('last',
{
'decoded output': { '0': 'uint256: 55' }
})
},
'Should show fork states provider in environment explorer & make txs using forked state #group1': function (browser: NightwatchBrowser) {
browser
Expand Down

0 comments on commit 47ed2e3

Please sign in to comment.