From fbc8784a8c0b0c20662fce2b33791815cee388d0 Mon Sep 17 00:00:00 2001 From: aniket-engg Date: Thu, 23 Nov 2023 16:31:57 +0530 Subject: [PATCH 1/4] 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 From e63a7a6c5ff880646ca19ba9d551fdc633a296ae Mon Sep 17 00:00:00 2001 From: aniket-engg Date: Thu, 23 Nov 2023 22:59:37 +0530 Subject: [PATCH 2/4] fix names --- apps/remix-ide-e2e/src/tests/ballot.test.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/remix-ide-e2e/src/tests/ballot.test.ts b/apps/remix-ide-e2e/src/tests/ballot.test.ts index 37291f5eac..4c76dad9dd 100644 --- a/apps/remix-ide-e2e/src/tests/ballot.test.ts +++ b/apps/remix-ide-e2e/src/tests/ballot.test.ts @@ -105,10 +105,10 @@ module.exports = { .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('contracts/lib/storage/src/Storage.sol', { content: storageContract}) .addFile('remappings.txt', { content: 'storage=contracts/lib/storage/src' }) - .addFile('contracts/Retreiver.sol', { content: storageContract }) - .verifyContracts(['Retreiver', 'Storage']) + .addFile('contracts/Retriever.sol', { content: retrieverContract }) + .verifyContracts(['Retriever', 'Storage']) }, 'Deploy and use Ballot using external web3 #group2': function (browser: NightwatchBrowser) { From 8f0bc3591eeba9615216189208abf3e97aef951b Mon Sep 17 00:00:00 2001 From: aniket-engg Date: Thu, 23 Nov 2023 23:00:25 +0530 Subject: [PATCH 3/4] fix test name --- apps/remix-ide-e2e/src/tests/ballot.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/remix-ide-e2e/src/tests/ballot.test.ts b/apps/remix-ide-e2e/src/tests/ballot.test.ts index 4c76dad9dd..8ab7948930 100644 --- a/apps/remix-ide-e2e/src/tests/ballot.test.ts +++ b/apps/remix-ide-e2e/src/tests/ballot.test.ts @@ -92,7 +92,7 @@ module.exports = { }) }, - 'Compile Ballot with remappings set in remappings.txt file #group1': function (browser: NightwatchBrowser) { + 'Compile with remappings set in remappings.txt file #group1': function (browser: NightwatchBrowser) { browser .clickLaunchIcon('filePanel') .click('*[data-id="workspacesMenuDropdown"]') From 161c3268d378031397feea97ede014262c855a20 Mon Sep 17 00:00:00 2001 From: aniket-engg Date: Fri, 24 Nov 2023 13:23:35 +0530 Subject: [PATCH 4/4] fix import --- apps/remix-ide-e2e/src/tests/ballot.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/remix-ide-e2e/src/tests/ballot.test.ts b/apps/remix-ide-e2e/src/tests/ballot.test.ts index 8ab7948930..7e9c51e43f 100644 --- a/apps/remix-ide-e2e/src/tests/ballot.test.ts +++ b/apps/remix-ide-e2e/src/tests/ballot.test.ts @@ -547,7 +547,7 @@ contract Storage { const retrieverContract = ` pragma solidity >=0.8.2 <0.9.0; -import "storage/store.sol"; +import "storage/Storage.sol"; contract Retriever is Storage {