diff --git a/apps/remix-ide-e2e/src/tests/dgit_local.test.ts b/apps/remix-ide-e2e/src/tests/dgit_local.test.ts index ed397b2441..cca1726f1c 100644 --- a/apps/remix-ide-e2e/src/tests/dgit_local.test.ts +++ b/apps/remix-ide-e2e/src/tests/dgit_local.test.ts @@ -165,8 +165,8 @@ module.exports = { }, 'run pull from the header #group1': function (browser: NightwatchBrowser) { browser. - click('*[data-id="sourcecontrol-button-pull"]') - .waitForElementNotPresent('*[data-id="commits-panel-behind"]') + click('*[data-id="sourcecontrol-button-pull"]') + .waitForElementNotPresent('*[data-id="commits-panel-behind"]') }, 'check if the file is added #group1': function (browser: NightwatchBrowser) { browser @@ -176,26 +176,93 @@ module.exports = { // GROUP 2 'create a branch #group2': function (browser: NightwatchBrowser) { browser - .clickLaunchIcon('dgit') - .click('*[data-id="branches-panel"]') - .waitForElementVisible('*[data-id="newbranchname"]') - .setValue('*[data-id="newbranchname"]', 'testbranch') - .click('*[data-id="sourcecontrol-create-branch"]') - .waitForElementVisible('*[data-id="branches-current-branch-testbranch"]') - .pause(1000) + .clickLaunchIcon('dgit') + .click('*[data-id="branches-panel"]') + .waitForElementVisible('*[data-id="newbranchname"]') + .setValue('*[data-id="newbranchname"]', 'testbranch') + .click('*[data-id="sourcecontrol-create-branch"]') + .waitForElementVisible('*[data-id="branches-current-branch-testbranch"]') + .pause(1000) }, 'publish the branch #group2': function (browser: NightwatchBrowser) { browser - .waitForElementVisible('*[data-id="sourcecontrol-panel"]') - .click('*[data-id="sourcecontrol-panel"]') - .pause(1000) - .click('*[data-id="publishBranchButton"]') - .pause(2000) - .waitForElementNotVisible('*[data-id="publishBranchButton"]') + .waitForElementVisible('*[data-id="sourcecontrol-panel"]') + .click('*[data-id="sourcecontrol-panel"]') + .pause(1000) + .click('*[data-id="publishBranchButton"]') + .pause(2000) + .waitForElementNotVisible('*[data-id="publishBranchButton"]') }, 'check if the branch is published #group2': async function (browser: NightwatchBrowser) { const branches = await getBranches('/tmp/git/bare.git') browser.assert.ok(branches.includes('testbranch')) + }, + 'add file to new branch #group2': function (browser: NightwatchBrowser) { + browser. + addFile('test.txt', { content: 'hello world' }, 'README.md') + .clickLaunchIcon('dgit') + .waitForElementVisible({ + selector: "//*[@data-status='new-untracked' and @data-file='/test.txt']", + locateStrategy: 'xpath' + }) + .waitForElementVisible('*[data-id="addToGitChangestest.txt"]') + .pause(1000) + .click('*[data-id="addToGitChangestest.txt"]') + .waitForElementVisible({ + selector: "//*[@data-status='added-staged' and @data-file='/test.txt']", + locateStrategy: 'xpath' + }) + .setValue('*[data-id="commitMessage"]', 'testcommit') + .click('*[data-id="commitButton"]') + .pause(1000) + }, + 'check if the commit is ahead in the branches list #group2': function (browser: NightwatchBrowser) { + browser + .waitForElementVisible('*[data-id="branches-panel"]') + .click('*[data-id="branches-panel"]') + .waitForElementVisible('*[data-id="branches-current-branch-testbranch"]') + .click({ + selector: "//*[@data-id='branches-panel-content']//*[@data-id='branches-current-branch-testbranch']", + locateStrategy: 'xpath', + suppressNotFoundErrors: true + }) + .click({ + selector: "//*[@data-id='branches-panel-content']//*[@data-id='commits-panel-ahead']", + locateStrategy: 'xpath', + suppressNotFoundErrors: true + }) + .click({ + selector: "//*[@data-id='branches-panel-content']//*[@data-id='branchdifference-commits-testbranch-ahead']//*[@data-id='commit-summary-testcommit-ahead']", + locateStrategy: 'xpath', + }) + .click({ + selector: "//*[@data-id='branches-panel-content']//*[@data-id='branchdifference-commits-testbranch-ahead']//*[@data-id='commit-change-added-test.txt']", + locateStrategy: 'xpath', + }) + .click({ + selector: "//*[@data-id='branches-panel-content']//*[@data-id='local-branch-commits-testbranch']//*[@data-id='commit-summary-testcommit-ahead']", + locateStrategy: 'xpath', + }) + .waitForElementVisible({ + selector: "//*[@data-id='branches-panel-content']//*[@data-id='local-branch-commits-testbranch']//*[@data-id='commit-change-added-test.txt']", + locateStrategy: 'xpath', + }) + }, + 'switch back to master #group2': function (browser: NightwatchBrowser) { + browser + .click({ + selector: "//*[@data-id='branches-panel-content']//*[@data-id='branches-toggle-branch-master']", + locateStrategy: 'xpath', + }) + .waitForElementVisible({ + selector: "//*[@data-id='branches-panel-content']//*[@data-id='branches-toggle-current-branch-master']", + locateStrategy: 'xpath', + }) + }, + 'check if test file is gone #group2': function (browser: NightwatchBrowser) { + browser + .clickLaunchIcon('filePanel') + .waitForElementNotPresent('*[data-id="treeViewLitreeViewItemtest.txt"]') } } diff --git a/libs/remix-ui/git/src/components/panels/branches.tsx b/libs/remix-ui/git/src/components/panels/branches.tsx index fe3539f4a0..503bea1202 100644 --- a/libs/remix-ui/git/src/components/panels/branches.tsx +++ b/libs/remix-ui/git/src/components/panels/branches.tsx @@ -18,7 +18,7 @@ export const Branches = () => { return ( <> -
+
{context.branches && context.branches.length ?
{context.branches && context.branches.filter((branch, index) => !branch.remote).map((branch, index) => { diff --git a/libs/remix-ui/git/src/components/panels/branches/branchdifferencedetails.tsx b/libs/remix-ui/git/src/components/panels/branches/branchdifferencedetails.tsx index b93a3c596e..62ce46a696 100644 --- a/libs/remix-ui/git/src/components/panels/branches/branchdifferencedetails.tsx +++ b/libs/remix-ui/git/src/components/panels/branches/branchdifferencedetails.tsx @@ -36,7 +36,7 @@ export const BranchDifferenceDetails = (props: BrancheDifferenceProps) => { -
+
{commits && commits.map((commit, index) => { return ( {}} commit={commit}> diff --git a/libs/remix-ui/git/src/components/panels/branches/localbranchdetails.tsx b/libs/remix-ui/git/src/components/panels/branches/localbranchdetails.tsx index 7e292dae3a..02d3dff225 100644 --- a/libs/remix-ui/git/src/components/panels/branches/localbranchdetails.tsx +++ b/libs/remix-ui/git/src/components/panels/branches/localbranchdetails.tsx @@ -48,7 +48,7 @@ export const LocalBranchDetails = (props: BrancheDetailsProps) => { try { actions.checkout({ ref: oid }) - ; + ; } catch (e) { // } @@ -68,14 +68,16 @@ export const LocalBranchDetails = (props: BrancheDetailsProps) => { <>
- {context.localBranchCommits && Object.entries(context.localBranchCommits).map(([key, value]) => { - if (key == branch.name) { - return value.map((commit, index) => { - return () - }) - } - })} +
+ {context.localBranchCommits && Object.entries(context.localBranchCommits).map(([key, value]) => { + if (key == branch.name) { + return value.map((commit, index) => { + return () + }) + } + })} +
{hasNextPage && Load more} diff --git a/libs/remix-ui/git/src/components/panels/branches/remotebranchedetails.tsx b/libs/remix-ui/git/src/components/panels/branches/remotebranchedetails.tsx index 9a3cfa1cdc..1b21e1eb76 100644 --- a/libs/remix-ui/git/src/components/panels/branches/remotebranchedetails.tsx +++ b/libs/remix-ui/git/src/components/panels/branches/remotebranchedetails.tsx @@ -92,7 +92,7 @@ export const RemoteBranchDetails = (props: BrancheDetailsProps) => { <> -
+
{context.remoteBranchCommits && Object.entries(context.remoteBranchCommits).map(([key, value]) => { if (key == branch.name) { return value.map((page, index) => { diff --git a/libs/remix-ui/git/src/components/panels/commits.tsx b/libs/remix-ui/git/src/components/panels/commits.tsx index 9bdd268916..8fa50a9d99 100644 --- a/libs/remix-ui/git/src/components/panels/commits.tsx +++ b/libs/remix-ui/git/src/components/panels/commits.tsx @@ -48,7 +48,7 @@ export const Commits = () => { <> {context.commits && context.commits.length ? <>
-
+
{context.commits && context.commits.map((commit, index) => { return ( diff --git a/libs/remix-ui/git/src/components/panels/commits/commitdetailsitem.tsx b/libs/remix-ui/git/src/components/panels/commits/commitdetailsitem.tsx index 092d8994c8..7115347618 100644 --- a/libs/remix-ui/git/src/components/panels/commits/commitdetailsitem.tsx +++ b/libs/remix-ui/git/src/components/panels/commits/commitdetailsitem.tsx @@ -36,7 +36,7 @@ export const CommitDetailsItems = (props: CCommitDetailsItemsProps) => { ) } return (<> -
+
await openChanges(commitChange)}> {path.basename(commitChange.path)}
{commitChange.path}
diff --git a/libs/remix-ui/git/src/lib/gitactions.ts b/libs/remix-ui/git/src/lib/gitactions.ts index b3b5543f5a..1d78ea2d4f 100644 --- a/libs/remix-ui/git/src/lib/gitactions.ts +++ b/libs/remix-ui/git/src/lib/gitactions.ts @@ -534,7 +534,7 @@ export const saveGitHubCredentials = async (credentials: { username: string, ema const userFetched = await loadGitHubUserFromToken() if (!userFetched) { if (credentials.username && credentials.email) { - await plugin.call('notification', 'alert' , { + await plugin.call('notification', 'alert', { title: 'Error', id: 'github-credentials-error', message: `Could not retreive the user from GitHub. You can continue to use the app, but you will not be able to push or pull.` @@ -632,7 +632,7 @@ export const loadGitHubUserFromToken = async () => { } export const statusMatrix = async (filepaths: string[]) => { - const matrix = await plugin.call('dgitApi', 'status', { ref: "HEAD", filepaths: filepaths || ['.']}); + const matrix = await plugin.call('dgitApi', 'status', { ref: "HEAD", filepaths: filepaths || ['.'] }); const result = (matrix || []).map((x) => { return { filename: `/${x.shift()}`, @@ -748,9 +748,16 @@ export const fetchBranch = async (branch: branch, page: number) => { if (page == 1) { dispatch(resetRemoteBranchCommits({ branch })) } - const { owner, repo } = await getRepoDetails(branch.remote.url); - const rc = await plugin.call('dgitApi', 'remotecommits', { token, owner: owner, repo: repo, branch: branch.name, length, page }); - dispatch(setRemoteBranchCommits({ branch, commits: rc })) + try { + const { owner, repo } = await getRepoDetails(branch.remote.url); + const rc = await plugin.call('dgitApi', 'remotecommits', { token, owner: owner, repo: repo, branch: branch.name, length, page }); + dispatch(setRemoteBranchCommits({ branch, commits: rc })) + } catch (e) { + sendToGitLog({ + type: 'error', + message: `Error fetching remote commits: ${e.message}` + }) + } return }