From dddd5c183fe7782c3691fbcb3965da005ee49d9c Mon Sep 17 00:00:00 2001 From: yann300 Date: Tue, 18 Jun 2024 15:58:24 +0200 Subject: [PATCH] add E2E --- apps/remix-ide-e2e/src/tests/url.test.ts | 12 ++++++++++++ .../remix-url-resolver/src/github-folder-resolver.ts | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/apps/remix-ide-e2e/src/tests/url.test.ts b/apps/remix-ide-e2e/src/tests/url.test.ts index 316c239448..82bef0e646 100644 --- a/apps/remix-ide-e2e/src/tests/url.test.ts +++ b/apps/remix-ide-e2e/src/tests/url.test.ts @@ -336,5 +336,17 @@ module.exports = { .waitForElementVisible('*[data-shared="tooltipPopup"]') .waitForElementContainsText('*[data-shared="tooltipPopup"]', 'initiating fileManager and calling "open" ...') .waitForElementContainsText('*[data-shared="tooltipPopup"]', 'initiating terminal and calling "log" ...') + }, + + 'Import Github folder from URL params #group4': function (browser: NightwatchBrowser) { + browser + .url('http://127.0.0.1:8080/#ghfolder=https://github.com/ethereum/remix-project/tree/master/apps/remix-ide/contracts/hardhat') + .refreshPage() + .currentWorkspaceIs('code-sample') + .openFile('contracts') + .openFile('Lock.sol') + .getEditorValue((content) => { + browser.assert.ok(content.indexOf('contract Lock {') !== -1, 'content does contain "contract Lock {"') + }) } } diff --git a/libs/remix-url-resolver/src/github-folder-resolver.ts b/libs/remix-url-resolver/src/github-folder-resolver.ts index 07fd8fa37c..6706111a71 100644 --- a/libs/remix-url-resolver/src/github-folder-resolver.ts +++ b/libs/remix-url-resolver/src/github-folder-resolver.ts @@ -9,7 +9,7 @@ export const githubFolderResolver = async (url, obj = {}, maxDepth, depth?, root const pathname = urlObj.pathname; const pathParts = pathname.split('/'); const folderPath = pathParts.slice(5).join('/'); - rootPath = rootPath || folderPath + rootPath = rootPath || folderPath for (const item of child) { if (item.type === 'file') { const response: AxiosResponse = await axios.get(item.download_url, { transformResponse: res => res })