From fbc8784a8c0b0c20662fce2b33791815cee388d0 Mon Sep 17 00:00:00 2001 From: aniket-engg Date: Thu, 23 Nov 2023 16:31:57 +0530 Subject: [PATCH] added e2e to verify remappings --- apps/remix-ide-e2e/src/tests/ballot.test.ts | 45 +++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/apps/remix-ide-e2e/src/tests/ballot.test.ts b/apps/remix-ide-e2e/src/tests/ballot.test.ts index d06f2f6f98..37291f5eac 100644 --- a/apps/remix-ide-e2e/src/tests/ballot.test.ts +++ b/apps/remix-ide-e2e/src/tests/ballot.test.ts @@ -92,6 +92,25 @@ module.exports = { }) }, + 'Compile Ballot with remappings set in remappings.txt file #group1': function (browser: NightwatchBrowser) { + browser + .clickLaunchIcon('filePanel') + .click('*[data-id="workspacesMenuDropdown"]') + .click('*[data-id="workspacecreate"]') + .waitForElementVisible('*[data-id="modalDialogCustomPromptTextCreate"]') + .waitForElementVisible('[data-id="fileSystemModalDialogModalFooter-react"] > button') + // eslint-disable-next-line dot-notation + .execute(function () { document.querySelector('*[data-id="modalDialogCustomPromptTextCreate"]')['value'] = 'workspace_remix_default' }) + .waitForElementPresent('[data-id="fileSystemModalDialogModalFooter-react"] .modal-ok') + .execute(function () { (document.querySelector('[data-id="fileSystemModalDialogModalFooter-react"] .modal-ok') as HTMLElement).click() }) + .pause(1000) + .waitForElementVisible('*[data-id="treeViewLitreeViewItemcontracts"]') + .addFile('contracts/lib/storage/src/Storage.sol', { content: retrieverContract }) + .addFile('remappings.txt', { content: 'storage=contracts/lib/storage/src' }) + .addFile('contracts/Retreiver.sol', { content: storageContract }) + .verifyContracts(['Retreiver', 'Storage']) + }, + 'Deploy and use Ballot using external web3 #group2': function (browser: NightwatchBrowser) { browser .openFile('Untitled.sol') @@ -510,4 +529,30 @@ object "Contract" { } } } +` + +const storageContract = ` +pragma solidity >=0.8.2 <0.9.0; + +contract Storage { + + uint256 public number; + + function store(uint256 num) public { + number = num; + } +} +` + +const retrieverContract = ` +pragma solidity >=0.8.2 <0.9.0; + +import "storage/store.sol"; + +contract Retriever is Storage { + + function retrieve() public view returns (uint256){ + return number; + } +} ` \ No newline at end of file