diff --git a/apps/remix-ide-e2e/src/tests/dgit_github.test.ts b/apps/remix-ide-e2e/src/tests/dgit_github.test.ts index 37e72a6207..6c8f8cfa08 100644 --- a/apps/remix-ide-e2e/src/tests/dgit_github.test.ts +++ b/apps/remix-ide-e2e/src/tests/dgit_github.test.ts @@ -13,7 +13,7 @@ module.exports = { done() }) }, - 'Update settings for git #group1': function (browser: NightwatchBrowser) { + 'Update settings for git #group1 #group2': function (browser: NightwatchBrowser) { browser. clickLaunchIcon('dgit') .waitForElementVisible('*[data-id="initgit-btn"]') @@ -23,7 +23,7 @@ module.exports = { .setValue('*[data-id="githubEmail"]', 'git@example.com') .click('*[data-id="saveGitHubCredentials"]') }, - 'check if the settings are loaded #group1': function (browser: NightwatchBrowser) { + 'check if the settings are loaded #group1 #group2': function (browser: NightwatchBrowser) { browser. click('*[data-id="github-panel"]') .waitForElementVisible('*[data-id="connected-as-bunsenstraat"]') @@ -94,11 +94,11 @@ module.exports = { .waitForElementVisible({ selector: "//div[@id='commands-local-branch-select']//div[contains(@class, 'singleValue') and contains(text(), 'master')]", locateStrategy: 'xpath' - }) + }) }, 'check the remotes #group1': function (browser: NightwatchBrowser) { browser - + .click('*[data-id="remotes-panel"]') .waitForElementVisible('*[data-id="remotes-panel-content"]') .click({ @@ -188,6 +188,125 @@ module.exports = { .waitForElementVisible({ selector: "//div[@id='commands-local-branch-select']//div[contains(@class, 'singleValue') and contains(text(), 'links')]", locateStrategy: 'xpath' - }) - } + }) + }, + + 'add a remote #group2': function (browser: NightwatchBrowser) { + browser + .pause(1000) + .click('*[data-id="remotes-panel"]') + .click({ + selector: '//*[@data-id="remotes-panel-content"]//*[@data-id="fetch-repositories"]', + locateStrategy: 'xpath' + }) + .waitForElementVisible({ + selector: '//*[@data-id="remotes-panel-content"]//*[@id="repository-select"]', + locateStrategy: 'xpath' + }) + .click({ + selector: '//*[@data-id="remotes-panel-content"]//*[@id="repository-select"]', + locateStrategy: 'xpath' + }) + .waitForElementVisible({ + selector: '//*[@data-id="remotes-panel-content"]//*[contains(text(), "awesome-remix")]', + locateStrategy: 'xpath' + }) + .click({ + selector: '//*[@data-id="remotes-panel-content"]//*[contains(text(), "awesome-remix")]', + locateStrategy: 'xpath' + }) + .waitForElementVisible({ + selector: '//*[@data-id="remotes-panel-content"]//*[@data-id="remote-panel-remotename"]', + locateStrategy: 'xpath' + }) + .setValue({ + selector: '//*[@data-id="remotes-panel-content"]//*[@data-id="remote-panel-remotename"]', + locateStrategy: 'xpath' + }, 'newremote') + .waitForElementVisible({ + selector: '//*[@data-id="remotes-panel-content"]//*[@data-id="remote-panel-addremote"]', + locateStrategy: 'xpath' + }) + .click({ + selector: '//*[@data-id="remotes-panel-content"]//*[@data-id="remote-panel-addremote"]', + locateStrategy: 'xpath' + }) + .waitForElementVisible({ + selector: '//*[@data-id="remotes-panel-content"]//*[@data-id="remote-detail-newremote"]', + locateStrategy: 'xpath' + }) + }, + 'check the commands panel for newremote #group2': function (browser: NightwatchBrowser) { + browser + .pause(1000) + .click('*[data-id="commands-panel"]') + .waitForElementVisible({ + selector: "//div[@id='commands-remote-branch-select']//div[contains(@class, 'singleValue') and contains(text(), 'main')]", + locateStrategy: 'xpath' + }) + .waitForElementVisible({ + selector: "//div[@id='commands-remote-origin-select']//div[contains(@class, 'singleValue') and contains(text(), 'newremote')]", + locateStrategy: 'xpath' + }) + .waitForElementVisible({ + selector: "//div[@id='commands-local-branch-select']//div[contains(@class, 'singleValue') and contains(text(), 'main')]", + locateStrategy: 'xpath' + }) + .getAttribute({ + selector: '//*[@data-id="sourcecontrol-pull"]', + locateStrategy: 'xpath' + }, 'disabled', (result) => { + if (result.value) { + browser.assert.fail('Button is disabled') + } else { + browser.assert.ok(true) + } + }) + }, + 'remove the remove #group2': function (browser: NightwatchBrowser) { + browser + .pause(1000) + .click('*[data-id="remotes-panel"]') + .waitForElementVisible({ + selector: '//*[@data-id="remotes-panel-content"]//*[@data-id="remote-rm-newremote"]', + locateStrategy: 'xpath' + }) + .pause(2000) + .click({ + selector: '//*[@data-id="remotes-panel-content"]//*[@data-id="remote-rm-newremote"]', + locateStrategy: 'xpath' + }) + .pause(1000) + .waitForElementNotPresent({ + selector: '//*[@data-id="remotes-panel-content"]//*[@data-id="remote-detail-newremote"]', + locateStrategy: 'xpath' + }) + }, + 'check the commands panel for removed remote #group2': function (browser: NightwatchBrowser) { + browser + .pause(1000) + .click('*[data-id="commands-panel"]') + .waitForElementVisible({ + selector: "//div[@id='commands-remote-branch-select']//div[contains(@class, 'singleValue') and contains(text(), 'main')]", + locateStrategy: 'xpath' + }) + .waitForElementNotPresent({ + selector: "//div[@id='commands-remote-origin-select']//div[contains(@class, 'singleValue') and contains(text(), 'newremote')]", + locateStrategy: 'xpath' + }) + .waitForElementVisible({ + selector: "//div[@id='commands-local-branch-select']//div[contains(@class, 'singleValue') and contains(text(), 'main')]", + locateStrategy: 'xpath' + }) + .getAttribute({ + selector: '//*[@data-id="sourcecontrol-pull"]', + locateStrategy: 'xpath' + }, 'disabled', (result) => { + if (result.value) { + browser.assert.ok(true) + } else { + browser.assert.fail('Button is not disabled') + } + }) + }, } diff --git a/libs/remix-ui/git/src/components/navigation/remotesdetails.tsx b/libs/remix-ui/git/src/components/navigation/remotesdetails.tsx index cf74329c6d..89d8955414 100644 --- a/libs/remix-ui/git/src/components/navigation/remotesdetails.tsx +++ b/libs/remix-ui/git/src/components/navigation/remotesdetails.tsx @@ -60,7 +60,7 @@ export const RemotesDetailsNavigation = (props: RemotesDetailsNavigationProps) = remote }) }}> - actions.removeRemote(remote)}> + actions.removeRemote(remote)}> {remote?.url && openRemote()}>} diff --git a/libs/remix-ui/git/src/components/panels/remotesimport.tsx b/libs/remix-ui/git/src/components/panels/remotesimport.tsx index 3866de7222..646546c1a4 100644 --- a/libs/remix-ui/git/src/components/panels/remotesimport.tsx +++ b/libs/remix-ui/git/src/components/panels/remotesimport.tsx @@ -68,11 +68,11 @@ export const RemotesImport = () => { {repo ? - onRemoteNameChange(e.target.value)} value={remoteName} className="form-control mb-2" type="text" id="remotename" /> + onRemoteNameChange(e.target.value)} value={remoteName} className="form-control mb-2" type="text" id="remotename" /> : null} {repo && remoteName ? - : null}