From 10a23874732304e7c3004812f207988f9edc546d Mon Sep 17 00:00:00 2001 From: David Disu Date: Thu, 14 Jul 2022 16:21:41 +0100 Subject: [PATCH 1/4] Add e2e tests for clone repository feature. --- .../remix-ide-e2e/src/tests/workspace.test.ts | 80 ++++++++++++++++++- 1 file changed, 79 insertions(+), 1 deletion(-) diff --git a/apps/remix-ide-e2e/src/tests/workspace.test.ts b/apps/remix-ide-e2e/src/tests/workspace.test.ts index aa0d2bbaf1..2615aafd38 100644 --- a/apps/remix-ide-e2e/src/tests/workspace.test.ts +++ b/apps/remix-ide-e2e/src/tests/workspace.test.ts @@ -266,8 +266,86 @@ module.exports = { .waitForElementVisible('[data-id="workspacesSelect"]') .click('[data-id="workspacesSelect"]') .waitForElementNotPresent(`[data-id="dropdown-item-workspace_name_1"]`) - .end() }, + // CLONE REPOSITORY E2E START + + 'Should clone a repository #group2': function (browser: NightwatchBrowser) { + browser + .waitForElementVisible('[data-id="cloneGitRepository"]') + .click('[data-id="cloneGitRepository"]') + .waitForElementVisible('[data-id="fileSystemModalDialogModalBody-react"]') + .click('[data-id="fileSystemModalDialogModalBody-react"]') + .waitForElementVisible('[data-id="modalDialogCustomPromptTextClone"]') + .setValue('[data-id="modalDialogCustomPromptTextClone"]', 'https://github.com/ethereum/awesome-remix') + .click('[data-id="fileSystem-modal-footer-ok-react"]') + .waitForElementPresent('.fa-spinner') + .pause(5000) + .waitForElementNotPresent('.fa-spinner') + .waitForElementVisible('*[data-id="treeViewLitreeViewItem.git"]') + .waitForElementContainsText('[data-id="workspacesSelect"]', 'awesome-remix') + }, + + 'Should display dgit icon for cloned workspace #group2': function (browser: NightwatchBrowser) { + browser + .switchWorkspace('default_workspace') + .waitForElementNotVisible('[data-id="workspacesSelect"] .fa-code-branch') + .switchWorkspace('awesome-remix') + .waitForElementVisible('[data-id="workspacesSelect"] .fa-code-branch') + }, + + 'Should display non-clashing names for duplicate clone #group2': '' + function (browser: NightwatchBrowser) { + browser + .waitForElementVisible('[data-id="cloneGitRepository"]') + .click('[data-id="cloneGitRepository"]') + .waitForElementVisible('[data-id="fileSystemModalDialogModalBody-react"]') + .click('[data-id="fileSystemModalDialogModalBody-react"]') + .waitForElementVisible('[data-id="modalDialogCustomPromptTextClone"]') + .setValue('[data-id="modalDialogCustomPromptTextClone"]', 'https://github.com/ethereum/awesome-remix') + .click('[data-id="fileSystem-modal-footer-ok-react"]') + .pause(5000) + .waitForElementContainsText('[data-id="workspacesSelect"]', 'awesome-remix1') + .waitForElementVisible('[data-id="cloneGitRepository"]') + .click('[data-id="cloneGitRepository"]') + .waitForElementVisible('[data-id="fileSystemModalDialogModalBody-react"]') + .click('[data-id="fileSystemModalDialogModalBody-react"]') + .waitForElementVisible('[data-id="modalDialogCustomPromptTextClone"]') + .setValue('[data-id="modalDialogCustomPromptTextClone"]', 'https://github.com/ethereum/awesome-remix') + .click('[data-id="fileSystem-modal-footer-ok-react"]') + .pause(5000) + .waitForElementContainsText('[data-id="workspacesSelect"]', 'awesome-remix2') + .waitForElementVisible('[data-id="cloneGitRepository"]') + .click('[data-id="cloneGitRepository"]') + .waitForElementVisible('[data-id="fileSystemModalDialogModalBody-react"]') + .click('[data-id="fileSystemModalDialogModalBody-react"]') + .waitForElementVisible('[data-id="modalDialogCustomPromptTextClone"]') + .setValue('[data-id="modalDialogCustomPromptTextClone"]', 'https://github.com/ethereum/awesome-remix') + .click('[data-id="fileSystem-modal-footer-ok-react"]') + .pause(5000) + .waitForElementContainsText('[data-id="workspacesSelect"]', 'awesome-remix3') + .switchWorkspace('awesome-remix') + .switchWorkspace('awesome-remix1') + .switchWorkspace('awesome-remix2') + .switchWorkspace('awesome-remix3') + }, + + 'Should display error message in modal for failed clone #group2': function (browser: NightwatchBrowser) { + browser + .waitForElementVisible('[data-id="cloneGitRepository"]') + .click('[data-id="cloneGitRepository"]') + .waitForElementVisible('[data-id="fileSystemModalDialogModalBody-react"]') + .click('[data-id="fileSystemModalDialogModalBody-react"]') + .waitForElementVisible('[data-id="modalDialogCustomPromptTextClone"]') + .setValue('[data-id="modalDialogCustomPromptTextClone"]', 'https://github.com/ethereum/non-existent-repo') + .click('[data-id="fileSystem-modal-footer-ok-react"]') + .pause(5000) + .waitForElementVisible('[data-id="fileSystemModalDialogModalBody-react"]') + .waitForElementContainsText('[data-id="cloneGitRepositoryModalDialogModalBody-react"]', 'An error occurred: Please check that you have the correct URL for the repo. If the repo is private, you need to add your github credentials (with the valid token permissions) in Settings plugin') + .click('[data-id="cloneGitRepository-modal-footer-ok-react"]') + .end() + }, + + // CLONE REPOSITORY E2E END + tearDown: sauce } From eb1c25482276dec940260d6cac8be5d307c8bb15 Mon Sep 17 00:00:00 2001 From: David Disu Date: Fri, 15 Jul 2022 12:15:38 +0100 Subject: [PATCH 2/4] Fixed failing clone e2e test --- apps/remix-ide-e2e/src/tests/workspace.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/remix-ide-e2e/src/tests/workspace.test.ts b/apps/remix-ide-e2e/src/tests/workspace.test.ts index 2615aafd38..2bc0ea1811 100644 --- a/apps/remix-ide-e2e/src/tests/workspace.test.ts +++ b/apps/remix-ide-e2e/src/tests/workspace.test.ts @@ -339,7 +339,7 @@ module.exports = { .setValue('[data-id="modalDialogCustomPromptTextClone"]', 'https://github.com/ethereum/non-existent-repo') .click('[data-id="fileSystem-modal-footer-ok-react"]') .pause(5000) - .waitForElementVisible('[data-id="fileSystemModalDialogModalBody-react"]') + .waitForElementVisible('[data-id="cloneGitRepositoryModalDialogModalBody-react"]') .waitForElementContainsText('[data-id="cloneGitRepositoryModalDialogModalBody-react"]', 'An error occurred: Please check that you have the correct URL for the repo. If the repo is private, you need to add your github credentials (with the valid token permissions) in Settings plugin') .click('[data-id="cloneGitRepository-modal-footer-ok-react"]') .end() From 22dfd145b0784f1f7be18192f6512f717bf080ff Mon Sep 17 00:00:00 2001 From: Aniket-Engg Date: Fri, 15 Jul 2022 13:54:08 +0530 Subject: [PATCH 3/4] fix gist revision --- libs/remixd/src/bin/remixd.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/remixd/src/bin/remixd.ts b/libs/remixd/src/bin/remixd.ts index 9c561c5e65..f451f45565 100644 --- a/libs/remixd/src/bin/remixd.ts +++ b/libs/remixd/src/bin/remixd.ts @@ -166,7 +166,7 @@ function errorHandler (error: any, service: string) { async function isValidOrigin (origin: string): Promise { if (!origin) return false const domain = getDomain(origin) - const gistUrl = 'https://gist.githubusercontent.com/EthereumRemix/091ccc57986452bbb33f57abfb13d173/raw/3367e019335746b73288e3710af2922d4c8ef5a3/origins.json' + const gistUrl = 'https://gist.githubusercontent.com/EthereumRemix/091ccc57986452bbb33f57abfb13d173/raw/59cedab38ae94cc72b68854b3706f11819e4a0af/origins.json' try { const { data } = (await Axios.get(gistUrl)) as { data: any } From f70b0c3da0a1df2f33ae90bfc77689556129b210 Mon Sep 17 00:00:00 2001 From: Aniket-Engg Date: Fri, 15 Jul 2022 13:54:35 +0530 Subject: [PATCH 4/4] add beta to origins --- libs/remixd/src/origins.json | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libs/remixd/src/origins.json b/libs/remixd/src/origins.json index 5a3331f3c7..e0b8a5f283 100644 --- a/libs/remixd/src/origins.json +++ b/libs/remixd/src/origins.json @@ -1,8 +1,10 @@ { "data":[ "http://remix-alpha.ethereum.org", + "http://remix-beta.ethereum.org", "http://remix.ethereum.org", "https://remix-alpha.ethereum.org", + "https://remix-beta.ethereum.org", "https://remix.ethereum.org", "package://a7df6d3c223593f3550b35e90d7b0b1f.mod", "package://6fd22d6fe5549ad4c4d8fd3ca0b7816b.mod",